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>
Jeff King committed
May 26, 2017 at 15:10 UTC
2cb47ab6958192a4b4b3b0616b2ab37f6680547f
1 file changed
+1
-1
setup.c
+1
-1
@@ -229,7 +229,7 @@ void verify_filename(const char *prefix,
229
{
230
if (*arg == '-')
231
die("bad flag '%s' used after filename", arg);
232
- if (check_filename(prefix, arg) || looks_like_pathspec(arg))
232
+ if (looks_like_pathspec(arg) || check_filename(prefix, arg))
233
return;
234
die_verify_filename(prefix, arg, diagnose_misspelt_rev);
235
}