]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parse-options: use prefix_filename_except_for_dash() helper
authorJeff King <peff@peff.net>
Sat, 4 Mar 2023 10:31:47 +0000 (05:31 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Mar 2023 21:14:53 +0000 (13:14 -0800)
Since our fix_filename()'s only remaining special case is handling "-",
we can use the newly-minted helper function that handles this already.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.c

index 70f827a0731ba83f8b3df78f837457103a0661df..46fe30ddd4b4ec2a256f3f4e1544b8278ccf3258 100644 (file)
@@ -63,10 +63,8 @@ static void fix_filename(const char *prefix, char **file)
 {
        if (!file || !*file)
                ; /* leave as NULL */
-       else if (!strcmp("-", *file))
-               *file = xstrdup(*file);
        else
-               *file = prefix_filename(prefix, *file);
+               *file = prefix_filename_except_for_dash(prefix, *file);
 }
 
 static enum parse_opt_result opt_command_mode_error(