]> git.ipfire.org Git - thirdparty/git.git/commitdiff
archive: deduplicate verbose printing
authorRené Scharfe <l.s.r@web.de>
Tue, 11 Oct 2022 09:29:38 +0000 (11:29 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Oct 2022 15:35:10 +0000 (08:35 -0700)
94bc671a1f (Add directory pattern matching to attributes, 2012-12-08)
moved the code for adding the trailing slash to names of directories and
submodules up.  This left both branches of the if statement starting
with the same conditional fprintf call.  Deduplicate it.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive.c

index d571249cf393396ca9815cf805f39b3d3d82c2d6..ec0ed7580910c6c78865dc7d4b0362ac4af786b9 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -165,18 +165,16 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
                args->convert = check_attr_export_subst(check);
        }
 
+       if (args->verbose)
+               fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
+
        if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
-               if (args->verbose)
-                       fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
                err = write_entry(args, oid, path.buf, path.len, mode, NULL, 0);
                if (err)
                        return err;
                return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
        }
 
-       if (args->verbose)
-               fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
-
        /* Stream it? */
        if (S_ISREG(mode) && !args->convert &&
            oid_object_info(args->repo, oid, &size) == OBJ_BLOB &&