summaryrefslogtreecommitdiff
path: root/t/t3702-add-edit.sh
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2018-05-21 02:01:32 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-05-21 13:55:48 +0900
commit18cb8231b3f5569aaaa55357c70e9e08bf9285a2 (patch)
treedf1cdb3204be8853bbaca0d494bca0171cd57792 /t/t3702-add-edit.sh
parentt3103: abstract away SHA-1-specific constants (diff)
downloadtgif-18cb8231b3f5569aaaa55357c70e9e08bf9285a2.tar.xz
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>
Diffstat (limited to 't/t3702-add-edit.sh')
-rwxr-xr-xt/t3702-add-edit.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh
index 3cb74ca296..c6af7f82b5 100755
--- a/t/t3702-add-edit.sh
+++ b/t/t3702-add-edit.sh
@@ -40,7 +40,6 @@ test_expect_success 'setup' '
cat > expected-patch << EOF
diff --git a/file b/file
-index b9834b5..9020acb 100644
--- a/file
+++ b/file
@@ -1,11 +1,6 @@
@@ -80,7 +79,6 @@ EOF
cat > expected << EOF
diff --git a/file b/file
-index b9834b5..ef6e94c 100644
--- a/file
+++ b/file
@@ -1,10 +1,12 @@
@@ -100,7 +98,7 @@ EOF
echo "#!$SHELL_PATH" >fake-editor.sh
cat >> fake-editor.sh <<\EOF
-mv -f "$1" orig-patch &&
+egrep -v '^index' "$1" >orig-patch &&
mv -f patch "$1"
EOF
@@ -113,7 +111,8 @@ test_expect_success 'add -e' '
git add -e &&
test_cmp second-part file &&
test_cmp orig-patch expected-patch &&
- git diff --cached > out &&
+ git diff --cached >actual &&
+ grep -v index actual >out &&
test_cmp out expected
'