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
Junio C Hamano <gitster@pobox.com>
Date
Mar 8, 2016, 23:36 UTC
Message-ID
<xmqqegbkk0ed.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqio0wk151.fsf@gitster.mtv.corp.google.com>
Subject: rebase-i: clarify "is this commit relevant" test

While I was checking all the call sites of sane_grep and sane_egrep, I noticed this one is somewhat strangely written. The lines in the file sane_grep works on all begin with 40-hex object name, so there is no real risk of confusing "test $(...) = ''" by finding something that begins with a dash, but using the status from sane_grep makes it a lot clearer what is going on.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * By the way, if we are going to take that @@SANE_TEXT_GREP@@
   patch, we'd need to add $(SANE_TEXT_GREP) to SCRIPT_DEFINES
   in Makefile to force git-sh-setup to be regenerated when its
   setting changes.
 git-rebase--interactive.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c0cfe88..4cde685 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1233,7 +1233,8 @@ then
 	git rev-list $revisions |
 	while read rev
 	do
-		if test -f "$rewritten"/$rev && test "$(sane_grep "$rev" "$state_dir"/not-cherry-picks)" = ""
+		if test -f "$rewritten"/$rev &&
+		   ! sane_grep "$rev" "$state_dir"/not-cherry-picks >/dev/null
 		then
 			# Use -f2 because if rev-list is telling us this commit is
 			# not worthwhile, we don't want to track its multiple heads,
Previous: Junio C HamanoNext: Jeff King
Message 6 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.