diff mbox series

t/lib-rebase: (mostly) cosmetic improvements to set_fake_editor()

Message ID 20230323162234.995450-1-oswald.buddenhagen@gmx.de (mailing list archive)
State New, archived
Headers show
Series t/lib-rebase: (mostly) cosmetic improvements to set_fake_editor() | expand

Commit Message

Oswald Buddenhagen March 23, 2023, 4:22 p.m. UTC
- Make the documentation reflect better what actually happens, and add
  some missing info
- Fix recognition of reset's short command in FAKE_LINES
- Default next action after 'fakesha' to preserving the command instead
  of forcing 'pick'. This is consistent with other "instant-effect"
  keywords.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
 t/lib-rebase.sh | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

Comments

Oswald Buddenhagen April 26, 2023, 3:45 p.m. UTC | #1
ping!

(also on three other unanswered patches from the same day.)
Junio C Hamano April 26, 2023, 5:24 p.m. UTC | #2
Oswald Buddenhagen <oswald.buddenhagen@gmx.de> writes:

> ping!
>
> (also on three other unanswered patches from the same day.)

I would be a wrong person to ping.  

    $ git shortlog -n -s --since=18.months --no-merges master -- t/lib-rebase.sh
         2	Phillip Wood
         1	Derrick Stolee

Running "git blame" on the lines the patch touched may give you
folks who may know better than these two but those who made
contributions long time ago whose contributions still survive to
this day may no longer be around in the project, so your mileage may
vary.  

"git blame" for the line that uses "action=\&" finds 5dcdd740
(t/lib-rebase: prepare for testing `git rebase --rebase-merges`,
2019-07-31) and explains why "pick" was changed to "\&", so adding
the author of that patch to the list of people you ask reviews for
may also be a good idea.

HTH for you to find appropriate reviewers better next time.

Thanks.
Felipe Contreras May 2, 2023, 4:38 p.m. UTC | #3
Junio C Hamano wrote:
> Oswald Buddenhagen <oswald.buddenhagen@gmx.de> writes:
> 
> > ping!
> >
> > (also on three other unanswered patches from the same day.)
> 
> I would be a wrong person to ping.  
> 
>     $ git shortlog -n -s --since=18.months --no-merges master -- t/lib-rebase.sh
>          2	Phillip Wood
>          1	Derrick Stolee

Also:

https://github.com/felipec/git-related
Phillip Wood May 17, 2023, 9:23 a.m. UTC | #4
Hi Oswald

On 23/03/2023 16:22, Oswald Buddenhagen wrote:

This project avoids commit messages that are a list of changes instead 
preferring the commit message to explain _why_ the changes are being 
made. The reason for this is that it makes it much easier for a future 
contributor to understand the reasoning behind a particular change. 
Having a list of changes is often a symptom that the commit is trying to 
do more than one thing at once and should be split up. Here there are 
three separate changes all mixed into the same commit.

> - Make the documentation reflect better what actually happens, and add
>    some missing info

Having read the proposed changes to the documentation I'm not sure what 
it is in the original you're objecting to. The script may well process 
each token separately but as far as the user is concerned it appears to 
take either "<cmd> <lineno>" or "<lineno>"

> - Fix recognition of reset's short command in FAKE_LINES

This fix is definitely needed and should be in its own commit in a 
separate series to any of the other changes here so it can be applied 
without being held up by discussions on those other changes. Presumably 
we don't have any users of the short reset command name as it has been 
broken ever since it was introduced in 5dcdd7409a (t/lib-rebase: prepare 
for testing `git rebase --rebase-merges`, 2019-07-31)

> - Default next action after 'fakesha' to preserving the command instead
>    of forcing 'pick'. This is consistent with other "instant-effect"
>    keywords.

I'm not sure what the motivation for this change is. What does it 
facilitate that we cannot do now and why do we want to do whatever that is?

Best Wishes

Phillip

> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> ---
>   t/lib-rebase.sh | 25 ++++++++++++++-----------
>   1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> index 7ca5b918f0..184b25b427 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:
>   #
> -#   "<lineno>" -- add a "pick" line with the SHA1 taken from the
> -#       specified line.
> +#   "<cmd>" -- override the command for the next line specification. Can be
> +#       "pick", "squash", "fixup"|"fixup_-C"|"fixup_-c", "edit", "reword",
> +#       "drop", "merge[_-{c|C}_<SHA1>]", or "bad" for an invalid command.
>   #
> -#   "<cmd> <lineno>" -- 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.
> +#   "<lineno>" -- 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_[...]", "break" -- add the specified command.
>   #
>   #   "#" -- Add a comment line.
>   #
> @@ -49,7 +52,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";;
> @@ -64,7 +67,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=\&;;
diff mbox series

Patch

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 7ca5b918f0..184b25b427 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:
 #
-#   "<lineno>" -- add a "pick" line with the SHA1 taken from the
-#       specified line.
+#   "<cmd>" -- override the command for the next line specification. Can be
+#       "pick", "squash", "fixup"|"fixup_-C"|"fixup_-c", "edit", "reword",
+#       "drop", "merge[_-{c|C}_<SHA1>]", or "bad" for an invalid command.
 #
-#   "<cmd> <lineno>" -- 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.
+#   "<lineno>" -- 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_[...]", "break" -- add the specified command.
 #
 #   "#" -- Add a comment line.
 #
@@ -49,7 +52,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";;
@@ -64,7 +67,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=\&;;