Skip to content

Commit 5dcdd74

Browse files
dschogitster
authored andcommitted
t/lib-rebase: prepare for testing git rebase --rebase-merges
The format of the todo list is quite a bit different in the `--rebase-merges` mode; Let's prepare the fake editor to handle those todo lists properly, too. The original idea was that we keep the original command unless overridden, and because the original todo lists only had `pick` lines anyway, we could be sloppy and "override" the command by the same command (i.e. use the sed replacement pattern "pick" instead of "&"). This actually would not have worked with `fixup` and `squash` commands, but it would appear that we never tried to use the fake editor with `--autosquash`. However, in the next commit we want to use the fake editor in conjunction with `--rebase-merges`, so let's use the correct sed replacement pattern. Technically, it is not necessary to take care of the `fakesha` thing (where we reuse the sed replacement pattern to craft a new todo command), at least for now, as the only user of that thing overrides the `action` anyway. Nevertheless, for completeness' sake, we do take care of it. Helped-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e145d99 commit 5dcdd74

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

t/lib-rebase.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ set_fake_editor () {
4444
rm -f "$1"
4545
echo 'rebase -i script before editing:'
4646
cat "$1".tmp
47-
action=pick
47+
action=\&
4848
for line in $FAKE_LINES; do
4949
case $line in
50-
pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d)
50+
pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|r|merge|m)
5151
action="$line";;
5252
exec_*|x_*|break|b)
5353
echo "$line" | sed 's/_/ /g' >> "$1";;
@@ -58,11 +58,12 @@ set_fake_editor () {
5858
bad)
5959
action="badcmd";;
6060
fakesha)
61+
test \& != "$action" || action=pick
6162
echo "$action XXXXXXX False commit" >> "$1"
6263
action=pick;;
6364
*)
64-
sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
65-
action=pick;;
65+
sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1"
66+
action=\&;;
6667
esac
6768
done
6869
echo 'rebase -i script after editing:'

0 commit comments

Comments
 (0)