From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Sebastian Schuberth <sschuberth@gmail.com>, git@vger.kernel.org
Subject: Re: [RFC] ident: support per-path configs by matching the path against a pattern
Date: Fri, 10 Jul 2015 13:23:07 -0700 [thread overview]
Message-ID: <xmqqtwtbkbis.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150710164652.GA30113@peff.net> (Jeff King's message of "Fri, 10 Jul 2015 12:46:52 -0400")
Jeff King <peff@peff.net> writes:
> Here's a sketch if anybody is inclined to pick it up and run with it.
> Note that I did not think too hard about little things like the
> de-anchoring.
> ...
> int git_config_include(const char *var, const char *value, void *data)
> {
> struct config_include_data *inc = data;
> + const char *cond, *key;
> + int cond_len;
> int ret;
>
> /*
> @@ -152,8 +188,12 @@ int git_config_include(const char *var, const char *value, void *data)
> if (ret < 0)
> return ret;
>
> - if (!strcmp(var, "include.path"))
> - ret = handle_path_include(value, inc);
> + if (!parse_config_key(var, "include", &cond, &cond_len, &key) &&
> + include_condition_is_true(cond, cond_len)) {
I really like these two lines.
Whoever designed that parse_config_key() interface either is a
genious or had a foresight with a crystal ball, or perhaps both.
> + if (!strcmp(key, "path"))
> + ret = handle_path_include(value, inc);
> + /* else we do not know about this type of include; ignore */
> + }
> return ret;
> }
>
next prev parent reply other threads:[~2015-07-10 20:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 9:36 [RFC] ident: support per-path configs by matching the path against a pattern Sebastian Schuberth
2015-07-10 15:10 ` Junio C Hamano
2015-07-10 15:43 ` Jeff King
2015-07-10 16:46 ` Jeff King
2015-07-10 20:23 ` Junio C Hamano [this message]
2015-07-10 20:58 ` Jeff King
2015-07-10 21:07 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtwtbkbis.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=sschuberth@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).