aboutsummaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-30 08:52:53 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-30 08:52:53 -0800
commit7b5196909c7773a3ce6d3cd0ba78f42249bf27c3 (patch)
tree643b5ad7f520dd456d35ab0e7e86c69da665ce7c /setup.c
parentb596574ed30a9353fabc55c4548e80c4df4d009e (diff)
parent0b0ecaac2ad984599923999d6d4c32e6111bb73f (diff)
downloadgit-7b5196909c7773a3ce6d3cd0ba78f42249bf27c3.tar.gz
git-7b5196909c7773a3ce6d3cd0ba78f42249bf27c3.tar.xz
Merge branch 'nd/magic-pathspec-from-root'
When giving arguments without "--" disambiguation, object names that come earlier on the command line must not be interpretable as pathspecs and pathspecs that come later on the command line must not be interpretable as object names. Tweak the disambiguation rule so that ":/" (no other string before or after) is always interpreted as a pathspec, to avoid having to say "git cmd -- :/". * nd/magic-pathspec-from-root: grep: avoid accepting ambiguous revision Update :/abc ambiguity check
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index 1ccfafaa7..2e1521b09 100644
--- a/setup.c
+++ b/setup.c
@@ -66,7 +66,14 @@ int check_filename(const char *prefix, const char *arg)
const char *name;
struct stat st;
- name = prefix ? prefix_filename(prefix, strlen(prefix), arg) : arg;
+ if (!prefixcmp(arg, ":/")) {
+ if (arg[2] == '\0') /* ":/" is root dir, always exists */
+ return 1;
+ name = arg + 2;
+ } else if (prefix)
+ name = prefix_filename(prefix, strlen(prefix), arg);
+ else
+ name = arg;
if (!lstat(name, &st))
return 1; /* file exists */
if (errno == ENOENT || errno == ENOTDIR)