diff options
author | Jeff King <peff@peff.net> | 2017-05-26 21:10:53 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-29 04:36:56 +0200 |
commit | 2cb47ab6958192a4b4b3b0616b2ab37f6680547f (patch) | |
tree | 498205c45cf22cadc8a99287cf497336f2273df4 /setup.c | |
parent | verify_filename(): treat ":(magic)" as a pathspec (diff) | |
download | git-2cb47ab6958192a4b4b3b0616b2ab37f6680547f.tar.xz git-2cb47ab6958192a4b4b3b0616b2ab37f6680547f.zip |
verify_filename(): flip order of checks
The looks_like_pathspec() check is much cheaper than
check_filename(), which actually stats the file. Since
either is sufficient for our return value, we should do the
cheaper one first, potentially short-circuiting the other.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -229,7 +229,7 @@ void verify_filename(const char *prefix, { if (*arg == '-') die("bad flag '%s' used after filename", arg); - if (check_filename(prefix, arg) || looks_like_pathspec(arg)) + if (looks_like_pathspec(arg) || check_filename(prefix, arg)) return; die_verify_filename(prefix, arg, diagnose_misspelt_rev); } |