Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
t3404 (rebase -i): introduce helper to check position of HEAD
author
Jonathan Nieder
<jrnieder@gmail.com>
Sun, 31 Oct 2010 07:40:30 +0000
(
02:40
-0500)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 9 Nov 2010 23:06:41 +0000
(15:06 -0800)
The same code to check the position of HEAD is used by several
tests in this script. Factor it out as a function and simplify it.
Noticed using an &&-chaining tester, because the current code
does not propagate the precise exit status from errors.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3404-rebase-interactive.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
99b028e
)
diff --git
a/t/t3404-rebase-interactive.sh
b/t/t3404-rebase-interactive.sh
index 4097a2d9c6941d4f6c8d7c39f95a446a07cf2cc4..4fcedda23dfcf0d25bdb5d9903671b03ddf3bb58 100755
(executable)
--- a/
t/t3404-rebase-interactive.sh
+++ b/
t/t3404-rebase-interactive.sh
@@
-29,6
+29,12
@@
Initial setup:
. "$TEST_DIRECTORY"/lib-rebase.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
+test_cmp_rev () {
+ git describe --always --tags "$1" >expect.rev &&
+ git describe --always --tags "$2" >actual.rev &&
+ test_cmp expect.rev actual.rev
+}
+
set_fake_editor
# WARNING: Modifications to the initial repository can change the SHA ID used
set_fake_editor
# WARNING: Modifications to the initial repository can change the SHA ID used
@@
-80,20
+86,12
@@
test_expect_success 'rebase -i with the exec command' '
test_path_is_file touch-one &&
test_path_is_file touch-two &&
test_path_is_missing touch-three " (should have stopped before)" &&
test_path_is_file touch-one &&
test_path_is_file touch-two &&
test_path_is_missing touch-three " (should have stopped before)" &&
- test $(git rev-parse C) = $(git rev-parse HEAD) || {
- echo "Stopped at wrong revision:"
- echo "($(git describe --tags HEAD) instead of C)"
- false
- } &&
+ test_cmp_rev C HEAD &&
git rebase --continue &&
test_path_is_file touch-three &&
test_path_is_file "touch-file name with spaces" &&
test_path_is_file touch-after-semicolon &&
git rebase --continue &&
test_path_is_file touch-three &&
test_path_is_file "touch-file name with spaces" &&
test_path_is_file touch-after-semicolon &&
- test $(git rev-parse master) = $(git rev-parse HEAD) || {
- echo "Stopped at wrong revision:"
- echo "($(git describe --tags HEAD) instead of master)"
- false
- } &&
+ test_cmp_rev master HEAD &&
rm -f touch-*
'
rm -f touch-*
'
@@
-114,11
+112,7
@@
test_expect_success 'rebase -i with the exec command checks tree cleanness' '
export FAKE_LINES &&
test_must_fail git rebase -i HEAD^
) &&
export FAKE_LINES &&
test_must_fail git rebase -i HEAD^
) &&
- test $(git rev-parse master^) = $(git rev-parse HEAD) || {
- echo "Stopped at wrong revision:"
- echo "($(git describe --tags HEAD) instead of master^)"
- false
- } &&
+ test_cmp_rev master^ HEAD &&
git reset --hard &&
git rebase --continue
'
git reset --hard &&
git rebase --continue
'