From 1cc462446e2f12fd58449845d1a3029d8cc81921 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 7 Aug 2023 19:09:33 +0200 Subject: [PATCH 1/3] t/lib-rebase: set_fake_editor(): fix recognition of reset's short command ... in FAKE_LINES. This has been broken ever since it was introduced in 5dcdd7409a (t/lib-rebase: prepare for testing `git rebase --rebase-merges`, 2019-07-31), but it's not actually used, so it's a cosmetic defect only. Signed-off-by: Oswald Buddenhagen Signed-off-by: Junio C Hamano --- t/lib-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index 7ca5b918f0..e6179ab529 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -49,7 +49,7 @@ set_fake_editor () { action=\& for line in $FAKE_LINES; do case $line in - pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|r|merge|m) + pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|t|merge|m) action="$line";; exec_*|x_*|break|b) echo "$line" | sed 's/_/ /g' >> "$1";; From 010a0b62e0899851c9f7080988b5d0adb3a9bc0c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 7 Aug 2023 19:09:34 +0200 Subject: [PATCH 2/3] t/lib-rebase: set_fake_editor(): handle FAKE_LINES more consistently Default next action after 'fakesha' to preserving the command instead of forcing 'pick', consistently with other "instant-effect" keywords. There is no reason why one would want that inconsistency, so this was clearly just an oversight in commit 5dcdd740 ("t/lib-rebase: prepare for testing `git rebase --rebase-merges`"). Rectifying it makes the behavior easier to reason about and document. This would affect hypothetical "fakesha " sequences where line already isn't a pick, which currently don't appear. Signed-off-by: Oswald Buddenhagen Signed-off-by: Junio C Hamano --- t/lib-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index e6179ab529..9ed87ca7ab 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -64,7 +64,7 @@ set_fake_editor () { fakesha) test \& != "$action" || action=pick echo "$action XXXXXXX False commit" >> "$1" - action=pick;; + action=\&;; *) sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1" action=\&;; From 20a0bd45fa26c36472057393453bcafdda13e1d5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 9 Aug 2023 19:15:31 +0200 Subject: [PATCH 3/3] t/lib-rebase: improve documentation of set_fake_editor() Firstly, make it reflect better what actually happens. Not omitting some possibilities makes it easier to fully exploit them, and not contradicting the implementation makes it easier to grok and thus modify the code. Secondly, improve the overall structure, putting more general info further up. Thirdly, document `merge`, `fakesha`, and `break`, which were previously omitted entirely. Signed-off-by: Oswald Buddenhagen Signed-off-by: Junio C Hamano --- t/lib-rebase.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index 9ed87ca7ab..11d2dc9fe3 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -8,18 +8,21 @@ # - check that non-commit messages have a certain line count with $EXPECT_COUNT # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT # - rewrite a rebase -i script as directed by $FAKE_LINES. -# $FAKE_LINES consists of a sequence of words separated by spaces. -# The following word combinations are possible: +# $FAKE_LINES consists of a sequence of words separated by spaces; +# spaces inside the words are encoded as underscores. +# The following words are possible: # -# "" -- add a "pick" line with the SHA1 taken from the -# specified line. +# "" -- override the command for the next line specification. Can be +# "pick", "squash", "fixup[_-(c|C)]", "edit", "reword", "drop", +# "merge[_-(c|C)_]", or "bad" for an invalid command. # -# " " -- add a line with the specified command -# ("pick", "squash", "fixup"|"fixup_-C"|"fixup_-c", "edit", "reword" or "drop") -# and the SHA1 taken from the specified line. +# "" -- add a command, using the specified line as a template. +# If the command has not been overridden, the line will be copied +# verbatim, usually resulting in a "pick" line. # -# "_" -- add a space, like "fixup_-C" implies "fixup -C" and -# "exec_cmd_with_args" add an "exec cmd with args" line. +# "fakesha" -- add a command ("pick" by default), using a fake SHA1. +# +# "exec_[command...]", "break" -- add the specified command. # # "#" -- Add a comment line. #