From: Junio C Hamano Date: Fri, 2 Nov 2018 02:04:59 +0000 (+0900) Subject: Merge branch 'js/rebase-i-shortopt' X-Git-Tag: v2.20.0-rc0~83 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/85fcf1cbb6eb2e8fb1512a5ffe834b6a07deb4cd?hp=789b1f70422d5c9ffb3a0ecb11284aa0ac13985e Merge branch 'js/rebase-i-shortopt' "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 --- diff --git a/sequencer.c b/sequencer.c index 73efa92da8..9e1ab3a2a7 100644 --- a/sequencer.c +++ b/sequencer.c @@ -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; diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index 241f64b09b..f6c45ee08f 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -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";; diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh index 75cd2d80df..4c3f7d8dfe 100755 --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@ -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