From: Junio C Hamano Date: Thu, 29 Sep 2016 23:49:43 +0000 (-0700) Subject: Merge branch 'nd/checkout-disambiguation' into maint X-Git-Tag: v2.10.1~10 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d336b675680c7d4adc9f7190b7974b2ef10c0af4?hp=-c Merge branch 'nd/checkout-disambiguation' into maint "git checkout " does not follow the usual disambiguation rules when the 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 --- d336b675680c7d4adc9f7190b7974b2ef10c0af4 diff --combined builtin/checkout.c index afbff3e790,53c7284ffd..0ad96786c9 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@@ -154,8 -154,8 +154,8 @@@ static int check_stages(unsigned stages return 0; } -static int checkout_stage(int stage, struct cache_entry *ce, int pos, - struct checkout *state) +static int checkout_stage(int stage, const struct cache_entry *ce, int pos, + const struct checkout *state) { while (pos < active_nr && !strcmp(active_cache[pos]->name, ce->name)) { @@@ -169,7 -169,7 +169,7 @@@ return error(_("path '%s' does not have their version"), ce->name); } -static int checkout_merged(int pos, struct checkout *state) +static int checkout_merged(int pos, const struct checkout *state) { struct cache_entry *ce = active_cache[pos]; const char *path = ce->name; @@@ -985,7 -985,7 +985,7 @@@ static int parse_branchname_arg(int arg 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 +1038,7 @@@ 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 +1046,7 @@@ * it would be extremely annoying. */ if (argc) - verify_non_filename(NULL, arg); + verify_non_filename(opts->prefix, arg); } else { argcount++; argv++;