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

Re: Cherry-pick dangles and forgets helpful advice in next

From
Junio C Hamano <gitster@pobox.com>
Date
May 23, 2012, 22:58 UTC
Message-ID
<7vaa0yzeqr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vehqazf9d.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Phil Hord <hordp@cisco.com> writes:
>>
>>> In git.git 'master' when I cherry-pick a commit which is eventually
>>> empty, git gives me a friendly description of my supposed error, leaves
>>> my cherry-pick "pending" and exits with an error code.
>>> ...
>>> In 'next' this is broken.

The above was written back when nh/empty-rebase topic was not in 'master' yet.

The attached will help reproducing it.
 t/t3505-cherry-pick-empty.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index 92f00cd..bd06981 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -23,8 +23,19 @@ test_expect_success setup '
 	git checkout master &&
 	git checkout -b empty-branch2 &&
 	test_tick &&
-	git commit --allow-empty -m "empty"
+	git commit --allow-empty -m "empty" &&
+
+	git checkout master &&
+	echo second >>file1 &&
+	git add file1 &&
+	test_tick &&
+	git commit -m "second" &&
 
+	git checkout -b merge-to-empty master^ &&
+	echo second >>file1 &&
+	git add file1 &&
+	test_tick &&
+	git commit -m "will merge to empty"
 '
 
 test_expect_success 'cherry-pick an empty commit' '
@@ -40,7 +51,13 @@ test_expect_success 'index lockfile was removed' '
 
 '
 
+test_expect_failure 'cherry-pick to result in empty' '
+	git checkout master^0 &&
+	test_must_fail git cherry-pick merge-to-empty
+'
+
 test_expect_success 'cherry-pick a commit with an empty message' '
+	git reset --hard &&
 	git checkout master && {
 		git cherry-pick empty-branch
 		test "$?" = 1
Previous: Junio C HamanoNext: Phil Hord
Message 5 of 10 in “Cherry-pick dangles and forgets helpful advice in next”
  1. Phil HordMay 23, 2012
  2. Junio C HamanoMay 23, 2012
  3. Junio C HamanoMay 23, 2012
  4. Junio C HamanoMay 23, 2012
  5. Junio C HamanoMay 23, 2012
  6. Phil HordMay 23, 2012
  7. Junio C HamanoMay 23, 2012
  8. Junio C HamanoMay 30, 2012
  9. Phil HordMay 30, 2012
  10. Junio C HamanoMay 31, 2012

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.