summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-06-02 07:46:52 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-06-02 07:46:52 -0700
commitf2823263bd53b62831450277c746c6cbfcb95a15 (patch)
tree394b44bd80218db1af71eba168b30ce3ece71850 /t
parentMerge branch 'tr/maint-doc-stash-pop' into maint (diff)
parentt3701: ensure correctly set up repository after skipped tests (diff)
downloadtgif-f2823263bd53b62831450277c746c6cbfcb95a15.tar.xz
Merge branch 'jc/maint-add-p-coalesce-fix' into maint
* jc/maint-add-p-coalesce-fix: t3701: ensure correctly set up repository after skipped tests Revert "git-add--interactive: remove hunk coalescing" Splitting a hunk that adds a line at the top fails in "add -p"
Diffstat (limited to 't')
-rwxr-xr-xt/t3701-add-interactive.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index dfc65601aa..fd2a55a5c2 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -165,4 +165,42 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
# end of tests disabled when filemode is not usable
+test_expect_success 'setup again' '
+ git reset --hard &&
+ test_chmod +x file &&
+ echo content >>file
+'
+
+# Write the patch file with a new line at the top and bottom
+cat >patch <<EOF
+index 180b47c..b6f2c08 100644
+--- a/file
++++ b/file
+@@ -1,2 +1,4 @@
++firstline
+ baseline
+ content
++lastline
+EOF
+# Expected output, similar to the patch but w/ diff at the top
+cat >expected <<EOF
+diff --git a/file b/file
+index b6f2c08..61b9053 100755
+--- a/file
++++ b/file
+@@ -1,2 +1,4 @@
++firstline
+ baseline
+ content
++lastline
+EOF
+# Test splitting the first patch, then adding both
+test_expect_success 'add first line works' '
+ git commit -am "clear local changes" &&
+ git apply patch &&
+ (echo s; echo y; echo y) | git add -p file &&
+ git diff --cached > diff &&
+ test_cmp expected diff
+'
+
test_done