summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-02 11:04:59 +0900
committerJunio C Hamano <gitster@pobox.com>2018-11-02 11:04:59 +0900
commit85fcf1cbb6eb2e8fb1512a5ffe834b6a07deb4cd (patch)
treef88809b7b7bf00832305a28ac1a76044e26f1ba1
parent789b1f70422d5c9ffb3a0ecb11284aa0ac13985e (diff)
parent3a4a4cab3ef024e10af7a5bbcaed4b961c60f1db (diff)
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
-rw-r--r--sequencer.c3
-rw-r--r--t/lib-rebase.sh2
-rwxr-xr-xt/t3418-rebase-continue.sh4
3 files changed, 6 insertions, 3 deletions
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