Re: [PATCH v3] config: add conditional include
- From
Jeff King <peff@peff.net>
- Date
- Jul 13, 2016, 07:26 UTC
- Message-ID
- <20160713072607.GA15153@sigill.intra.peff.net>
- In-Reply-To
- <vpqa8hmroji.fsf@anie.imag.fr>
On Wed, Jul 13, 2016 at 09:21:37AM +0200, Matthieu Moy wrote:
Show 14 quoted lines
> > +static int prepare_include_condition_pattern(struct strbuf *pat)
> > +{
> > + int prefix = 0;
> > +
> > + /* TODO: maybe support ~user/ too */
> > + if (pat->buf[0] == '~' && is_dir_sep(pat->buf[1])) {
> > + struct strbuf path = STRBUF_INIT;
> > + const char *home = getenv("HOME");
> > +
> > + if (!home)
> > + return error(_("$HOME is not defined"));
>
> expand_user_path in path.c seems to do the same as you're doing (but
> does deal with ~user). Any reason not to use it?I had a similar question, which Duy answered in:
http://article.gmane.org/gmane.comp.version-control.git/298528
It does feel pretty hacky, though (especially for a case that seems unlikely to come up: people having wildcard patterns in the name of their home directory).
-Peff