Merge branch 'ob/test-lib-rebase-fake-editor-updates'

Test updates.

* ob/test-lib-rebase-fake-editor-updates:
  t/lib-rebase: improve documentation of set_fake_editor()
  t/lib-rebase: set_fake_editor(): handle FAKE_LINES more consistently
  t/lib-rebase: set_fake_editor(): fix recognition of reset's short command
This commit is contained in:
Junio C Hamano
2023-08-24 09:32:34 -07:00

View File

@ -8,18 +8,21 @@
# - check that non-commit messages have a certain line count with $EXPECT_COUNT # - 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 # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT
# - rewrite a rebase -i script as directed by $FAKE_LINES. # - rewrite a rebase -i script as directed by $FAKE_LINES.
# $FAKE_LINES consists of a sequence of words separated by spaces. # $FAKE_LINES consists of a sequence of words separated by spaces;
# The following word combinations are possible: # spaces inside the words are encoded as underscores.
# The following words are possible:
# #
# "<lineno>" -- add a "pick" line with the SHA1 taken from the # "<cmd>" -- override the command for the next line specification. Can be
# specified line. # "pick", "squash", "fixup[_-(c|C)]", "edit", "reword", "drop",
# "merge[_-(c|C)_<rev>]", or "bad" for an invalid command.
# #
# "<cmd> <lineno>" -- add a line with the specified command # "<lineno>" -- add a command, using the specified line as a template.
# ("pick", "squash", "fixup"|"fixup_-C"|"fixup_-c", "edit", "reword" or "drop") # If the command has not been overridden, the line will be copied
# and the SHA1 taken from the specified line. # verbatim, usually resulting in a "pick" line.
# #
# "_" -- add a space, like "fixup_-C" implies "fixup -C" and # "fakesha" -- add a command ("pick" by default), using a fake SHA1.
# "exec_cmd_with_args" add an "exec cmd with args" line. #
# "exec_[command...]", "break" -- add the specified command.
# #
# "#" -- Add a comment line. # "#" -- Add a comment line.
# #
@ -49,7 +52,7 @@ set_fake_editor () {
action=\& action=\&
for line in $FAKE_LINES; do for line in $FAKE_LINES; do
case $line in 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";; action="$line";;
exec_*|x_*|break|b) exec_*|x_*|break|b)
echo "$line" | sed 's/_/ /g' >> "$1";; echo "$line" | sed 's/_/ /g' >> "$1";;
@ -64,7 +67,7 @@ set_fake_editor () {
fakesha) fakesha)
test \& != "$action" || action=pick test \& != "$action" || action=pick
echo "$action XXXXXXX False commit" >> "$1" echo "$action XXXXXXX False commit" >> "$1"
action=pick;; action=\&;;
*) *)
sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1" sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1"
action=\&;; action=\&;;