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

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 2, 2018, 05:59 UTC
Message-ID
<xmqqy3h2vbqj.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180502005528.19740-2-kcghost@gmail.com>
Casey Fitzpatrick <kcghost@gmail.com> writes:
> 'recommend_shallow' and 'jobs' variables do not need quotes (they never contain
> spaces) and do not require any additional prefix, therefore remove the
> unnecessary subsitition.

The resulting patch is good, but "they never contain spaces" is not a very good rationale. The real reason is that (1) we use them only to hold a single token value (or leave them empty) in the current code, and (2) if the feature they represent is enhanced in the future to make them multi-token options (e.g. we may allow $jobs to contain, in addition to "--jobs=2", "--jobs 2" for whatever reason later), it is likely that we would want these multi-tokens split at $IFS (e.g. "--jobs" and "2" get passed as separate option, not a single "--jobs 2" string).

> 'progress' is a boolean value. Treat it like the other boolean values in the
> script by using a substitution.
This is OK.
Show 12 quoted lines
>  	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 \
Previous: Casey FitzpatrickNext: Casey Fitzpatrick
Message 23 of 29 in “git-submodule is missing --dissociate option”
  1. Casey FitzpatrickApr 30, 2018
  2. Casey FitzpatrickApr 30, 2018
  3. Ævar Arnfjörð BjarmasonApr 30, 2018
  4. Junio C HamanoMay 2, 2018
  5. Stefan BellerApr 30, 2018
  6. Casey FitzpatrickApr 30, 2018
  7. 0/2 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 1, 2018
  8. 1/2 submodule: Add --progress option to add commandCasey Fitzpatrick, May 1, 2018
  9. Stefan BellerMay 1, 2018
  10. Casey FitzpatrickMay 1, 2018
  11. 2/2 submodule: Add --dissociate option to add/update commandsCasey Fitzpatrick, May 1, 2018
  12. Stefan BellerMay 1, 2018
  13. Eric SunshineMay 1, 2018
  14. Casey FitzpatrickMay 1, 2018
  15. Stefan BellerMay 1, 2018
  16. 0/3 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 2, 2018
  17. 1/3 submodule: clean up subsititions in scriptCasey Fitzpatrick, May 2, 2018
  18. 2/3 submodule: add --progress option to add commandCasey Fitzpatrick, May 2, 2018
  19. 3/3 submodule: add --dissociate option to add/update commandsCasey Fitzpatrick, May 2, 2018
  20. Casey FitzpatrickMay 2, 2018
  21. 0/3 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 2, 2018
  22. 1/3 submodule: clean up subsititions in scriptCasey Fitzpatrick, May 2, 2018
  23. Junio C HamanoMay 2, 2018
  24. Casey FitzpatrickMay 3, 2018
  25. 2/3 submodule: add --progress option to add commandCasey Fitzpatrick, May 2, 2018
  26. 3/3 submodule: add --dissociate option to add/update commandsCasey Fitzpatrick, May 2, 2018
  27. Junio C HamanoMay 2, 2018
  28. Casey FitzpatrickMay 2, 2018
  29. Junio C HamanoMay 2, 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.