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

Re: [PATCH] git-submodule add: Record branch name in .gitmodules

From
Jeff King <peff@peff.net>
Date
Oct 26, 2012, 13:37 UTC
Message-ID
<20121026133742.GA10829@sigill.intra.peff.net>
In-Reply-To
<20121025011227.GH801@odin.tremily.us>
On Wed, Oct 24, 2012 at 09:12:27PM -0400, W. Trevor King wrote:
Show 5 quoted lines
> On Wed, Oct 24, 2012 at 02:12:18PM -0400, Phil Hord wrote:
> > +                                       VAR_NAME=$(printf '%s'
> > "$VAR_NAME" | tr A-Z a-z | sed -e 's/^[^a-z]/_/' -e 's/[^a-z0-9]/_/g')
> 
> Is there a reason why you use printf instead of echo?

Sadly, echo is not entirely portable for arbitrary content. We have run into problems with backslashes being interpreted differently (bash requires "echo -e" to interpret them, dash will always do it, and POSIX leaves it vague).

Show 7 quoted lines
> Also, this sort of name cleaning should probably live in a new
> function:
> 
>   clean_environment_variable()
> 
> or some such.  Is there a git-utility-functions.sh library hiding
> somewhere in the source? ;)
git-sh-setup?
-Peff
Previous: W. Trevor King
Message 12 of 12 in “git-submodule add: Record branch name in .gitmodules”
  1. git-submodule add: Record branch name in .gitmodulesW. Trevor King, Oct 22, 2012
  2. NahorOct 23, 2012
  3. W. Trevor KingOct 23, 2012
  4. NahorOct 23, 2012
  5. Jens LehmannOct 23, 2012
  6. W. Trevor KingOct 23, 2012
  7. NahorOct 23, 2012
  8. Jens LehmannOct 24, 2012
  9. W. Trevor KingOct 22, 2012
  10. Phil HordOct 24, 2012
  11. W. Trevor KingOct 25, 2012
  12. Jeff KingOct 26, 2012

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.