t3404: abstract away SHA-1-specific constants
Adjust the test so that it computes variables for object IDs instead of using hard-coded hashes. Add a use of $EMPTY_TREE instead of a hard-coded value. Remove a comment about hard-coded hashes which is no longer applicable. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Aug 18, 2019 at 19:16 UTC
4dd1b5f90f2ae150f0b0d9213c703600c43e598d
1 file changed
+11
-11
t/t3404-rebase-interactive.sh
+11
-11
@@ -29,9 +29,6 @@ Initial setup:
29
30
. "$TEST_DIRECTORY"/lib-rebase.sh
31
32
-# WARNING: Modifications to the initial repository can change the SHA ID used
33
-# in the expect2 file for the 'stop on conflicting pick' test.
34
-
32
test_expect_success 'setup' '
33
test_commit A file1 &&
34
test_commit B file1 &&
@@ -233,25 +230,28 @@ test_expect_success 'exchange two commits' '
230
set_fake_editor &&
231
FAKE_LINES="2 1" git rebase -i HEAD~2 &&
232
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
236
- test G = $(git cat-file commit HEAD | sed -ne \$p)
233
+ test G = $(git cat-file commit HEAD | sed -ne \$p) &&
234
+ blob1=$(git rev-parse --short HEAD^:file1) &&
235
+ blob2=$(git rev-parse --short HEAD:file1) &&
236
+ commit=$(git rev-parse --short HEAD)
237
'
238
239
test_expect_success 'stop on conflicting pick' '
240
- cat >expect <<-\EOF &&
240
+ cat >expect <<-EOF &&
241
diff --git a/file1 b/file1
242
- index f70f10e..fd79235 100644
242
+ index $blob1..$blob2 100644
243
--- a/file1
244
+++ b/file1
245
@@ -1 +1 @@
246
-A
247
+G
248
EOF
249
- cat >expect2 <<-\EOF &&
249
+ cat >expect2 <<-EOF &&
250
<<<<<<< HEAD
251
D
252
=======
253
G
254
- >>>>>>> 5d18e54... G
254
+ >>>>>>> $commit... G
255
EOF
256
git tag new-branch1 &&
257
set_fake_editor &&
@@ -1003,7 +1003,7 @@ test_expect_success 'rebase -i --root temporary sentinel commit' '
1003
git checkout B &&
1004
set_fake_editor &&
1005
test_must_fail env FAKE_LINES="2" git rebase -i --root &&
1006
- git cat-file commit HEAD | grep "^tree 4b825dc642cb" &&
1006
+ git cat-file commit HEAD | grep "^tree $EMPTY_TREE" &&
1007
git rebase --abort
1008
'
1009
@@ -1161,7 +1161,7 @@ test_expect_success 'rebase -i error on commits with \ in message' '
1161
test_expect_code 1 grep " emp" error
1162
'
1163
1164
-test_expect_success 'short SHA-1 setup' '
1164
+test_expect_success SHA1 'short SHA-1 setup' '
1165
test_when_finished "git checkout master" &&
1166
git checkout --orphan collide &&
1167
git rm -rf . &&
@@ -1173,7 +1173,7 @@ test_expect_success 'short SHA-1 setup' '
1173
)
1174
'
1175
1176
-test_expect_success 'short SHA-1 collide' '
1176
+test_expect_success SHA1 'short SHA-1 collide' '
1177
test_when_finished "reset_rebase && git checkout master" &&
1178
git checkout collide &&
1179
(