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

Re: [PATCH 4/4] fetch: opportunistically update tracking refs

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 6, 2013, 16:28 UTC
Message-ID
<7vsiymhjgz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130511161652.GD3270@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> @@ -170,6 +172,20 @@ static struct ref *get_ref_map(struct transport *transport,
>  			rm->fetch_head_status = FETCH_HEAD_MERGE;
>  		if (tags == TAGS_SET)
>  			get_fetch_map(remote_refs, tag_refspec, &tail, 0);
> +
> +		/*
> +		 * For any refs that we happen to be fetching via command-line
> +		 * arguments, take the opportunity to update their configured
> +		 * counterparts. However, we do not want to mention these
> +		 * entries in FETCH_HEAD at all, as they would simply be
> +		 * duplicates of existing entries.
> +		 */
> +		old_tail = tail;
> +		for (i = 0; i < transport->remote->fetch_refspec_nr; i++)
> +			get_fetch_map(ref_map, &transport->remote->fetch[i],
> +				      &tail, 0);
> +		for (rm = *old_tail; rm; rm = rm->next)
> +			rm->fetch_head_status = FETCH_HEAD_IGNORE;

Was there a reason why this change was done by appending new ref at the tail of the ref_map list? I would have expected that a naïve and obvious implementation would be to iterate existing refs over ref_map to find refs with an empty RHS whose LHS is configured to usually store the fetched result to somewhere and to update their RHS in place.

Being curious.
Previous: Jeff KingNext: Jeff King
Message 10 of 12 in “update tracking refs on explicit fetch”
  1. 0/4 update tracking refs on explicit fetchJeff King, May 11, 2013
  2. 1/4 t5510: start tracking-ref tests from a known stateJeff King, May 11, 2013
  3. Eric SunshineMay 14, 2013
  4. 2/4 fetch/pull doc: untangle meaning of bare <ref>Jeff King, May 11, 2013
  5. 3/4 refactor "ref->merge" flagJeff King, May 11, 2013
  6. 4/4 fetch: opportunistically update tracking refsJeff King, May 11, 2013
  7. Thomas RastMay 12, 2013
  8. Thomas RastMay 12, 2013
  9. Jeff KingMay 16, 2013
  10. Junio C HamanoAug 6, 2013
  11. Jeff KingAug 6, 2013
  12. Junio C HamanoAug 6, 2013

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.