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

Re: [PATCH] rebase -p: avoid grep on potentailly non-ASCII data

From
Torsten Bögershausen <tboegi@web.de>
Date
Mar 8, 2016, 12:25 UTC
Message-ID
<56DEC4B4.2000902@web.de>
In-Reply-To
<alpine.DEB.2.10.1603080255030.2674@buzzword-bingo.mit.edu>
On 03/08/2016 08:59 AM, Anders Kaseorg wrote:
Show 43 quoted lines
> The included test case, which uses rebase -p with non-ASCII commit
> messages, was failing as follows:
>
>    Warning: the command isn't recognized in the following line:
>     - Binary file (standard input) matches
>
>    You can fix this with 'git rebase --edit-todo'.
>    Or you can abort the rebase with 'git rebase --abort'.
>
> Possibly related to recent GNU grep changes, as with commit
> 316336379cf7937c2ecf122c7197cfe5da6b2061.  Avoid the issue by using sed
> instead.
>
> Signed-off-by: Anders Kaseorg <andersk@mit.edu>
> ---
>   git-rebase--interactive.sh        |  2 +-
>   t/t3409-rebase-preserve-merges.sh | 21 +++++++++++++++++++++
>   2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index c0cfe88..0efc65c 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -1241,7 +1241,7 @@ then
>   			# be rebasing on top of it
>   			git rev-list --parents -1 $rev | cut -d' ' -s -f2 > "$dropped"/$rev
>   			sha1=$(git rev-list -1 $rev)
> -			sane_grep -v "^[a-z][a-z]* $sha1" <"$todo" > "${todo}2" ; mv "${todo}2" "$todo"
> +			sed "/^[a-z][a-z]* $sha1/d" <"$todo" > "${todo}2" ; mv "${todo}2" "$todo"
>   			rm "$rewritten"/$rev
>   		fi
>   	done
> diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
> index 8c251c5..1f01b29 100755
> --- a/t/t3409-rebase-preserve-merges.sh
> +++ b/t/t3409-rebase-preserve-merges.sh
> @@ -119,4 +119,25 @@ test_expect_success 'rebase -p ignores merge.log config' '
>   	)
>   '
>   
> +test_expect_success 'rebase -p works with non-ASCII commit message' '
> +	(
> +	mkdir non-ascii &&

#The cd should be done in a subshell: (

Show 6 quoted lines
> +	cd non-ascii &&
> +	git init &&
> +	echo a > a &&
> +	git add a &&
> +	git commit -m a &&
> +	echo b > b &&
#Style: No space after ">" (and even above and below)
echo b >b
Show 11 quoted lines
> +	git add b &&
> +	git commit -m b &&
> +	git branch foo &&
> +	git reset --hard HEAD^ &&
> +	git cherry-pick -x foo &&
> +	echo c > c &&
> +	git add c &&
> +	git commit -m "$(printf "I \\342\\231\\245 Unicode")" &&
> +	git rebase -p foo
> +	)
> +

#end of subshell )

> '
> +
>   test_done
Previous: Anders KaseorgNext: Michael J Gruber
Message 2 of 12 in “rebase -p: avoid grep on potentailly non-ASCII data”
  1. rebase -p: avoid grep on potentailly non-ASCII dataAnders Kaseorg, Mar 8, 2016
  2. Torsten BögershausenMar 8, 2016
  3. Michael J GruberMar 8, 2016
  4. Jeff KingMar 8, 2016
  5. Junio C HamanoMar 8, 2016
  6. Junio C HamanoMar 8, 2016
  7. Jeff KingMar 9, 2016
  8. Jeff KingMar 9, 2016
  9. Anders KaseorgMar 9, 2016
  10. Junio C HamanoMar 9, 2016
  11. Torsten BögershausenMar 10, 2016
  12. Junio C HamanoMar 10, 2016

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.