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

Re: [PATCH] sequencer: avoid dropping fixup commit that targets self via commit-ish

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 19, 2022, 23:09 UTC
Message-ID
<xmqqmtav7ygq.fsf@gitster.g>
In-Reply-To
<20220918121053.880225-1-aclopte@gmail.com>
Johannes Altmanninger <aclopte@gmail.com> writes:
> +test_expect_success 'auto squash of fixup commit that matches branch name which points back to fixup commit' '
> ...
> +	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p}" tmp >actual &&

The construct is rejected by sed implementations of BSD descent, it seems.

https://github.com/git/git/actions/runs/3084784922/jobs/4987337058#step:4:1844

++ sed -ne '/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p}' tmp sed: 1: "/^[^#]/{s/[0-9a-f]\{7,\ ...": extra characters at the end of p command error: last command exited with $?=1 not ok 11 - auto squash that matches regex

Here is a fix-up that can be squashed in.
Thanks.
 t/t3415-rebase-autosquash.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index 879e628512..d65d2258c3 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -237,7 +237,7 @@ test_expect_success 'auto squash that matches regex' '
 	git commit --allow-empty -m "hay needle hay" &&
 	git commit --allow-empty -m "fixup! :/[n]eedle" &&
 	GIT_SEQUENCE_EDITOR="cat >tmp" git rebase --autosquash -i HEAD^^ &&
-	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p}" tmp >actual &&
+	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p;}" tmp >actual &&
 	cat <<-EOF >expect &&
 	pick HASH hay needle hay # empty
 	fixup HASH fixup! :/[n]eedle # empty
@@ -253,7 +253,7 @@ test_expect_success 'auto squash of fixup commit that matches branch name' '
 	git commit --allow-empty -m "unrelated commit" &&
 	git commit --allow-empty -m "fixup! wip" &&
 	GIT_SEQUENCE_EDITOR="cat >tmp" git rebase --autosquash -i HEAD^^^^ &&
-	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p}" tmp >actual &&
+	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p;}" tmp >actual &&
 	cat <<-EOF >expect &&
 	pick HASH wip commit (just a prefix match so overshadowed by branch) # empty
 	pick HASH tip of wip # empty
@@ -268,7 +268,7 @@ test_expect_success 'auto squash of fixup commit that matches branch name which
 	git commit --allow-empty -m "fixup! self-cycle" &&
 	git branch self-cycle &&
 	GIT_SEQUENCE_EDITOR="cat >tmp" git rebase --autosquash -i HEAD^^ &&
-	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p}" tmp >actual &&
+	sed -ne "/^[^#]/{s/[0-9a-f]\{7,\}/HASH/g;p;}" tmp >actual &&
 	cat <<-EOF >expect &&
 	pick HASH second commit
 	pick HASH fixup! self-cycle # empty
-- 
2.38.0-rc0-146-g9b794391bb
Previous: Johannes AltmanningerNext: Johannes Altmanninger
Message 18 of 19 in “[BUG] fixup commit is dropped during rebase if subject = branch name”
  1. Erik Cervin EdinSep 17, 2022
  2. Junio C HamanoSep 17, 2022
  3. Erik Cervin EdinSep 18, 2022
  4. Johannes AltmanningerSep 17, 2022
  5. sequencer: avoid dropping fixup commit that targets self via commit-ishJohannes Altmanninger, Sep 18, 2022
  6. Erik Cervin EdinSep 18, 2022
  7. Johannes AltmanningerSep 18, 2022
  8. Junio C HamanoSep 19, 2022
  9. Junio C HamanoSep 19, 2022
  10. Johannes AltmanningerSep 20, 2022
  11. Junio C HamanoSep 19, 2022
  12. sequencer: avoid dropping fixup commit that targets self via commit-ishJohannes Altmanninger, Sep 20, 2022
  13. Phillip WoodSep 20, 2022
  14. Junio C HamanoSep 21, 2022
  15. Johannes AltmanningerSep 22, 2022
  16. Junio C HamanoSep 22, 2022
  17. sequencer: avoid dropping fixup commit that targets self via commit-ishJohannes Altmanninger, Sep 24, 2022
  18. Junio C HamanoSep 19, 2022
  19. Johannes AltmanningerSep 20, 2022

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.