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

Re: [PATCH 10/15] [GSOC] cat-file: add has_object_file() check

From
ZheNing Hu <adlternative@gmail.com>
Date
Jul 3, 2021, 05:50 UTC
Message-ID
<CAOLTT8SD1eSNy1w8HBt0Z2BA=YqiUYrWsnAA9cDhBOdff=U=Yg@mail.gmail.com>
In-Reply-To
<87a6n4alfk.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> 于2021年7月2日周五 下午9:34写道:
Show 38 quoted lines
>
>
> On Thu, Jul 01 2021, ZheNing Hu via GitGitGadget wrote:
>
> > From: ZheNing Hu <adlternative@gmail.com>
> >
> > Use `has_object_file()` in `batch_one_object()` to check
> > whether the input object exists. This can help us reject
> > the missing oid when we let `cat-file --batch` use ref-filter
> > logic later.
> >
> > Mentored-by: Christian Couder <christian.couder@gmail.com>
> > Mentored-by: Hariom Verma <hariom18599@gmail.com>
> > Signed-off-by: ZheNing Hu <adlternative@gmail.com>
> > ---
> >  builtin/cat-file.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/builtin/cat-file.c b/builtin/cat-file.c
> > index 243fe6844bc..59a86412fd0 100644
> > --- a/builtin/cat-file.c
> > +++ b/builtin/cat-file.c
> > @@ -428,6 +428,13 @@ static void batch_one_object(const char *obj_name,
> >               return;
> >       }
> >
> > +     if (!has_object_file(&data->oid)) {
> > +             printf("%s missing\n",
> > +                    obj_name ? obj_name : oid_to_hex(&data->oid));
> > +             fflush(stdout);
> > +             return;
> > +     }
> > +
> >       batch_object_write(obj_name, scratch, opt, data);
> >  }
>
> In 12/15 the old "missing" is removed, so is this strictly redundant to
> what's in batch_object_write() for now, does it change anything?
Both of these commits are used to pass some tests for checking missing objects.

If we don't have this commit, "empty --batch-check notices missing object" in "t/t1006-cat-file.sh" will fail; If we don't have the commit "[GSOC] ref-filter: modify the error message and value in get_object", "bogus OFS_DELTA in packfile" in "t/t5313-pack-bounds-checks.sh" will fail.

Thanks. -- ZheNing Hu

Previous: Ævar Arnfjörð BjarmasonNext: ZheNing Hu via GitGitGadget
Message 31 of 39 in “[GSOC] cat-file: reuse ref-filter logic”
  1. 00/15 [GSOC] cat-file: reuse ref-filter logicZheNing Hu via GitGitGadget, Jul 1, 2021
  2. 01/15 [GSOC] ref-filter: add obj-type check in grab contentsZheNing Hu via GitGitGadget, Jul 1, 2021
  3. 03/15 [GSOC] ref-filter: --format=%(raw) re-support --perlZheNing Hu via GitGitGadget, Jul 1, 2021
  4. Ævar Arnfjörð BjarmasonJul 2, 2021
  5. ZheNing HuJul 3, 2021
  6. 02/15 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, Jul 1, 2021
  7. Ævar Arnfjörð BjarmasonJul 2, 2021
  8. ZheNing HuJul 3, 2021
  9. 05/15 [GSOC] ref-filter: add %(rest) atomZheNing Hu via GitGitGadget, Jul 1, 2021
  10. 04/15 [GSOC] ref-filter: use non-const ref_format in *_atom_parser()ZheNing Hu via GitGitGadget, Jul 1, 2021
  11. 06/15 [GSOC] ref-filter: pass get_object() return value to their callersZheNing Hu via GitGitGadget, Jul 1, 2021
  12. 08/15 [GSOC] ref-filter: add cat_file_mode in struct ref_formatZheNing Hu via GitGitGadget, Jul 1, 2021
  13. Ævar Arnfjörð BjarmasonJul 2, 2021
  14. Eric SunshineJul 2, 2021
  15. Christian CouderJul 2, 2021
  16. ZheNing HuJul 3, 2021
  17. Ævar Arnfjörð BjarmasonJul 5, 2021
  18. 07/15 [GSOC] ref-filter: introduce free_ref_array_item_value() functionZheNing Hu via GitGitGadget, Jul 1, 2021
  19. 09/15 [GSOC] ref-filter: modify the error message and value in get_objectZheNing Hu via GitGitGadget, Jul 1, 2021
  20. 11/15 [GSOC] cat-file: change batch_objects parameter nameZheNing Hu via GitGitGadget, Jul 1, 2021
  21. 12/15 [GSOC] cat-file: reuse ref-filter logicZheNing Hu via GitGitGadget, Jul 1, 2021
  22. Ævar Arnfjörð BjarmasonJul 2, 2021
  23. Christian CouderJul 2, 2021
  24. ZheNing HuJul 3, 2021
  25. ZheNing HuJul 3, 2021
  26. Ævar Arnfjörð BjarmasonJul 3, 2021
  27. ZheNing HuJul 4, 2021
  28. Ævar Arnfjörð BjarmasonJul 5, 2021
  29. 10/15 [GSOC] cat-file: add has_object_file() checkZheNing Hu via GitGitGadget, Jul 1, 2021
  30. Ævar Arnfjörð BjarmasonJul 2, 2021
  31. ZheNing HuJul 3, 2021
  32. 13/15 [GSOC] cat-file: reuse err buf in batch_object_write()ZheNing Hu via GitGitGadget, Jul 1, 2021
  33. 14/15 [GSOC] cat-file: re-implement --textconv, --filters optionsZheNing Hu via GitGitGadget, Jul 1, 2021
  34. Junio C HamanoJul 1, 2021
  35. Junio C HamanoJul 1, 2021
  36. ZheNing HuJul 2, 2021
  37. Junio C HamanoJul 2, 2021
  38. ZheNing HuJul 3, 2021
  39. 15/15 [GSOC] ref-filter: remove grab_oid() functionZheNing Hu via GitGitGadget, Jul 1, 2021

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.