]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fetch: stop checking for NULL transport->remote in do_fetch()
authorJeff King <peff@peff.net>
Thu, 8 Sep 2022 19:24:21 +0000 (15:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Sep 2022 20:10:32 +0000 (13:10 -0700)
This field will never be NULL; if it were, we'd segfault earlier in the
function when we unconditionally check transport->remote->fetch_tags.
Likewise, many other functions dereference it unconditionally.

This is a small simplification, but it will make things easier as we
extend this conditional in the next patch.

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

index ac29c2b1ae34df79f8a2bd62318dc714a1f37e24..d39098d9abf9c2d933f9dee3ccc67826f16683d4 100644 (file)
@@ -1626,7 +1626,7 @@ static int do_fetch(struct transport *transport,
                                break;
                        }
                }
-       } else if (transport->remote && transport->remote->fetch.nr)
+       } else if (transport->remote->fetch.nr)
                refspec_ref_prefixes(&transport->remote->fetch,
                                     &transport_ls_refs_options.ref_prefixes);