@matheusbsbs / matheus-bagliano / commits / 66b6d43ca4
Fork 0

t7506: avoid checking for SHA-1-specific constants

Adjust the test to sanitize the diffs and strip out object IDs from them, as it does for other object IDs, since we are not interested in the particular values used. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jul 29, 2020 at 23:14 UTC 66b6d43ca4a4367c697bba976704c6fb1771b0a7
1 file changed +8 -4
t/t7506-status-submodule.sh
+8 -4
@@ -22,6 +22,10 @@ sanitize_output () {
22 mv output2 output
23 }
24
25 +sanitize_diff () {
26 + sed -e "/^index [0-9a-f,]*\.\.[0-9a-f]*/d" "$1"
27 +}
28 +
29
30 test_expect_success 'setup' '
31 test_create_repo_with_commit sub &&
@@ -269,7 +273,6 @@ short_sha1_merge_sub1=$(cd sub1 && git rev-parse --short HEAD)
273 short_sha1_merge_sub2=$(cd sub2 && git rev-parse --short HEAD)
274 cat >diff_expect <<\EOF
275 diff --cc .gitmodules
272 -index badaa4c,44f999a..0000000
276 --- a/.gitmodules
277 +++ b/.gitmodules
278 @@@ -1,3 -1,3 +1,9 @@@
@@ -286,7 +289,6 @@ EOF
289
290 cat >diff_submodule_expect <<\EOF
291 diff --cc .gitmodules
289 -index badaa4c,44f999a..0000000
292 --- a/.gitmodules
293 +++ b/.gitmodules
294 @@@ -1,3 -1,3 +1,9 @@@
@@ -306,7 +308,8 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
308 cd super &&
309 git diff >../diff_actual 2>&1
310 ) &&
309 - test_cmp diff_expect diff_actual
311 + sanitize_diff diff_actual >diff_sanitized &&
312 + test_cmp diff_expect diff_sanitized
313 '
314
315 test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
@@ -314,7 +317,8 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
317 cd super &&
318 git diff --submodule >../diff_submodule_actual 2>&1
319 ) &&
317 - test_cmp diff_submodule_expect diff_submodule_actual
320 + sanitize_diff diff_submodule_actual >diff_sanitized &&
321 + test_cmp diff_submodule_expect diff_sanitized
322 '
323
324 # We'll setup different cases for further testing: