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

Re: [PATCH/RFC] Hacky version of a glob() driven config include

From
Jeff King <peff@peff.net>
Date
May 8, 2010, 05:06 UTC
Message-ID
<20100508050632.GE14998@coredump.intra.peff.net>
In-Reply-To
<1273180440-8641-1-git-send-email-avarab@gmail.com>
On Thu, May 06, 2010 at 09:14:00PM +0000, Ævar Arnfjörð Bjarmason wrote:
> This is not ready for inclusion in anything. Commiting for RFC on
> whether this way of doing it is sane in theory.
I think the goal of having globbing include files is reasonable.
>   * It relies on the GNU GLOB_TILDE extension with no
>     alternative. That can be done by calling getenv("HOME") and
>     s/~/$home/.

We already have expand_user_path which handles ~ properly (it is used for the values of some config entries). You could then glob the result.

Show 6 quoted lines
> +cat > .git/config << EOF
> +[some]
> +	variable = blah
> +[voodoo]
> +	include = .git/more_config_*
> +EOF
My eyes! The goggles do nothing!

That syntax is horrid. Wouldn't it be much simpler to introduce some top-level syntax for "include this file here", with some very simple semantics:

  - the included file starts with no section. It should have its own
    section header.
  - after returning from the included file, we are in no section. You
    need a new section header.

Yes, there are some complex tricks those semantics won't allow, but they are simple to read and understand, simple to use, and simple to implement.

And really, what is the point in supporting crap like:
   $ cat .gitconfig
   [diff]
   #include foo
   $ cat foo
   rename = true
-Peff
Previous: Ping Yin
Message 21 of 21 in “Is there interest in reading ~/.gitconfig.d/* and /etc/gitconfig.d/*?”
  1. Ævar Arnfjörð BjarmasonApr 1, 2010
  2. Heiko VoigtApr 1, 2010
  3. Peter KreftingApr 4, 2010
  4. Eli BarzilayApr 4, 2010
  5. Ævar Arnfjörð BjarmasonApr 6, 2010
  6. Jakub NarebskiApr 6, 2010
  7. Hacky version of a glob() driven config includeÆvar Arnfjörð Bjarmason, May 6, 2010
  8. Bert WesargMay 7, 2010
  9. Ævar Arnfjörð BjarmasonMay 7, 2010
  10. Bert WesargMay 7, 2010
  11. Ævar Arnfjörð BjarmasonMay 7, 2010
  12. Jacob HelwigMay 7, 2010
  13. Bert WesargMay 7, 2010
  14. Hacky version of a glob() driven config includeÆvar Arnfjörð Bjarmason, May 7, 2010
  15. Jakub NarebskiMay 7, 2010
  16. Ævar Arnfjörð BjarmasonMay 7, 2010
  17. Jakub NarebskiMay 7, 2010
  18. Ping YinMay 8, 2010
  19. Jakub NarebskiMay 8, 2010
  20. Ping YinMay 8, 2010
  21. Jeff KingMay 8, 2010

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.