[PATCH 1/3] checkout: reorder check_filename conditional
- From
Jeff King <peff@peff.net>
- Date
- Feb 10, 2016, 21:12 UTC
- Message-ID
- <20160210211234.GA5799@sigill.intra.peff.net>
- In-Reply-To
- <20160210211206.GA5755@sigill.intra.peff.net>
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> --- builtin/checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c index 5af84a3..f6a2809 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -982,7 +982,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 --"
-- 2.7.1.545.gfd1d4e5