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

Re: [PATCH v2] builtin-blame: Reencode commit messages according to git-log rules.

From
Jeff King <peff@peff.net>
Date
Oct 22, 2008, 19:22 UTC
Message-ID
<20081022192253.GC31568@coredump.intra.peff.net>
In-Reply-To
<20081022191415.GA31568@coredump.intra.peff.net>
On Wed, Oct 22, 2008 at 03:14:16PM -0400, Jeff King wrote:
Show 6 quoted lines
> > git-submodule.sh uses grep "-e" to look for two patterns and I suspect
> > older Solaris would have the same issue.
> 
> Yes, that code will break on Solaris. Most of my portability fixes have
> been in direct response to tests, so I guess we are not testing
> git-submodule very well.

And here's a patch. Though I believe this is the last "grep -e", I wonder if it wouldn't have been wiser to simply force people on such platforms to use GNU grep (I already have to use GNU tools to build, and bash to run the scripts).

-- >8 -- submodule: fix some non-portable grep invocations

Not all greps support "-e", but in this case we can easily convert it to a single extended regex.

Signed-off-by: Jeff King <peff@peff.net>
---
Passes the test scripts, but I'm not sure they are exercising this code,
anyway, since it passed on Solaris. Please double-check my conversion.
 git-submodule.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 65178ae..b63e5c3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -424,7 +424,7 @@ cmd_summary() {
 	cd_to_toplevel
 	# Get modified modules cared by user
 	modules=$(git diff-index $cached --raw $head -- "$@" |
-		grep -e '^:160000' -e '^:[0-7]* 160000' |
+		egrep '^:([0-7]* )?160000' |
 		while read mod_src mod_dst sha1_src sha1_dst status name
 		do
 			# Always show modules deleted or type-changed (blob<->module)
@@ -438,7 +438,7 @@ cmd_summary() {
 	test -z "$modules" && return
 
 	git diff-index $cached --raw $head -- $modules |
-	grep -e '^:160000' -e '^:[0-7]* 160000' |
+	egrep '^:([0-7]* )?160000' |
 	cut -c2- |
 	while read mod_src mod_dst sha1_src sha1_dst status name
 	do
-- 
1.6.0.2.825.g6d19d
Previous: Jeff KingNext: Johannes Schindelin
Message 9 of 13 in “builtin-blame: Reencode commit messages according to git-log rules.”
  1. builtin-blame: Reencode commit messages according to git-log rules.Alexander Gavrilov, Oct 21, 2008
  2. Jeff KingOct 22, 2008
  3. Alexander GavrilovOct 22, 2008
  4. Jeff KingOct 22, 2008
  5. Alexander GavrilovOct 22, 2008
  6. Jeff KingOct 22, 2008
  7. Junio C HamanoOct 22, 2008
  8. Jeff KingOct 22, 2008
  9. Jeff KingOct 22, 2008
  10. Johannes SchindelinOct 22, 2008
  11. Jeff KingOct 22, 2008
  12. Jakub NarebskiOct 22, 2008
  13. Jeff KingOct 22, 2008

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.