]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/pack-objects.c: avoid redundant NULL check
authorTaylor Blau <me@ttaylorr.com>
Tue, 24 May 2022 18:54:27 +0000 (14:54 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 May 2022 21:27:19 +0000 (14:27 -0700)
Before calling `for_each_object_in_pack()`, the caller
`read_packs_list_from_stdin()` loops through each of the `include_packs`
and checks that its `->util` pointer (which is used to store the `struct
packed_git *` itself) is non-NULL.

This check is redundant, because `read_packs_list_from_stdin()` already
checks that the included packs are non-NULL earlier on in the same
function (and it does not add any new entries in between).

Remove this check, since it is not doing anything in the meantime.

Co-authored-by: Victoria Dye <vdye@github.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c

index ba2006f2212bea19b202ba3db155b345bf7fbb89..f5b098a2d419e56ce3fe3f4d9a97cb8c30ffa628 100644 (file)
@@ -3361,8 +3361,6 @@ static void read_packs_list_from_stdin(void)
 
        for_each_string_list_item(item, &include_packs) {
                struct packed_git *p = item->util;
-               if (!p)
-                       die(_("could not find pack '%s'"), item->string);
                for_each_object_in_pack(p,
                                        add_object_entry_from_pack,
                                        &revs,