From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [RFC/PATCH] git: expand user path in --git-dir
Date: Mon, 24 Sep 2012 16:57:59 +0200 [thread overview]
Message-ID: <506074F7.2000500@drmicha.warpmail.net> (raw)
In-Reply-To: <20120924145208.GB10349@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 24.09.2012 16:52:
> On Mon, Sep 24, 2012 at 02:57:20PM +0200, Michael J Gruber wrote:
>
>> Currently, all paths in the config file are subject to tilde expansion
>> for user paths while the argument to --git-dir is not expanded, and
>> neither are paths in the environment such as GIT_DIR. From the user
>> perspective, though, the two commands
>>
>> GIT_DIR=~user/foo git command
>> git --git-dir=~user/foo command
>>
>> currently behave differently because in the first case the shell would
>> perform tilde expansion, but not in the second. Also, one may argue that
>> specifying '--git-dir=' is like specifying a config variable (which
>> cannot exist for this purpose).
>>
>> Thus, make arguments to '--git-dir' undergo tilde expansion.
>> ---
>> So, here's a simple patch implementing tilde expansion for --git-dir. It passes
>> all tests. It's done doing the expansion on the setting side.
>>
>> Alternatively, one might do it on the getting side, i.e. when reading GIT_DIR,
>> so that paths passed directly through the environment undergo tilde expansion
>> as well. We don't do this for any environment variable yet, so I didn't go
>> that far.
>
> Keep in mind that every layer of expansion you add is a layer of quoting
> somebody else must do in order to pass through certain paths. I will
> admit that putting a "~" into a path is relatively uncommon, but this
> patch is a regression for anybody who does so with --git-dir (they will
> now need to quote the "~" against not just their shell, but against
> git). Expanding environment variables like GIT_DIR means that we would
> also need to quote things we put into GIT_DIR.
...as far as "~" is concerned, yes. We don't do a full expansion like
the shell does (or doesn't).
Probably "--git-dir" is hidden well enough to be for the initiated only.
As for the other path options, we can always blame bash. It's got its
name for a reason ;)
Michael
next prev parent reply other threads:[~2012-09-24 14:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 7:19 GIT_DIR vs. --git-dir Michael J Gruber
2012-09-24 7:41 ` Nguyen Thai Ngoc Duy
2012-09-24 7:57 ` Michael J Gruber
2012-09-24 9:53 ` Nguyen Thai Ngoc Duy
2012-09-24 12:56 ` Michael J Gruber
2012-09-24 12:57 ` [RFC/PATCH] git: expand user path in --git-dir Michael J Gruber
2012-09-24 14:52 ` Jeff King
2012-09-24 14:57 ` Michael J Gruber [this message]
2012-09-24 17:30 ` Junio C Hamano
2012-09-25 5:33 ` Jan Engelhardt
2012-09-25 7:27 ` Michael J Gruber
2012-09-24 13:37 ` GIT_DIR vs. --git-dir Andreas Schwab
2012-09-24 14:36 ` Junio C Hamano
2012-09-24 14:51 ` Michael J Gruber
2012-09-24 14:49 ` Jeff King
2012-09-24 14:54 ` Michael J Gruber
2012-09-24 15:42 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=506074F7.2000500@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.