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

Re: [RFC PATCH] diff: only prefetch for certain output formats

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jan 30, 2020, 23:20 UTC
Message-ID
<20200130232002.203193-1-jonathantanmy@google.com>
In-Reply-To
<20200130055136.GA2184413@coredump.intra.peff.net>
Show 9 quoted lines
> Ah, true, "options->detect_rename" would be overly broad.
> 
> I actually don't think it would be that bad to put the logic in
> diffcore_rename(). If we wait until the right moment (after inexact
> renames have been resolved, and when we see if there are any candidates
> left), it should just be a matter of walking over the candidate lists.
> 
> Something like this (it would need the add_if_missing() helper from
> diffcore_std()):
[snip]
Show 26 quoted lines
> @@ -538,6 +539,25 @@ void diffcore_rename(struct diff_options *options)
>  		break;
>  	}
>  
> +	/*
> +	 * At this point we know there's actual work to do: we have rename
> +	 * destinations that didn't find an exact match, and we have potential
> +	 * sources. So we'll have to do inexact rename detection, which
> +	 * requires looking at the blobs. It's worth pre-fetching them as a
> +	 * group now.
> +	 */
> +	for (i = 0; i < rename_dst_nr; i++) {
> +		if (rename_dst[i].pair)
> +			continue; /* already found exact match */
> +		add_if_missing(options->repo, &to_fetch, rename_dst[i].two);
> +	}
> +	for (i = 0; i < rename_src_nr; i++) {
> +		add_if_missing(options->repo, &to_fetch, rename_src[i].p->one);
> +	}
> +	if (to_fetch.nr)
> +		promisor_remote_get_direct(options->repo,
> +					   to_fetch.oid, to_fetch.nr);
> +
>  	if (options->show_rename_progress) {
>  		progress = start_delayed_progress(
>  				_("Performing inexact rename detection"),

And also the equivalent code in diffcore_break() and in diffcore_std() after both these functions are invoked (in case nothing got prefetched, but the diff still requires blobs).

Previous: Jeff KingNext: Jeff King
Message 5 of 8 in “diff: only prefetch for certain output formats”
  1. diff: only prefetch for certain output formatsJonathan Tan, Jan 28, 2020
  2. Jeff KingJan 29, 2020
  3. Jonathan TanJan 30, 2020
  4. Jeff KingJan 30, 2020
  5. Jonathan TanJan 30, 2020
  6. Jeff KingJan 31, 2020
  7. Junio C HamanoJan 31, 2020
  8. Jeff KingFeb 1, 2020

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.