Skip to content

Commit

Permalink
checkout: reorder check_filename conditional
Browse files Browse the repository at this point in the history
If we have a "--" flag, we should not be doing DWIM magic
based on whether arguments can be filenames. Reorder the
conditional to avoid the check_filename() call entirely in
this case. The outcome is the same, but the short-circuit
makes the dependency more clear.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Feb 10, 2016
1 parent b3325df commit 1cc777d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ static int parse_branchname_arg(int argc, const char **argv,
*/
int recover_with_dwim = dwim_new_local_branch_ok;

if (check_filename(NULL, arg) && !has_dash_dash)
if (!has_dash_dash && check_filename(NULL, arg))
recover_with_dwim = 0;
/*
* Accept "git checkout foo" and "git checkout foo --"
Expand Down

0 comments on commit 1cc777d

Please sign in to comment.