From: Nguyen Thai Ngoc Duy Date: Sat, 09 Apr 2011 04:38:24 GMT Subject: Re: [PATCH 2/4] add -u: get rid of "treewideupdate" configuration Message-ID: <20110409043824.GA22543@do> In-Reply-To: <7vaag01gdl.fsf@alter.siamese.dyndns.org> On Fri, Apr 08, 2011 at 04:18:46PM -0700, Junio C Hamano wrote: > It appears that we might want to further tweak the code that tries to > disambiguate between revs and paths (we error out when argv[i] does not > name a rev and lstat(argv[i]) fails) Something like below? The additional goodness is, instead of writing git grep foo -- '*.a' I can now write a shorter version git grep foo :./*.a Perhaps we can use the first pathspec with magic as a mark of pathspec arguments, equivalent to "--" --8<-- diff --git a/setup.c b/setup.c index 03cd84f..a00a23f 100644 --- a/setup.c +++ b/setup.c @@ -73,6 +73,8 @@ int check_filename(const char *prefix, const char *arg) const char *name; struct stat st; + if (*arg == ':') /* pathspec magic */ + return 1; name = prefix ? prefix_filename(prefix, strlen(prefix), arg) : arg; if (!lstat(name, &st)) return 1; /* file exists */ --8<-- -- Duy