aboutsummaryrefslogtreecommitdiffstats
path: root/setup.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-05-26 15:08:39 -0400
committerJunio C Hamano <gitster@pobox.com>2017-05-29 11:36:56 +0900
commit42471bcee44e87669eb17f9fa13c8041a0fc35a1 (patch)
tree3196bc85d53e27c7c66fea8f5ab85db54fcfdd1f /setup.c
parentd51c6ee0d4bbeaf28bcd6c5f1681d208ee75763d (diff)
downloadgit-42471bcee44e87669eb17f9fa13c8041a0fc35a1.tar.gz
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/setup.c b/setup.c
index f2a8070bd4..86bb7c9a96 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)