Re: [PATCH 2/4] add -u: get rid of "treewideupdate" configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]