From 42471bcee44e87669eb17f9fa13c8041a0fc35a1 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 26 May 2017 15:08:39 -0400 Subject: check_filename(): handle ":^" path magic We special-case "git log :/foo" to work when "foo" exists in the working tree. But :^ (and its alias :!) do not get the same treatment, requiring the user to supply a disambiguating "--". Let's make them work without requiring the user to type the "--". Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- setup.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'setup.c') diff --git a/setup.c b/setup.c index f2a8070bd..86bb7c9a9 100644 --- a/setup.c +++ b/setup.c @@ -141,6 +141,10 @@ int check_filename(const char *prefix, const char *arg) if (!*arg) /* ":/" is root dir, always exists */ return 1; prefix = NULL; + } else if (skip_prefix(arg, ":!", &arg) || + skip_prefix(arg, ":^", &arg)) { + if (!*arg) /* excluding everything is silly, but allowed */ + return 1; } if (prefix) -- cgit v1.2.1