Thread (23 messages) flat view 23 messages, 5 authors, 2022-09-09
STALE1456d

[PATCH 1/2] fetch: stop checking for NULL transport->remote in do_fetch()

From: Jeff King <hidden>
Date: 2022-09-08 19:24:30
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 builtin/fetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 368a0f5329..f78146ca81 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1616,7 +1616,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);
 
-- 
2.37.3.1164.gb600acaa9f
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help