Skip to content

Commit 66b6d43

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2197f87 commit 66b6d43

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

t/t7506-status-submodule.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ sanitize_output () {
2222
mv output2 output
2323
}
2424

25+
sanitize_diff () {
26+
sed -e "/^index [0-9a-f,]*\.\.[0-9a-f]*/d" "$1"
27+
}
28+
2529

2630
test_expect_success 'setup' '
2731
test_create_repo_with_commit sub &&
@@ -269,7 +273,6 @@ short_sha1_merge_sub1=$(cd sub1 && git rev-parse --short HEAD)
269273
short_sha1_merge_sub2=$(cd sub2 && git rev-parse --short HEAD)
270274
cat >diff_expect <<\EOF
271275
diff --cc .gitmodules
272-
index badaa4c,44f999a..0000000
273276
--- a/.gitmodules
274277
+++ b/.gitmodules
275278
@@@ -1,3 -1,3 +1,9 @@@
@@ -286,7 +289,6 @@ EOF
286289

287290
cat >diff_submodule_expect <<\EOF
288291
diff --cc .gitmodules
289-
index badaa4c,44f999a..0000000
290292
--- a/.gitmodules
291293
+++ b/.gitmodules
292294
@@@ -1,3 -1,3 +1,9 @@@
@@ -306,15 +308,17 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
306308
cd super &&
307309
git diff >../diff_actual 2>&1
308310
) &&
309-
test_cmp diff_expect diff_actual
311+
sanitize_diff diff_actual >diff_sanitized &&
312+
test_cmp diff_expect diff_sanitized
310313
'
311314

312315
test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
313316
(
314317
cd super &&
315318
git diff --submodule >../diff_submodule_actual 2>&1
316319
) &&
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
318322
'
319323

320324
# We'll setup different cases for further testing:

0 commit comments

Comments
 (0)