Skip to content

Commit 27e1337

Browse files
spearcegitster
authored andcommitted
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. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 parent f383959 commit 27e1337

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

remote.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,7 @@ int get_fetch_map(struct ref *remote_refs,
875875
refspec->src : "HEAD");
876876

877877
ref_map->peer_ref = get_local_ref(refspec->dst);
878-
879-
if (refspec->force)
878+
if (ref_map->peer_ref && refspec->force)
880879
ref_map->peer_ref->force = 1;
881880
}
882881

0 commit comments

Comments
 (0)