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

Re: General support for ! in git-config values

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 1, 2012, 21:25 UTC
Message-ID
<CACBZZX5mX55Rh8b2GYv7wKbCCypCkrn5AiM9BpXydgcYxHWdQA@mail.gmail.com>
In-Reply-To
<20120201184020.GA29374@sigill.intra.peff.net>
On Wed, Feb 1, 2012 at 19:40, Jeff King <peff@peff.net> wrote:
Show 36 quoted lines
> On Wed, Feb 01, 2012 at 06:33:47PM +0100, Ævar Arnfjörð Bjarmason wrote:
>
>> For a program I'm working on (git-deploy) I'd like to have this as a
>> general facility, i.e. users can specify either:
>>
>>     foo.bar = value
>>
>> Or:
>>
>>     foo.bar = !cat /some/path
>>
>> I'm wondering why git-config doesn't do this already, if there's no
>> reason in particular I can just patch it in, either as a new option:
>>
>>     git config --with-exec --get foo.bar
>
> I'm not clear on what you want --with-exec to do. By default, config
> values are strings. I would expect the "!" to be a special marker that
> the caller would recognize in the string, and then act appropriately.
>
> So if I were implementing git aliases in the shell, the code would look
> like:
>
>  v=$(git config alias.$alias)
>  case "$v" in
>  "")
>          die "no such alias: $alias" ;;
>  "!*)
>          cmd="${v#!}" ;;
>  *)
>          cmd="git $v" ;;
>  esac
>  eval "$cmd"
>
> I.e., everything pertaining to "!" happens after we get the config
> string. So what is it that you want "git config --with-exec" to do?

I agree that that's how it should work, I just suggested --with-exec in case anyone complained about the backwards compatibility issue of changing the meaning of "!" for existing configs.

Previous: Jeff KingNext: Junio C Hamano
Message 3 of 20 in “General support for ! in git-config values”
  1. Ævar Arnfjörð BjarmasonFeb 1, 2012
  2. Jeff KingFeb 1, 2012
  3. Ævar Arnfjörð BjarmasonFeb 1, 2012
  4. Junio C HamanoFeb 1, 2012
  5. demerphqFeb 2, 2012
  6. Junio C HamanoFeb 2, 2012
  7. demerphqFeb 2, 2012
  8. Junio C HamanoFeb 2, 2012
  9. demerphqFeb 2, 2012
  10. Jeff KingFeb 2, 2012
  11. demerphqFeb 2, 2012
  12. Jeff KingFeb 2, 2012
  13. demerphqFeb 2, 2012
  14. Kyle MoffettFeb 3, 2012
  15. Junio C HamanoFeb 3, 2012
  16. Kyle MoffettFeb 3, 2012
  17. Jeff KingFeb 3, 2012
  18. Jeff KingFeb 3, 2012
  19. Junio C HamanoFeb 2, 2012
  20. demerphqFeb 2, 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.