On Wed, Mar 23, 2011 at 6:59 AM, Junio C Hamano <gitster@xxxxxxxxx> 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< -- -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html