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

Re: [PATCH] fixup! diff: batch fetching of missing blobs

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 6, 2019, 04:17 UTC
Message-ID
<CACsJy8AjyY1Azbf4VfnJMA3O8NNBV1P16dZRrHOUJdsYQHUu4g@mail.gmail.com>
In-Reply-To
<20190405170934.20441-1-jonathantanmy@google.com>
On Sat, Apr 6, 2019 at 12:09 AM Jonathan Tan <jonathantanmy@google.com> wrote:
Show 32 quoted lines
>
> This is a fixup on the tip of jt/batch-fetch-blobs-in-diff (571debe1d9).
>
> I don't know if Junio has already merged this branch to next (he marked
> this as "Will merge to 'next'" in the "What's Cooking" email, but when I
> fetched, it hasn't been merged yet). If he has, we can use this commit
> message:
>
> diff: propagate options->repo to add_if_missing
>
> Avoid a usage of the_repository by propagating the configured repository
> to add_if_missing(). Also, prefetch only if the repository being diffed
> is the_repository (because we do not support lazy fetching for any other
> repository anyway).
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> Thanks, Duy, for noticing this.
> ---
>  diff.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 1eccefb4ef..811afbdfb1 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -6367,18 +6367,19 @@ void diffcore_fix_diff_index(void)
>         QSORT(q->queue, q->nr, diffnamecmp);
>  }
>
> -static void add_if_missing(struct oid_array *to_fetch,
> +static void add_if_missing(struct oid_array *to_fetch, struct repository *r,

One last nit. "struct repository *r" is often the first argument. See https://public-inbox.org/git/xmqqsh2p6l43.fsf@gitster-ct.c.googlers.com/

Show 31 quoted lines
>                            const struct diff_filespec *filespec)
>  {
>         if (filespec && filespec->oid_valid &&
> -           oid_object_info_extended(the_repository, &filespec->oid, NULL,
> +           oid_object_info_extended(r, &filespec->oid, NULL,
>                                      OBJECT_INFO_FOR_PREFETCH))
>                 oid_array_append(to_fetch, &filespec->oid);
>  }
>
>  void diffcore_std(struct diff_options *options)
>  {
> -       if (repository_format_partial_clone) {
> +       if (options->repo == the_repository &&
> +           repository_format_partial_clone) {
>                 /*
>                  * Prefetch the diff pairs that are about to be flushed.
>                  */
> @@ -6388,8 +6389,8 @@ void diffcore_std(struct diff_options *options)
>
>                 for (i = 0; i < q->nr; i++) {
>                         struct diff_filepair *p = q->queue[i];
> -                       add_if_missing(&to_fetch, p->one);
> -                       add_if_missing(&to_fetch, p->two);
> +                       add_if_missing(&to_fetch, options->repo, p->one);
> +                       add_if_missing(&to_fetch, options->repo, p->two);
>                 }
>                 if (to_fetch.nr)
>                         /*
> --
> 2.21.0.392.gf8f6787159e-goog
>
-- 
Duy
Previous: Johannes SchindelinNext: Junio C Hamano
Message 23 of 29 in “diff: batch fetching of missing blobs”
  1. diff: batch fetching of missing blobsJonathan Tan, Mar 26, 2019
  2. SZEDER GáborMar 27, 2019
  3. Johannes SchindelinMar 27, 2019
  4. Jeff KingMar 28, 2019
  5. 0/2 Batch fetching of missing blobs in diff and showJonathan Tan, Mar 29, 2019
  6. 1/2 sha1-file: support OBJECT_INFO_FOR_PREFETCHJonathan Tan, Mar 29, 2019
  7. Johannes SchindelinApr 5, 2019
  8. Jeff KingApr 5, 2019
  9. 2/2 diff: batch fetching of missing blobsJonathan Tan, Mar 29, 2019
  10. SZEDER GáborApr 4, 2019
  11. Johannes SchindelinApr 5, 2019
  12. Christian CouderApr 7, 2019
  13. Junio C HamanoApr 8, 2019
  14. Junio C HamanoApr 8, 2019
  15. Junio C HamanoApr 8, 2019
  16. Christian CouderApr 8, 2019
  17. Christian CouderApr 8, 2019
  18. Junio C HamanoApr 8, 2019
  19. Christian CouderApr 8, 2019
  20. Duy NguyenApr 5, 2019
  21. fixup! diff: batch fetching of missing blobsJonathan Tan, Apr 5, 2019
  22. Johannes SchindelinApr 5, 2019
  23. Duy NguyenApr 6, 2019
  24. Junio C HamanoApr 8, 2019
  25. Junio C HamanoApr 8, 2019
  26. Duy NguyenApr 8, 2019
  27. Junio C HamanoApr 9, 2019
  28. Johannes SchindelinApr 5, 2019
  29. Jeff KingApr 5, 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.