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

[PATCH] Minor portability patch to git-submodule

From
ADAndy Dougherty <doughera@lafayette.edu>
Date
Dec 17, 2007, 21:41 UTC
Message-ID
<Pine.LNX.4.64.0712171639420.24957@fractal.phys.lafayette.edu>

While trying git out on Solaris 8, I needed the following patch. The 'grep' command on Solaris doesn't understand the -e option, though egrep does.

More mysterious is the printf patch. Without it, the sed command didn't match anything.

--- git-1.5.4.rc0/git-submodule.sh Wed Dec 12 21:29:16 2007 +++ git-andy/git-submodule.sh Mon Dec 17 14:30:46 2007

@@ -74,7 +74,7 @@
 module_name()
 {
 	# Do we have "submodule.<something>.path = $1" defined in .gitmodules file?
-	re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
+	re=$(printf '%s\n' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
 	name=$( GIT_CONFIG=.gitmodules \
 		git config --get-regexp '^submodule\..*\.path$' |
 		sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
@@ -176,7 +176,7 @@
 #
 modules_init()
 {
-	git ls-files --stage -- "$@" | grep -e '^160000 ' |
+	git ls-files --stage -- "$@" | egrep -e '^160000 ' |
 	while read mode sha1 stage path
 	do
 		# Skip already registered paths
@@ -209,7 +209,7 @@
 #
 modules_update()
 {
-	git ls-files --stage -- "$@" | grep -e '^160000 ' |
+	git ls-files --stage -- "$@" | egrep -e '^160000 ' |
 	while read mode sha1 stage path
 	do
 		name=$(module_name "$path") || exit
@@ -268,7 +268,7 @@
 #
 modules_list()
 {
-	git ls-files --stage -- "$@" | grep -e '^160000 ' |
+	git ls-files --stage -- "$@" | egrep -e '^160000 ' |
 	while read mode sha1 stage path
 	do
 		name=$(module_name "$path") || exit
-- 
    Andy Dougherty		doughera@lafayette.edu
Next: Johannes Schindelin
Message 1 of 4 in “Minor portability patch to git-submodule”
  1. Minor portability patch to git-submoduleAndy Dougherty, Dec 17, 2007
  2. Johannes SchindelinDec 17, 2007
  3. Andy DoughertyDec 18, 2007
  4. Johannes SchindelinDec 18, 2007

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.