Subject: Re: GIT_DIR vs. --git-dir

From: Michael J Gruber <[email-masked]>
Date: Mon, 24 Sep 2012 16:51:25 +0200

Junio C Hamano venit, vidit, dixit 24.09.2012 16:36:
> Nguyen Thai Ngoc Duy <[email-masked]> 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