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

Re: [PATCH v2] git: submodule honor -c credential.* from command line

From
Jeff King <peff@peff.net>
Date
Feb 25, 2016, 01:45 UTC
Message-ID
<20160225014507.GB31616@sigill.intra.peff.net>
In-Reply-To
<CAPig+cROoc+Y-V_6hw6Hx4X9pFGmRjfhpzYGKhswwa=bA5b=+g@mail.gmail.com>
On Wed, Feb 24, 2016 at 07:27:23PM -0500, Eric Sunshine wrote:
Show 11 quoted lines
> > diff --git a/git-submodule.sh b/git-submodule.sh
> > @@ -192,6 +192,16 @@ isnumber()
> > +# Sanitize the local git environment for use within a submodule. We
> > +# can't simply use clear_local_git_env since we want to preserve some
> > +# of the settings from GIT_CONFIG_PARAMETERS.
> > +sanitize_local_git_env()
> > +{
> > +       local sanitized_config = $(git submodule--helper sanitize-config)
> 
> Is 'local' a bashism? (Although, I see that 'local' is already being
> used in relative_path(); perhaps that ought to be cleaned up.)

It seems to have spread to Almquist shells like dash, but it's definitely not in POSIX. That covers _most_ platforms these days, but I'd guess would break on older ksh. We should probably avoid it.

For the curious, there's a very thorough discussion in the first answer here:

  http://stackoverflow.com/questions/18597697/posix-compliant-way-to-scope-variables-to-a-function-in-a-shell-script

In this case, we know that we're doing the sanitizing in a subshell, so I think just dropping "local" and clobbering the existing $sanitized_config is fine.

-Peff
Previous: Eric SunshineNext: Jacob Keller
Message 3 of 14 in “git: submodule honor -c credential.* from command line”
  1. git: submodule honor -c credential.* from command lineJacob Keller, Feb 24, 2016
  2. Eric SunshineFeb 25, 2016
  3. Jeff KingFeb 25, 2016
  4. Jacob KellerFeb 25, 2016
  5. Jeff KingFeb 25, 2016
  6. Jacob KellerFeb 25, 2016
  7. Jeff KingFeb 25, 2016
  8. Jacob KellerFeb 25, 2016
  9. Jeff KingFeb 25, 2016
  10. Jeff KingFeb 25, 2016
  11. Jacob KellerFeb 25, 2016
  12. Jacob KellerFeb 25, 2016
  13. Junio C HamanoFeb 25, 2016
  14. Jacob KellerFeb 25, 2016

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.