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

Re: [PATCH] cherry-pick: do not error on non-merge commits when '-m 1' is specified

From
Sergey Organov <sorganov@gmail.com>
Date
Dec 13, 2018, 15:35 UTC
Message-ID
<878t0twibw.fsf@javad.com>
In-Reply-To
<87o99qylv5.fsf@javad.com>
Sergey Organov <sorganov@gmail.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Sergey Organov <sorganov@gmail.com> writes:
>>
[...]
Show 14 quoted lines
>>
>> The change to the code itself looks sane, but applying this patch
>> alone will break existing tests whose expectations must be updated,
>> and this new behaviour must be protected by a new test (or two) so
>> that we won't accidentally stop accepting "-m 1" for a single-parent
>> commit.
>
> I fixed most of the tests, but
>
> "t3510/4: cherry-pick persists opts correctly"
>
> is an offender for me. It looks like it [ab]uses current "-m 1" behavior
> just to stop in the middle of the sequence, and I'm not sure how to fix
> it most suitably.
I came up with the following as a preparatory change. Looks acceptable?
-- 8< --
    t3510: stop using '-m 1' to force failure mid-sequence of cherry-picks
    
    We are going to allow 'git cherry-pick -m 1' for non-merge commits, so
    this method to force failure will stop to work.
    
    Use '-m 4' instead as it's very unlikely we will ever have such an
    octopus in this test setup.
	Modified   t/t3510-cherry-pick-sequence.sh
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index c84eeef..a873cf4 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -61,7 +61,8 @@ test_expect_success 'cherry-pick mid-cherry-pick-sequence' '
 
 test_expect_success 'cherry-pick persists opts correctly' '
 	pristine_detach initial &&
-	test_expect_code 128 git cherry-pick -s -m 1 --strategy=recursive -X patience -X ours initial..anotherpick &&
+	m=4 &&
+	test_expect_code 128 git cherry-pick -s -m $m --strategy=recursive -X patience -X ours initial..anotherpick &&
 	test_path_is_dir .git/sequencer &&
 	test_path_is_file .git/sequencer/head &&
 	test_path_is_file .git/sequencer/todo &&
@@ -69,7 +70,7 @@ test_expect_success 'cherry-pick persists opts correctly' '
 	echo "true" >expect &&
 	git config --file=.git/sequencer/opts --get-all options.signoff >actual &&
 	test_cmp expect actual &&
-	echo "1" >expect &&
+	echo "$m" >expect &&
 	git config --file=.git/sequencer/opts --get-all options.mainline >actual &&
 	test_cmp expect actual &&
 	echo "recursive" >expect &&

-- 8< --
-- 
Sergey
Previous: Sergey OrganovNext: Junio C Hamano
Message 7 of 22 in “cherry-pick: do not error on non-merge commits when '-m 1' is specified”
  1. cherry-pick: do not error on non-merge commits when '-m 1' is specifiedSergey Organov, May 25, 2018
  2. Junio C HamanoJun 21, 2018
  3. Sergey OrganovJun 22, 2018
  4. Sergey OrganovDec 12, 2018
  5. Junio C HamanoDec 13, 2018
  6. Sergey OrganovDec 13, 2018
  7. Sergey OrganovDec 13, 2018
  8. Junio C HamanoDec 14, 2018
  9. 0/4 Allow 'cherry-pick -m 1' for non-merge commitsSergey Organov, Dec 14, 2018
  10. 1/4 t3510: stop using '-m 1' to force failure mid-sequence of cherry-picksSergey Organov, Dec 14, 2018
  11. 2/4 cherry-pick: do not error on non-merge commits when '-m 1' is specifiedSergey Organov, Dec 14, 2018
  12. 3/4 t3502: validate '-m 1' argument is now accepted for non-merge commitsSergey Organov, Dec 14, 2018
  13. 4/4 t3506: validate '-m 1 -ff' is now accepted for non-merge commitsSergey Organov, Dec 14, 2018
  14. Sergey OrganovMar 19, 2019
  15. Junio C HamanoMar 20, 2019
  16. Jeff KingMar 20, 2019
  17. Sergey OrganovMar 25, 2019
  18. Jeff KingMar 26, 2019
  19. Elijah NewrenMar 26, 2019
  20. Jeff KingMar 26, 2019
  21. Elijah NewrenMar 27, 2019
  22. Sergey OrganovMar 27, 2019

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.