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

Re: [PATCH v2] remote.c: defer remote.<name>.followRemoteHEAD validation

From
Matt Hunter <m@lfurio.us>
Date
Nov 6, 2026, 09:34 UTC
Message-ID
<DMO0XC1PL4MP.1J5830XZ4GCS5@lfurio.us>
In-Reply-To
<xmqqjymqobc3.fsf@gitster.g>
On Thu Nov 5, 2026 at 11:03 PM EST, Junio C Hamano wrote:
Show 5 quoted lines
>
> Hmph, interesting.  Can you rewrite Colin's patch using this, and
> then merge the result into 'seen' (after reverting Colin's topic
> ch/remote-defer-follow-remote-head-validation from 'seen' first) to
> see how badly it crashes with other topics in flight?

I still have the commit sitting around. I tried this and a replay of the current topic to compare -- the conflict is the same in both cases. eg: Nothing else in flight is touching the get_follow_remote_head() function.

static int do_fetch(struct transport *transport,
		    struct refspec *rs,
		    const struct fetch_config *config,
		    struct list_objects_filter_options *filter_options,
		    struct oidset *updated_tips)
{
	struct ref_transaction *transaction = NULL;
	struct ref *ref_map = NULL;
	struct display_state display_state = { 0 };
	int autotags = (transport->remote->fetch_tags == 1);
	int retcode = 0;
	const struct ref *remote_refs;
	struct transport_ls_refs_options transport_ls_refs_options =
		TRANSPORT_LS_REFS_OPTIONS_INIT;
	struct fetch_head fetch_head = { 0 };
	struct strbuf err = STRBUF_INIT;
	struct ref_update_display_info_array display_array = { 0 };
	struct strmap rejected_refs = STRMAP_INIT;
	int summary_width = 0;
	int follow_remote_head = FOLLOW_REMOTE_NEVER;
<<<<<<< HEAD
	bool apply_follow_remote_head_config = false;
=======
	const char *no_warn_branch = NULL;
>>>>>>> try-merge
	if (tags == TAGS_DEFAULT) {
		if (transport->remote->fetch_tags == 2)
			tags = TAGS_SET;
		if (transport->remote->fetch_tags == -1)
			tags = TAGS_UNSET;
	}
	/* if not appending, truncate FETCH_HEAD */
	if (!append && write_fetch_head) {
		retcode = truncate_fetch_head();
		if (retcode)
			goto cleanup;
	}
	if (rs->nr) {
		refspec_ref_prefixes(rs, &transport_ls_refs_options.ref_prefixes);
	} else if (transport->remote->fetch.nr) {
		refspec_ref_prefixes(&transport->remote->fetch,
				     &transport_ls_refs_options.ref_prefixes);
		apply_follow_remote_head_config = true;
<<<<<<< HEAD
		/*
		 * The configured refspec may not cover the current
		 * branch's upstream (e.g. a narrowed -t refspec), so
		 * make sure we can still fetch it regardless.
		 */
		collect_upstream_from_remote(the_repository, transport->remote,
					      NULL, &transport_ls_refs_options.ref_prefixes);
	} else {
		/*
		 * The --refmap command line option, if given, takes
		 * precedence over remote.<name>.fetchRefmap.
		 */
		struct refspec *effective_refmap = refmap.nr ? &refmap :
			&transport->remote->refmap;
		if (effective_refmap->nr) {
			branches_tracking_remote(the_repository, transport->remote,
						  &transport_ls_refs_options.ref_prefixes);
			apply_follow_remote_head_config = true;
		} else {
			collect_upstream_from_remote(the_repository, transport->remote,
						      NULL, &transport_ls_refs_options.ref_prefixes);
=======
		if (transport->remote->fetch.nr) {
			refspec_ref_prefixes(&transport->remote->fetch,
					     &transport_ls_refs_options.ref_prefixes);
			follow_remote_head =
				get_follow_remote_head(transport, config,
						&no_warn_branch);
		}
		if (branch && branch_has_merge_config(branch) &&
		    !strcmp(branch->remote_name, transport->remote->name)) {
			int i;
			for (i = 0; i < branch->merge_nr; i++) {
				strvec_push(&transport_ls_refs_options.ref_prefixes,
					    branch->merge[i]->src);
			}
>>>>>>> try-merge
		}
		/*
		 * If there are no refs specified to fetch, then we just
		 * fetch HEAD; mention that to narrow the advertisement.
		 */
		if (!transport_ls_refs_options.ref_prefixes.nr)
			strvec_push(&transport_ls_refs_options.ref_prefixes,
				    "HEAD");
	}
Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 19 in “remote.c: defer remote.<name>.followRemoteHEAD validation”
  1. remote.c: defer remote.<name>.followRemoteHEAD validationColin Hinton, Oct 18, 2026
  2. Junio C HamanoOct 19, 2026
  3. Matt HunterOct 19, 2026
  4. Colin HintonOct 21, 2026
  5. Matt HunterOct 22, 2026
  6. remote.c: defer remote.<name>.followRemoteHEAD validationColin Hinton, Oct 23, 2026
  7. Junio C HamanoOct 23, 2026
  8. Matt HunterOct 24, 2026
  9. Junio C HamanoOct 24, 2026
  10. Junio C HamanoOct 25, 2026
  11. Colin HintonOct 28, 2026
  12. Junio C HamanoOct 28, 2026
  13. Matt HunterOct 30, 2026
  14. Junio C HamanoOct 30, 2026
  15. Matt HunterNov 1, 2026
  16. Junio C HamanoNov 6, 2026
  17. Matt HunterNov 6, 2026
  18. Junio C HamanoNov 6, 2026
  19. Colin HintonNov 8, 2026

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.