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

[PATCH v4 1/3] submodule: clean up subsititions in script

From
Casey Fitzpatrick <kcghost@gmail.com>
Date
May 3, 2018, 10:53 UTC
Message-ID
<20180503105346.1758-2-kcghost@gmail.com>
In-Reply-To
<20180503105346.1758-1-kcghost@gmail.com>

'recommend_shallow' and 'jobs' variables do not need quotes. They only hold a single token value, and even if they were multi-token it is likely we would want them split at IFS rather than pass a single string.

'progress' is a boolean value. Treat it like the other boolean values in the script by using a substitution.

Signed-off-by: Casey Fitzpatrick <kcghost@gmail.com>
---
 git-submodule.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 24914963c..262547968 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -465,7 +465,7 @@ cmd_update()
 			GIT_QUIET=1
 			;;
 		--progress)
-			progress="--progress"
+			progress=1
 			;;
 		-i|--init)
 			init=1
@@ -542,14 +542,14 @@ cmd_update()
 
 	{
 	git submodule--helper update-clone ${GIT_QUIET:+--quiet} \
-		${progress:+"$progress"} \
+		${progress:+"--progress"} \
 		${wt_prefix:+--prefix "$wt_prefix"} \
 		${prefix:+--recursive-prefix "$prefix"} \
 		${update:+--update "$update"} \
 		${reference:+"$reference"} \
 		${depth:+--depth "$depth"} \
-		${recommend_shallow:+"$recommend_shallow"} \
-		${jobs:+$jobs} \
+		$recommend_shallow \
+		$jobs \
 		"$@" || echo "#unmatched" $?
 	} | {
 	err=
-- 
2.17.0.1.ge0414f29c.dirty
Previous: Casey FitzpatrickNext: Casey Fitzpatrick
Message 2 of 5 in “Add --progress and --dissociate to git submodule”
  1. 0/3 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 3, 2018
  2. 1/3 submodule: clean up subsititions in scriptCasey Fitzpatrick, May 3, 2018
  3. 2/3 submodule: add --progress option to add commandCasey Fitzpatrick, May 3, 2018
  4. 3/3 submodule: add --dissociate option to add/update commandsCasey Fitzpatrick, May 3, 2018
  5. Junio C HamanoMay 17, 2018

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.