pretty: add support for separator option in %(trailers)
[gitweb.git] / t / t3702-add-edit.sh
index 4ee47cc9a862cdbe8c63bc9d4ebbe46ff3c344bc..6c676645d837477077e9e349bf01398f3aa52b5f 100755 (executable)
@@ -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
 
@@ -112,10 +110,18 @@ test_expect_success 'add -e' '
        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
+
+'
 
+test_expect_success 'add -e notices editor failure' '
+       git reset --hard &&
+       echo change >>file &&
+       test_must_fail env GIT_EDITOR=false git add -e &&
+       test_expect_code 1 git diff --exit-code
 '
 
 test_done