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

Re: [PATCH] diff: skip GITLINK when lazy fetching missing objs

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 20, 2019, 21:18 UTC
Message-ID
<xmqqblwjtu1b.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190820205320.139006-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 5 quoted lines
> In 7fbbcb21b1 ("diff: batch fetching of missing blobs", 2019-04-08),
> diff was taught to batch the fetching of missing objects when operating
> on a partial clone, but was not taught to refrain from fetching
> GITLINKs. Teach diff to check if an object is a GITLINK before including
> it in the set to be fetched.

OK, so in a lazy repository, running "git diff" (or "git log") could have resulted in "git fetch" of a history of a submodule, which may likely have failed?

> (As stated in the commit message of that commit, unpack-trees was also
> taught a similar thing prior, but unpack-trees correctly checks for
> GITLINK before including objects in the set to be fetched.)
> ---
Sign-off?
Show 21 quoted lines
> One of my colleagues noticed this when switching branches in a
> superproject with a dirty working tree (hence triggering the diff
> mechanism). The test I included in this commit tests a simpler use case,
> but I've verified that this solves my colleague's case too.
> ---
>  diff.c                        |  1 +
>  t/t4067-diff-partial-clone.sh | 31 +++++++++++++++++++++++++++++++
>  2 files changed, 32 insertions(+)
>
> diff --git a/diff.c b/diff.c
> index efe42b341a..e28b463f57 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -6512,6 +6512,7 @@ static void add_if_missing(struct repository *r,
>  			   const struct diff_filespec *filespec)
>  {
>  	if (filespec && filespec->oid_valid &&
> +	    !S_ISGITLINK(filespec->mode) &&
>  	    oid_object_info_extended(r, &filespec->oid, NULL,
>  				     OBJECT_INFO_FOR_PREFETCH))
>  		oid_array_append(to_fetch, &filespec->oid);
Makes sense.
Thanks.
Previous: Jonathan TanNext: Jonathan Tan
Message 2 of 6 in “diff: skip GITLINK when lazy fetching missing objs”
  1. diff: skip GITLINK when lazy fetching missing objsJonathan Tan, Aug 20, 2019
  2. Junio C HamanoAug 20, 2019
  3. Jonathan TanAug 20, 2019
  4. Jeff KingAug 22, 2019
  5. Jonathan TanAug 22, 2019
  6. Jeff KingAug 22, 2019

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.