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

[PATCH] Merge non-first refs that match first refspec

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Sep 28, 2007, 03:52 UTC
Message-ID
<Pine.LNX.4.64.0709272351010.5926@iabervon.org>

The code only looked at the first ref in the map of refs when looking for matches for the first refspec in the case where there is not per-branch configuration of ref to merge. This is often sufficient, but not always. Make the logic clearer and test everything in the map.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
I ran all the usual tests with this, and it seems like it should fix a bug 
you saw, but I don't have the test case to make sure.
 builtin-fetch.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index 2f639cc..47811c9 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -101,12 +101,13 @@ static struct ref *get_ref_map(struct transport *transport,
 				if (remote->fetch[i].dst &&
 				    remote->fetch[i].dst[0])
 					*autotags = 1;
-				if (!i && !has_merge && ref_map &&
-				    !strcmp(remote->fetch[0].src, ref_map->name))
-					ref_map->merge = 1;
 			}
 			if (has_merge)
 				add_merge_config(&ref_map, remote_refs, branch, &tail);
+			else
+				for (rm = ref_map; rm; rm = rm->next)
+					if (!strcmp(remote->fetch[0].src, rm->name))
+						rm->merge = 1;
 		} else {
 			ref_map = get_remote_ref(remote_refs, "HEAD");
 			ref_map->merge = 1;
-- 
1.5.3.2.1041.g2df10
Next: Shawn O. Pearce
Message 1 of 9 in “Merge non-first refs that match first refspec”
  1. Merge non-first refs that match first refspecDaniel Barkalow, Sep 28, 2007
  2. Shawn O. PearceSep 28, 2007
  3. Daniel BarkalowSep 28, 2007
  4. Shawn O. PearceSep 28, 2007
  5. Daniel BarkalowSep 28, 2007
  6. Shawn O. PearceSep 28, 2007
  7. Junio C HamanoSep 28, 2007
  8. Junio C HamanoSep 28, 2007
  9. Daniel BarkalowSep 28, 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.