rebase-i: explicitly accept tab as separator in commands
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Thu, 1 Oct 2015 08:18:41 +0000 (10:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Oct 2015 18:36:44 +0000 (11:36 -0700)
The git-rebase-todo is parsed several times with different parsers. In
principle, the user input is normalized by transform_todo_ids and
further parsing can be stricter.

In case the user wrote

pick deadbeef<TAB>commit message

the parser of transform_todo_ids was considering the sha1 to be
"deadbeef<TAB>commit", and was leaving the tab in the transformed sheet.
In practice, this went unnoticed since the actual command interpretation
was done later in do_next which did accept the tab as a separator.

Make it explicit in the code of transform_todo_ids that tabs are
accepted. This way, code that mimicks it will also accept tabs as
separator.

A similar construct appears in skip_unnecessary_picks, but this one
comes after transform_todo_ids, hence reads the normalized format, so it
needs not be changed.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh
index dcc3401b5a8c45fd9c5ba474416eb4a6c3c9a29e..51e0e58c679f4af6b4ede692333c4e7ea0adc8f7 100644 (file)
@@ -732,8 +732,8 @@ transform_todo_ids () {
                        # that do not have a SHA-1 at the beginning of $rest.
                        ;;
                *)
-                       sha1=$(git rev-parse --verify --quiet "$@" ${rest%% *}) &&
-                       rest="$sha1 ${rest#* }"
+                       sha1=$(git rev-parse --verify --quiet "$@" ${rest%%[     ]*}) &&
+                       rest="$sha1 ${rest#*[    ]}"
                        ;;
                esac
                printf '%s\n' "$command${rest:+ }$rest"