summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-09-29 16:49:43 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-09-29 16:49:44 -0700
commitd336b675680c7d4adc9f7190b7974b2ef10c0af4 (patch)
treef27b45c24a78fecac73f6bf5407d9450052ab8aa /builtin
parentMerge branch 'ep/doc-check-ref-format-example' into maint (diff)
parentcheckout: fix ambiguity check in subdir (diff)
downloadtgif-d336b675680c7d4adc9f7190b7974b2ef10c0af4.tar.xz
Merge branch 'nd/checkout-disambiguation' into maint
"git checkout <word>" does not follow the usual disambiguation rules when the <word> can be both a rev and a path, to allow checking out a branch 'foo' in a project that happens to have a file 'foo' in the working tree without having to disambiguate. This was poorly documented and the check was incorrect when the command was run from a subdirectory. * nd/checkout-disambiguation: checkout: fix ambiguity check in subdir checkout.txt: document a common case that ignores ambiguation rules checkout: add some spaces between code and comment
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index afbff3e790..0ad96786c9 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -985,7 +985,7 @@ static int parse_branchname_arg(int argc, const char **argv,
int recover_with_dwim = dwim_new_local_branch_ok;
if (!has_dash_dash &&
- (check_filename(NULL, arg) || !no_wildcard(arg)))
+ (check_filename(opts->prefix, arg) || !no_wildcard(arg)))
recover_with_dwim = 0;
/*
* Accept "git checkout foo" and "git checkout foo --"
@@ -1038,7 +1038,7 @@ static int parse_branchname_arg(int argc, const char **argv,
if (!*source_tree) /* case (1): want a tree */
die(_("reference is not a tree: %s"), arg);
- if (!has_dash_dash) {/* case (3).(d) -> (1) */
+ if (!has_dash_dash) { /* case (3).(d) -> (1) */
/*
* Do not complain the most common case
* git checkout branch
@@ -1046,7 +1046,7 @@ static int parse_branchname_arg(int argc, const char **argv,
* it would be extremely annoying.
*/
if (argc)
- verify_non_filename(NULL, arg);
+ verify_non_filename(opts->prefix, arg);
} else {
argcount++;
argv++;