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

Re: What's cooking in git.git (Oct 2013, #02; Mon, 14)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 15, 2013, 19:16 UTC
Message-ID
<20131015191656.GD9464@google.com>
In-Reply-To
<xmqqiowye66r.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
Show 9 quoted lines
> I'll try:
>
>  - slurping your integration branches,
>  - teasing the topics apart out of your 'pu',
>  - populating my rerere database to match your confict resolution,
>  - reconstructing the Meta/Reintegrate insn for 'pu', and
>  - rebuilding 'pu' to make sure the end result matches yours
>
> and then push the result out to the usual places
Sounds good.  The teased-apart topics can also be found at
    https://github.com/jrn/git
[...]
Show 9 quoted lines
>>  This patch preserves the old "just pass it to the shell" behavior
>>  when a single argument is passed to 'git submodule foreach' and
>>  moves to a new "skip the shell and use the arguments passed
>>  unmolested" behavior when more than one argument is passed.
>
> When scripts give 'echo' and '$path' (two args), does this change
> allow the 'echo' command to see the value of $path (coming from
> $sm_path), or just the not-useful-because-not-exported variable name
> '$path'?

The latter. A quick search (web search + codesearch.debian.net) reveals that most callers to submodule foreach either pass a script as a single quoted argument (e.g., http://stackoverflow.com/questions/8364738/bash-git-submodule-foreach:

	git submodule foreach '[ "$path" = "Libraries/JSONKit" ] \
	  && branch=experimental \
	  || branch=master; git co $branch'
or http://sources.debian.net/src/jquery/1.7.2+dfsg-3/Makefile?hl=131#L131:
	git submodule foreach "git pull \$(git config remote.origin.url)"

) or pass a one-off command with no arguments intended for the shell (e.g., http://sources.debian.net/src/libreoffice/1:4.1.1-1/g?hl=352#L352, http://sources.debian.net/src/swi-prolog/6.4.1-3/scripts/newversion?hl=81#L81):

	git submodule foreach git push "$@"
	git submodule foreach git tag -s -f -F $tmp  $gittag

So I suspect this will fix more scripts than it breaks, though it may still break some. :/

It might make sense to warn when passed multiple arguments and some include shell metacharacters, since that's probably rare, too, except it's punishing people who use multiple arguments as a way to avoid quoting issues. Probably there's no replacement for just advertising the change loudly and seeking out scripts it could break.

Thanks, Jonathan

Previous: Junio C HamanoNext: Jens Lehmann
Message 5 of 9 in “What's cooking in git.git (Oct 2013, #01; Mon, 14)”
  1. Jonathan NiederOct 14, 2013
  2. What's cooking in git.git (Oct 2013, #02; Mon, 14)Jonathan Nieder, Oct 15, 2013
  3. Ramkumar RamachandraOct 15, 2013
  4. Junio C HamanoOct 15, 2013
  5. Jonathan NiederOct 15, 2013
  6. Jens LehmannOct 15, 2013
  7. Jonathan NiederOct 15, 2013
  8. Jens LehmannOct 16, 2013
  9. Jens LehmannOct 15, 2013

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.