git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: gitster@pobox.com
Cc: git@vger.kernel.org,
	"Galan Rémi" <remi.galan-alfonso@ensimag.grenoble-inp.fr>,
	"Matthieu Moy" <Matthieu.Moy@imag.fr>
Subject: [PATCH v3 1/2] rebase-i: explicitly accept tab as separator in commands
Date: Thu,  1 Oct 2015 10:18:41 +0200	[thread overview]
Message-ID: <1443687522-14311-1-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <xmqq8u7n7ikl.fsf@gitster.mtv.corp.google.com>

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>
---
This is new in v3.

 git-rebase--interactive.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index f01637b..0d77429 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -729,8 +729,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"
-- 
2.5.0.402.g8854c44

  reply	other threads:[~2015-10-01  8:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30  8:11 [PATCH] rebase: accept indented comments (fixes regression) Matthieu Moy
2015-09-30  9:58 ` Remi Galan Alfonso
2015-09-30 18:05 ` Junio C Hamano
2015-09-30 19:17   ` Matthieu Moy
2015-09-30 19:31     ` Junio C Hamano
2015-09-30 19:18   ` Junio C Hamano
2015-09-30 19:50     ` Matthieu Moy
2015-09-30 20:34       ` Junio C Hamano
2015-10-01  8:18         ` Matthieu Moy [this message]
2015-10-01  8:18           ` [PATCH v3 2/2] rebase-i: loosen over-eager check_bad_cmd check Matthieu Moy
2015-09-30 20:01     ` [PATCH] " Matthieu Moy
2015-09-30 20:04       ` Eric Sunshine
2015-09-30 20:10         ` [PATCH v2] " Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443687522-14311-1-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=remi.galan-alfonso@ensimag.grenoble-inp.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).