cat > expected-patch << EOF
diff --git a/file b/file
-index b9834b5..9020acb 100644
--- a/file
+++ b/file
@@ -1,11 +1,6 @@
cat > expected << EOF
diff --git a/file b/file
-index b9834b5..ef6e94c 100644
--- a/file
+++ b/file
@@ -1,10 +1,12 @@
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
cp second-part file &&
git add -e &&
test_cmp second-part file &&
- test_cmp orig-patch expected-patch &&
- git diff --cached > out &&
- test_cmp out expected
+ test_cmp expected-patch orig-patch &&
+ git diff --cached >actual &&
+ grep -v index actual >out &&
+ test_cmp expected out
'