t3702: abstract away SHA-1-specific constants

Strip out the index lines in the diff before comparing them, as these will differ between hash algorithms. This leads to a smaller, simpler change than editing the index line. 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 18cb8231b3f5569aaaa55357c70e9e08bf9285a2
1 file changed +3 -4
t/t3702-add-edit.sh
+3 -4
@@ -40,7 +40,6 @@ test_expect_success 'setup' '
40
41 cat > expected-patch << EOF
42 diff --git a/file b/file
43 -index b9834b5..9020acb 100644
43 --- a/file
44 +++ b/file
45 @@ -1,11 +1,6 @@
@@ -80,7 +79,6 @@ EOF
79
80 cat > expected << EOF
81 diff --git a/file b/file
83 -index b9834b5..ef6e94c 100644
82 --- a/file
83 +++ b/file
84 @@ -1,10 +1,12 @@
@@ -100,7 +98,7 @@ EOF
98
99 echo "#!$SHELL_PATH" >fake-editor.sh
100 cat >> fake-editor.sh <<\EOF
103 -mv -f "$1" orig-patch &&
101 +egrep -v '^index' "$1" >orig-patch &&
102 mv -f patch "$1"
103 EOF
104
@@ -113,7 +111,8 @@ test_expect_success 'add -e' '
111 git add -e &&
112 test_cmp second-part file &&
113 test_cmp orig-patch expected-patch &&
116 - git diff --cached > out &&
114 + git diff --cached >actual &&
115 + grep -v index actual >out &&
116 test_cmp out expected
117
118 '