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

Re: [PATCH 2/2] [GSOC] ref-filter: add %(header) atom

From
ZheNing Hu <adlternative@gmail.com>
Date
May 28, 2021, 15:19 UTC
Message-ID
<CAOLTT8SDHK-e6ReErs80bFh+2nQA_v5Z095XeNiXe4dDQEd3-w@mail.gmail.com>
In-Reply-To
<xmqqpmxb79v8.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年5月28日周五 下午12:36写道:
Show 19 quoted lines
>
> "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> >               struct {
> >                       enum { RAW_BARE, RAW_LENGTH } option;
> >               } raw_data;
> > +             struct {
> > +                     enum { H_BARE, H_LENGTH } option;
> > +             } header;
>
> Raw does not use R_{BARE,LENGTH} and uses raw_data member.  Header
> should follow suit unless there is a compelling reason not to, no?
>
>                 struct {
>                         enum { HEADER_BARE, HEADER_LENGTH } option;
>                 } header_data;
>
> perhaps?
>
OK.
Show 17 quoted lines
> > @@ -1372,6 +1389,15 @@ static void grab_raw_data(struct atom_value *val, int deref, void *buf, unsigned
> >                                   &bodypos, &bodylen, &nonsiglen,
> >                                   &sigpos, &siglen);
> >
> > +             if (starts_with(name, "header")) {
> > +                     size_t header_len = subpos - (const char *)buf - 1;
>
> Hmph, is this correct?  I would expect that the "header" part of a
> commit or a tag object excludes the blank line after the header
> fields.  In other words, the "header" would be separated by a blank
> line from the "body", and that separating blank line is not part of
> "header" or "body".
>
> Otherwise, if there is a user of %(header), it needs to be coded to
> ignore the last blank line but has to diagnose it as an error if
> there is a blank line before that.
>
I am a bit confused, Is there any problem with me doing this?
> > +                     size_t header_len = subpos - (const char *)buf - 1;

"header" part starts from "buf" and header_len have minus 1 so that header part will not touch the blank line. At the same time, "contents" part starts from subpos, and it also does not touch the blank line.

> While having this may not be wrong, I am not sure who needs it.  Is
> your "cat-file --batch" topic needs this new atom?
Ok, I will remove it from this topic temporarily.

Thanks. -- ZheNing Hu

Previous: Junio C HamanoNext: Felipe Contreras
Message 24 of 41 in “[GSOC] ref-filter: add %(raw) atom”
  1. 0/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 27, 2021
  2. 1/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 27, 2021
  3. Felipe ContrerasMay 27, 2021
  4. ZheNing HuMay 28, 2021
  5. Felipe ContrerasMay 28, 2021
  6. ZheNing HuMay 30, 2021
  7. Phillip WoodMay 29, 2021
  8. Felipe ContrerasMay 29, 2021
  9. Phillip WoodMay 29, 2021
  10. ZheNing HuMay 30, 2021
  11. Phillip WoodMay 30, 2021
  12. ZheNing HuMay 31, 2021
  13. Felipe ContrerasMay 31, 2021
  14. ZheNing HuMay 30, 2021
  15. Phillip WoodMay 30, 2021
  16. Junio C HamanoMay 28, 2021
  17. ZheNing HuMay 28, 2021
  18. Felipe ContrerasMay 28, 2021
  19. ZheNing HuMay 30, 2021
  20. 2/2 [GSOC] ref-filter: add %(header) atomZheNing Hu via GitGitGadget, May 27, 2021
  21. Felipe ContrerasMay 27, 2021
  22. Junio C HamanoMay 28, 2021
  23. Junio C HamanoMay 28, 2021
  24. ZheNing HuMay 28, 2021
  25. Felipe ContrerasMay 27, 2021
  26. 0/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 30, 2021
  27. 1/2 [GSOC] ref-filter: add obj-type check in grab contentsZheNing Hu via GitGitGadget, May 30, 2021
  28. Junio C HamanoMay 31, 2021
  29. 2/2 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, May 30, 2021
  30. Junio C HamanoMay 31, 2021
  31. ZheNing HuMay 31, 2021
  32. Junio C HamanoJun 1, 2021
  33. ZheNing HuJun 1, 2021
  34. Junio C HamanoMay 31, 2021
  35. ZheNing HuMay 31, 2021
  36. Junio C HamanoJun 1, 2021
  37. ZheNing HuJun 1, 2021
  38. Johannes SchindelinJun 1, 2021
  39. Junio C HamanoMay 31, 2021
  40. Felipe ContrerasMay 31, 2021
  41. ZheNing HuJun 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.