Merge branch 'js/rebase-i-shortopt'
authorJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2018 02:04:59 +0000 (11:04 +0900)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2018 02:04:59 +0000 (11:04 +0900)
"git rebase -i" learned to take 'b' as the short form of 'break'
option in the todo list.

* js/rebase-i-shortopt:
rebase -i: recognize short commands without arguments

sequencer.c
t/lib-rebase.sh
t/t3418-rebase-continue.sh
index 73efa92da837c895980ce2d101c190218b6a7204..9e1ab3a2a7e3f65cc444cded7f3330bb27be2db8 100644 (file)
@@ -1994,7 +1994,8 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
                if (skip_prefix(bol, todo_command_info[i].str, &bol)) {
                        item->command = i;
                        break;
-               } else if (bol[1] == ' ' && *bol == todo_command_info[i].c) {
+               } else if ((bol + 1 == eol || bol[1] == ' ') &&
+                          *bol == todo_command_info[i].c) {
                        bol++;
                        item->command = i;
                        break;
index 241f64b09b3773f5a6b35992a40097a298093771..f6c45ee08f6e348bc7af2939d2bfa65f5c057ae0 100644 (file)
@@ -49,7 +49,7 @@ set_fake_editor () {
                case $line in
                pick|squash|fixup|edit|reword|drop)
                        action="$line";;
-               exec*|break)
+               exec*|break|b)
                        echo "$line" | sed 's/_/ /g' >> "$1";;
                "#")
                        echo '# comment' >> "$1";;
index 75cd2d80df0f3a180129c315d427ae2222662429..4c3f7d8dfea1fb087c839c3a039e728642869975 100755 (executable)
@@ -245,7 +245,9 @@ unset GIT_SEQUENCE_EDITOR
 
 test_expect_success 'the todo command "break" works' '
        rm -f execed &&
-       FAKE_LINES="break exec_>execed" git rebase -i HEAD &&
+       FAKE_LINES="break b exec_>execed" git rebase -i HEAD &&
+       test_path_is_missing execed &&
+       git rebase --continue &&
        test_path_is_missing execed &&
        git rebase --continue &&
        test_path_is_file execed