Skip to contentSkip to conversation

builtin-fetch: Don't segfault on "fetch +foo"

PATCH In review Shawn O. Pearce 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 builtin-fetch: Don't segfault on "fetch +foo"

If we are fetching something and were configured to do a forced fetch and have no local ref to store the fetched object into we cannot mark the local ref as having a forced update. Instead we should just silently discard the + request.

---
 remote.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
remote.c +1 -2
index 73a34c9..af3c46b 100644
@@ -875,8 +875,7 @@ int get_fetch_map(struct ref *remote_refs,
 					 refspec->src : "HEAD");
 
 		ref_map->peer_ref = get_local_ref(refspec->dst);
-
-		if (refspec->force)
+		if (ref_map->peer_ref && refspec->force)
 			ref_map->peer_ref->force = 1;
 	}
 
Signature · 1 line
1.5.3.1.1000.g7319b