git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 1/2] rebase-i: explicitly accept tab as separator in commands

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Oct 1, 2015, 08:18 UTC
Message-ID
<1443687522-14311-1-git-send-email-Matthieu.Moy@imag.fr>
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
Previous: Junio C HamanoNext: Matthieu Moy
Message 9 of 13 in “rebase: accept indented comments (fixes regression)”
  1. rebase: accept indented comments (fixes regression)Matthieu Moy, Sep 30, 2015
  2. Remi Galan AlfonsoSep 30, 2015
  3. Junio C HamanoSep 30, 2015
  4. Matthieu MoySep 30, 2015
  5. Junio C HamanoSep 30, 2015
  6. Junio C HamanoSep 30, 2015
  7. Matthieu MoySep 30, 2015
  8. Junio C HamanoSep 30, 2015
  9. 1/2 rebase-i: explicitly accept tab as separator in commandsMatthieu Moy, Oct 1, 2015
  10. 2/2 rebase-i: loosen over-eager check_bad_cmd checkMatthieu Moy, Oct 1, 2015
  11. rebase-i: loosen over-eager check_bad_cmd checkMatthieu Moy, Sep 30, 2015
  12. Eric SunshineSep 30, 2015
  13. rebase-i: loosen over-eager check_bad_cmd checkMatthieu Moy, Sep 30, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.