Skip to content

Commit

Permalink
t7506: avoid checking for SHA-1-specific constants
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bk2204 authored and gitster committed Jul 30, 2020
1 parent 2197f87 commit 66b6d43
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions t/t7506-status-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ sanitize_output () {
mv output2 output
}

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


test_expect_success 'setup' '
test_create_repo_with_commit sub &&
Expand Down Expand Up @@ -269,7 +273,6 @@ short_sha1_merge_sub1=$(cd sub1 && git rev-parse --short HEAD)
short_sha1_merge_sub2=$(cd sub2 && git rev-parse --short HEAD)
cat >diff_expect <<\EOF
diff --cc .gitmodules
index badaa4c,44f999a..0000000
--- a/.gitmodules
+++ b/.gitmodules
@@@ -1,3 -1,3 +1,9 @@@
Expand All @@ -286,7 +289,6 @@ EOF

cat >diff_submodule_expect <<\EOF
diff --cc .gitmodules
index badaa4c,44f999a..0000000
--- a/.gitmodules
+++ b/.gitmodules
@@@ -1,3 -1,3 +1,9 @@@
Expand All @@ -306,15 +308,17 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
cd super &&
git diff >../diff_actual 2>&1
) &&
test_cmp diff_expect diff_actual
sanitize_diff diff_actual >diff_sanitized &&
test_cmp diff_expect diff_sanitized
'

test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
(
cd super &&
git diff --submodule >../diff_submodule_actual 2>&1
) &&
test_cmp diff_submodule_expect diff_submodule_actual
sanitize_diff diff_submodule_actual >diff_sanitized &&
test_cmp diff_submodule_expect diff_sanitized
'

# We'll setup different cases for further testing:
Expand Down

0 comments on commit 66b6d43

Please sign in to comment.