git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] add -p: demonstrate failure when running 'edit' after a split

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Apr 14, 2015, 11:32 UTC
Message-ID
<1429011168-23216-2-git-send-email-Matthieu.Moy@imag.fr>
In-Reply-To
<1429011168-23216-1-git-send-email-Matthieu.Moy@imag.fr>

The test passes if one replaces the 'e' command with a 'y' command in the 'add -p' session.

Reported-by: Tanky Woo <wtq1990@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 t/t3701-add-interactive.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 24ddd8a..b48a75c 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -335,6 +335,31 @@ test_expect_success 'split hunk "add -p (edit)"' '
 	! grep "^+15" actual
 '
 
+test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
+	cat >test <<-\EOF &&
+	5
+	10
+	20
+	21
+	30
+	31
+	40
+	50
+	60
+	EOF
+	git reset &&
+	# test sequence is s(plit), n(o), y(es), e(dit)
+	# q n q q is there to make sure we exit at the end.
+	for a in s n y e   q n q q
+	do
+		echo $a
+	done |
+	EDITOR=: git add -p 2>error &&
+	test_must_be_empty error &&
+	git diff >actual &&
+	! grep "^+31" actual
+'
+
 test_expect_success 'patch mode ignores unmerged entries' '
 	git reset --hard &&
 	test_commit conflict &&
-- 
2.4.0.rc1.42.g9642cc6
Previous: Matthieu MoyNext: Eric Sunshine
Message 4 of 17 in “Git add -p “Your edited hunk does not apply. Edit again””
  1. Tanky WooApr 14, 2015
  2. Matthieu MoyApr 14, 2015
  3. 0/4 demonstrate add -p and stash -p failures.Matthieu Moy, Apr 14, 2015
  4. 1/4 add -p: demonstrate failure when running 'edit' after a splitMatthieu Moy, Apr 14, 2015
  5. Eric SunshineApr 14, 2015
  6. 2/4 t3904-stash-patch: fix test descriptionMatthieu Moy, Apr 14, 2015
  7. 3/4 t3904-stash-patch: factor PERL prereq at the top of the fileMatthieu Moy, Apr 14, 2015
  8. 4/4 stash -p: demonstrate failure of split with mixed y/nMatthieu Moy, Apr 14, 2015
  9. Eric SunshineApr 14, 2015
  10. Junio C HamanoApr 14, 2015
  11. 0/5 demonstrate add -p and stash -p failuresMatthieu Moy, Apr 16, 2015
  12. 1/5 t3701-add-interactive: simplify codeMatthieu Moy, Apr 16, 2015
  13. 2/5 add -p: demonstrate failure when running 'edit' after a splitMatthieu Moy, Apr 16, 2015
  14. 3/5 t3904-stash-patch: fix test descriptionMatthieu Moy, Apr 16, 2015
  15. 4/5 t3904-stash-patch: factor PERL prereq at the top of the fileMatthieu Moy, Apr 16, 2015
  16. 5/5 stash -p: demonstrate failure of split with mixed y/nMatthieu Moy, Apr 16, 2015
  17. Matthieu MoyApr 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.