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

Re: GIT_DIR vs. --git-dir

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Sep 24, 2012, 14:51 UTC
Message-ID
<5060736D.5020609@drmicha.warpmail.net>
In-Reply-To
<7vipb31o9x.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 24.09.2012 16:36:
Show 14 quoted lines
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
> 
>> "~" is a shell feature. Know your shell. If we make an exception for
>> --git-dir, we might have to support --blahblah=~/somewhere.
> 
> Correct but not entirely true.
> 
> When we know --git-dir=<path> must name a path, we should be able to
> do better.  See OPT_FILENAME in >parse-optios.h>, for inspiration.
> 
> MJG's patch later in this thread is conceptually OK but I do not
> think it should introduce a "expand and then setenv" helper that
> won't be useful unless the variable is GIT_DIR.  That pattern does
> not appear that often, and smells like a bad API design taste.

I can't quite parse. My little helper can be used for any path environment variable, not just GIT_DIR. Granted, there aren't that many in use.

Do you suggest tilde expansion right in fix_filename() (i.e. for all OPT_FILE options), or some OPT_FILENAME_EXPANDED which may or may not be used by some config? There's git_config_pathname() already which does expansion, of course.

Michael
Previous: Junio C HamanoNext: Jeff King
Message 14 of 17 in “GIT_DIR vs. --git-dir”
  1. Michael J GruberSep 24, 2012
  2. Nguyen Thai Ngoc DuySep 24, 2012
  3. Michael J GruberSep 24, 2012
  4. Nguyen Thai Ngoc DuySep 24, 2012
  5. Michael J GruberSep 24, 2012
  6. git: expand user path in --git-dirMichael J Gruber, Sep 24, 2012
  7. Jeff KingSep 24, 2012
  8. Michael J GruberSep 24, 2012
  9. Junio C HamanoSep 24, 2012
  10. Jan EngelhardtSep 25, 2012
  11. Michael J GruberSep 25, 2012
  12. Andreas SchwabSep 24, 2012
  13. Junio C HamanoSep 24, 2012
  14. Michael J GruberSep 24, 2012
  15. Jeff KingSep 24, 2012
  16. Michael J GruberSep 24, 2012
  17. Andreas SchwabSep 24, 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.