From: Michael J Gruber <git@drmicha.warpmail.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [WIP PATCH 0/5] support --exclude for diff/log commands
Date: Wed, 23 Mar 2011 13:51:18 +0100 [thread overview]
Message-ID: <4D89ECC6.7040903@drmicha.warpmail.net> (raw)
In-Reply-To: <AANLkTimeEWOvmNXQV9fJKe23Qe3sipT7q=qHVB2fLq0n@mail.gmail.com>
Nguyen Thai Ngoc Duy venit, vidit, dixit 23.03.2011 13:10:
> On Wed, Mar 23, 2011 at 6:59 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Let's clarify by dumping my understanding of what we aim to achieve.
>>
>> ...
>>
>> Both the ":/<path>" proposal (or your ":<path>" proposal) changes only a
>> very small part of the above, namely, "each prefixed with '<prefix>'" is
>> changed to if the element in original pathspec has the magic colon prefix,
>> the magic is stripped away, and the remainder becomes the element in the
>> resulting pathspec array without additional <prefix> in front.
>
> Correct.
>
>> If Nguyen's proposal is to also match ":/<path>" (or ":<path>") literally,
>> that part should be scrapped. If somebody wants to match such an unusual
>> path component, it can always be expressed by quoting it as a glob,
>> i.e. "[:]/<path>" (or "[:]<path").
>
> OK.
>
>> I am slightly in favor of ":<path>" syntax (than ":/<path>"), but I do not
>> care too deeply. Either has the same problem that it will be confusing
>> with existing and well-established syntax (the former would conflict with
>> "name of the blob in the index", the latter with "name of the commit that
>> match the regexp).
>
> How about ":<path>" for root pathspecs, but reserve ':[^0-9A-Za-z]*'
> for future use?
>
> (on top of Michael's patch)
>
> -- 8< --
> diff --git a/setup.c b/setup.c
> index ef55e5d..1ebe1d2 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -146,8 +146,13 @@ const char **get_pathspec(const char *prefix,
> const char **pathspec)
> while (*src) {
> const char *p;
>
> - if ((*src)[0] == ':')
> + if ((*src)[0] == ':') {
> + const char *reserved = "~`!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?";
> + if (strchr(reserved, (*src)[1]))
> + die("':%c' syntax is not supported. "
> + "Quote it to match literally.", (*src)[1]);
> p = prefix_path(NULL, 0, (*src)+1);
> + }
> else
> p = prefix_path(prefix, prefixlen, *src);
> *(dst++) = p;
> -- 8< --
Sounds good to me so far.
Note that there is also possible notational overlap with the WIP "attr:
make attributes depend on file type" at
http://permalink.gmane.org/gmane.comp.version-control.git/168116
which suggested something like
:symlink:* diff=symlinkdiffdriverofyourchoice
as a notation for attributes which depend on the file type. Is that a
problem, should I do something different there? (Also, I still need help
with that...)
Michael
next prev parent reply other threads:[~2011-03-23 12:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-10 3:13 [WIP PATCH 0/5] support --exclude for diff/log commands Nguyễn Thái Ngọc Duy
2011-03-10 3:13 ` [PATCH 1/5] tree-walk: support negative pathspec Nguyễn Thái Ngọc Duy
2011-03-10 3:13 ` [PATCH 2/5] match_pathspec_depth: " Nguyễn Thái Ngọc Duy
2011-03-10 3:13 ` [PATCH 3/5] revision.c: get rid of struct rev_info.prune_data Nguyễn Thái Ngọc Duy
2011-03-10 6:20 ` Junio C Hamano
2011-03-10 6:52 ` Nguyen Thai Ngoc Duy
2011-03-10 3:13 ` [PATCH 4/5] diff: refactor init/release API Nguyễn Thái Ngọc Duy
2011-03-10 3:13 ` [PATCH 5/5] diff: support --exclude Nguyễn Thái Ngọc Duy
2011-03-10 6:11 ` [WIP PATCH 0/5] support --exclude for diff/log commands Junio C Hamano
2011-03-10 7:03 ` Nguyen Thai Ngoc Duy
2011-03-10 8:41 ` Junio C Hamano
2011-03-10 10:05 ` Nguyen Thai Ngoc Duy
2011-03-21 4:02 ` Nguyen Thai Ngoc Duy
2011-03-21 9:45 ` Michael J Gruber
2011-03-21 10:02 ` Nguyen Thai Ngoc Duy
2011-03-22 23:59 ` Junio C Hamano
2011-03-23 12:10 ` Nguyen Thai Ngoc Duy
2011-03-23 12:18 ` Nguyen Thai Ngoc Duy
2011-03-23 12:51 ` Michael J Gruber [this message]
2011-03-23 13:34 ` Nguyen Thai Ngoc Duy
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=4D89ECC6.7040903@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@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.
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 NNTP newsgroup(s).