Skip to content

Commit 18cb823

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 831c61c commit 18cb823

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

t/t3702-add-edit.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ test_expect_success 'setup' '
4040

4141
cat > expected-patch << EOF
4242
diff --git a/file b/file
43-
index b9834b5..9020acb 100644
4443
--- a/file
4544
+++ b/file
4645
@@ -1,11 +1,6 @@
@@ -80,7 +79,6 @@ EOF
8079

8180
cat > expected << EOF
8281
diff --git a/file b/file
83-
index b9834b5..ef6e94c 100644
8482
--- a/file
8583
+++ b/file
8684
@@ -1,10 +1,12 @@
@@ -100,7 +98,7 @@ EOF
10098

10199
echo "#!$SHELL_PATH" >fake-editor.sh
102100
cat >> fake-editor.sh <<\EOF
103-
mv -f "$1" orig-patch &&
101+
egrep -v '^index' "$1" >orig-patch &&
104102
mv -f patch "$1"
105103
EOF
106104

@@ -113,7 +111,8 @@ test_expect_success 'add -e' '
113111
git add -e &&
114112
test_cmp second-part file &&
115113
test_cmp orig-patch expected-patch &&
116-
git diff --cached > out &&
114+
git diff --cached >actual &&
115+
grep -v index actual >out &&
117116
test_cmp out expected
118117
119118
'

0 commit comments

Comments
 (0)