t4020: abstract away SHA-1-specific constants
Adjust the test so that it computes variables for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 21, 2018 at 02:01 UTC
f2fffc17dcc2c93d0fddbec8f655ebfab2a822ec
1 file changed
+8
-2
t/t4020-diff-external.sh
+8
-2
@@ -13,6 +13,8 @@ test_expect_success setup '
13
14
test_tick &&
15
echo second >file &&
16
+ before=$(git hash-object file) &&
17
+ before=$(git rev-parse --short $before) &&
18
git add file &&
19
git commit -m second &&
20
@@ -180,9 +182,13 @@ test_expect_success 'no diff with -diff' '
182
echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file
183
184
test_expect_success 'force diff with "diff"' '
185
+ after=$(git hash-object file) &&
186
+ after=$(git rev-parse --short $after) &&
187
echo >.gitattributes "file diff" &&
188
git diff >actual &&
185
- test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
189
+ sed -e "s/^index .*/index $before..$after 100644/" \
190
+ "$TEST_DIRECTORY"/t4020/diff.NUL >expected-diff &&
191
+ test_cmp expected-diff actual
192
'
193
194
test_expect_success 'GIT_EXTERNAL_DIFF with more than one changed files' '
@@ -237,7 +243,7 @@ test_expect_success 'diff --cached' '
243
git update-index --assume-unchanged file &&
244
echo second >file &&
245
git diff --cached >actual &&
240
- test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
246
+ test_cmp expected-diff actual
247
'
248
249
test_expect_success 'clean up crlf leftovers' '