summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f29b5e0)
raw | patch | inline | side by side (parent: f29b5e0)
author | Christian Couder <chriscool@tuxfamily.org> | |
Wed, 21 Jul 2010 04:25:02 +0000 (06:25 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 23 Jul 2010 22:07:39 +0000 (15:07 -0700) |
In a test like:
test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify fourth)"
the --verify does not accomplish much, since the exit status of
git rev-parse is not propagated to test. So it is more robust to
define and use the helper functions check_head_differs_from() and
check_head_equals() as done by this patch.
Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify fourth)"
the --verify does not accomplish much, since the exit status of
git rev-parse is not propagated to test. So it is more robust to
define and use the helper functions check_head_differs_from() and
check_head_equals() as done by this patch.
Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3508-cherry-pick-many-commits.sh | patch | blob | history |
index 6044173007c44882049ab187e2d97265215f2604..0f61495b2c2110eb3c11feeb07727aa43a14c8af 100755 (executable)
. ./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 &&
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' '
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' '
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' '
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' '
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