Skip to content

Commit 1cc777d

Browse files
peffgitster
authored andcommitted
checkout: reorder check_filename conditional
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b3325df commit 1cc777d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ static int parse_branchname_arg(int argc, const char **argv,
965965
*/
966966
int recover_with_dwim = dwim_new_local_branch_ok;
967967

968-
if (check_filename(NULL, arg) && !has_dash_dash)
968+
if (!has_dash_dash && check_filename(NULL, arg))
969969
recover_with_dwim = 0;
970970
/*
971971
* Accept "git checkout foo" and "git checkout foo --"

0 commit comments

Comments
 (0)