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

Re: [PATCH] Support environment variables in config file

From
Martin Waitz <tali@admingilde.org>
Date
Jun 4, 2007, 07:27 UTC
Message-ID
<20070604072707.GE16637@admingilde.org>
In-Reply-To
<20070604053443.GA15148@moooo.ath.cx>
hoi :)
thanks for the review!

Do you think the approach is ok? Can you see other examples where we may need $VAR support? Or would everybody be happy with support for ~/ in filenames?

On Mon, Jun 04, 2007 at 07:34:43AM +0200, Matthias Lederhofer wrote:
Show 8 quoted lines
> Martin Waitz <tali@admingilde.org> wrote:
> > Environment variables (e.g. $HOME) can be helpful for the GIT configuration.
> > With this change you can use them with the normal shell "$" syntax.
> > If you want to insert a plain "$" in a variable, it can be escaped as \$
> > or put inside quotes (").
> 
> Perhaps we should also allow variable interpolation in double quoted
> strings as this is quite common in various languages.

I thought about that too. I guess I first will have to do a patch which adds single quote (') support.

> We could have a short example here how to concatenate a variable and a
> string without a space in between.  I came up with '$FOO""bar' which
> is not that obvious imo.

yes, shell-like ${FOO} would be nicer but I don't know if it is that important. Perhaps your example $FOO"bar".

> You should allow at least underscores in environment variables too.
right
> If you use the HOME environment variable without setting it yourself
> you should place quotes around the $(..) in case there is a space in
> $HOME:
stupid error, yes.
-- 
Martin Waitz
Previous: Matthias LederhoferNext: Matthias Lederhofer
Message 3 of 7 in “Support environment variables in config file”
  1. Support environment variables in config fileMartin Waitz, Jun 3, 2007
  2. Matthias LederhoferJun 4, 2007
  3. Martin WaitzJun 4, 2007
  4. Matthias LederhoferJun 4, 2007
  5. Johannes SchindelinJun 4, 2007
  6. Martin WaitzJun 4, 2007
  7. Johannes SchindelinJun 4, 2007

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.