summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/t3508-cherry-pick-many-commits.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh
index 6044173007..0f61495b2c 100755
--- a/t/t3508-cherry-pick-many-commits.sh
+++ b/t/t3508-cherry-pick-many-commits.sh
@@ -4,6 +4,18 @@ test_description='test cherry-picking many commits'
. ./test-lib.sh
+check_head_differs_from() {
+ head=$(git rev-parse --verify HEAD) &&
+ arg=$(git rev-parse --verify "$1") &&
+ test "$head" != "$arg"
+}
+
+check_head_equals() {
+ head=$(git rev-parse --verify HEAD) &&
+ arg=$(git rev-parse --verify "$1") &&
+ test "$head" = "$arg"
+}
+
test_expect_success setup '
echo first > file1 &&
git add file1 &&
@@ -36,7 +48,7 @@ test_expect_success 'cherry-pick first..fourth works' '
git diff --quiet other &&
git diff --quiet HEAD other &&
test_cmp expected actual &&
- test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify fourth)"
+ check_head_differs_from fourth
'
test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
@@ -53,7 +65,7 @@ test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
git diff --quiet other &&
git diff --quiet HEAD other &&
test_cmp expected actual &&
- test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify fourth)"
+ check_head_differs_from fourth
'
test_expect_success 'cherry-pick --ff first..fourth works' '
@@ -63,7 +75,7 @@ test_expect_success 'cherry-pick --ff first..fourth works' '
git cherry-pick --ff first..fourth &&
git diff --quiet other &&
git diff --quiet HEAD other &&
- test "$(git rev-parse --verify HEAD)" = "$(git rev-parse --verify fourth)"
+ check_head_equals fourth
'
test_expect_success 'cherry-pick -n first..fourth works' '
@@ -113,7 +125,7 @@ test_expect_success 'cherry-pick -3 fourth works' '
git cherry-pick -3 fourth &&
git diff --quiet other &&
git diff --quiet HEAD other &&
- test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify fourth)"
+ check_head_differs_from fourth
'
test_expect_success 'cherry-pick --stdin works' '
@@ -123,7 +135,7 @@ test_expect_success 'cherry-pick --stdin works' '
git rev-list --reverse first..fourth | git cherry-pick --stdin &&
git diff --quiet other &&
git diff --quiet HEAD other &&
- test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify fourth)"
+ check_head_differs_from fourth
'
test_done