summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorMatt Graham <mdg149@gmail.com>2009-05-15 23:10:19 -0400
committerJunio C Hamano <gitster@pobox.com>2009-05-16 18:52:03 -0700
commitf67182bf65b01290a9544e9599ea8255e657e567 (patch)
tree5fef6e40b0d888a1050690d2207ef5559d4fa88f /t/t3701-add-interactive.sh
parent4774780ab196ff4ace780445c06c8e5bfffffc49 (diff)
downloadgit-f67182bf65b01290a9544e9599ea8255e657e567.tar.gz
Splitting a hunk that adds a line at the top fails in "add -p"
Splitting a hunk into two in add -p doesn't work for a diff that adds a new line at the top of the file with other add in the same hunk. Signed-off-by: Matthew Graham <mdg149@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index dfc65601aa..9999fcd4b6 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -165,4 +165,36 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
# end of tests disabled when filemode is not usable
+# 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_failure '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