git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
Sep 18, 2007, 08:54 UTC
Message-ID
<20070918085448.GA5390@spearce.org>

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>
---
 remote.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/remote.c b/remote.c
index 73a34c9..af3c46b 100644
--- a/remote.c
+++ b/remote.c
@@ -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;
 	}
 
-- 
1.5.3.1.1000.g7319b
Message 1 of 1 in “builtin-fetch: Don't segfault on "fetch +foo"”
  1. 1/5 builtin-fetch: Don't segfault on "fetch +foo"Shawn O. Pearce, Sep 18, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.