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

Re: [PATCH 1/2] [GSOC] cat-file: fix --batch report changed-type bug

From
ZheNing Hu <adlternative@gmail.com>
Date
Jun 3, 2021, 06:28 UTC
Message-ID
<CAOLTT8QHm5xXPJ2fb70f9gH2Hk2gjbAHCHyvm94KB5n1beCE8A@mail.gmail.com>
In-Reply-To
<YLfjexczp1/HILWj@coredump.intra.peff.net>
Jeff King <peff@peff.net> 于2021年6月3日周四 上午4:01写道:
Show 5 quoted lines
>
> I don't see any inaccuracies there. I do think we could explain it a bit
> more succinctly. I'll give my attempt, and then you can pick and choose
> which parts to include between ours. :)
>

Yes, you wrote it more concisely. I don't need to write out the details of those variables. I just need to tell the reader the introduction of skip_object_info will break the assumption of --batch that we have found the object type.

Show 23 quoted lines
>   Subject: cat-file: handle trivial --batch format with --batch-all-objects
>
>   The --batch code to print an object assumes we found out the type of
>   the object from calling oid_object_info_extended(). This is true for
>   the default format, but even in a custom format, we manually modify
>   the object_info struct to ask for the type.
>
>   This assumption was broken by 845de33a5b (cat-file: avoid noop calls
>   to sha1_object_info_extended, 2016-05-18). That commit skips the call
>   to oid_object_info_extended() entirely when --batch-all-objects is in
>   use, and the custom format does not include any placeholders that
>   require calling it.
>
>   This results in an error when we try to confirm that the type didn't
>   change:
>
>     $ git cat-file --batch=batman --batch-all-objects
>     batman
>     fatal: object 000023961a0c02d6e21dc51ea3484ff71abf1c74 changed type!?
>
>   and also has other subtle effects (e.g., we'd fail to stream a blob,
>   since we don't realize it's a blog in the first place).
>
s/blog/blob/
Show 5 quoted lines
>   We can fix this by flipping the order of the setup. The check for "do
>   we need to get the object info" must come _after_ we've decided
>   whether we need to look up the type.
>
> -Peff

Thanks. -- ZheNing Hu

Previous: Jeff KingNext: ZheNing Hu
Message 6 of 16 in “[GSOC] cat-file: fix --batch report changed-type bug”
  1. 0/2 [GSOC] cat-file: fix --batch report changed-type bugZheNing Hu via GitGitGadget, Jun 1, 2021
  2. 1/2 [GSOC] cat-file: fix --batch report changed-type bugZheNing Hu via GitGitGadget, Jun 1, 2021
  3. Jeff KingJun 1, 2021
  4. ZheNing HuJun 2, 2021
  5. Jeff KingJun 2, 2021
  6. ZheNing HuJun 3, 2021
  7. ZheNing HuJun 3, 2021
  8. Jeff KingJun 3, 2021
  9. 2/2 [GSOC] cat-file: merge two block into oneZheNing Hu via GitGitGadget, Jun 1, 2021
  10. Jeff KingJun 1, 2021
  11. ZheNing HuJun 2, 2021
  12. 0/2 [GSOC] cat-file: fix --batch report changed-type bugZheNing Hu via GitGitGadget, Jun 3, 2021
  13. 1/2 [GSOC] cat-file: handle trivial --batch format with --batch-all-objectsZheNing Hu via GitGitGadget, Jun 3, 2021
  14. 2/2 [GSOC] cat-file: merge two block into oneZheNing Hu via GitGitGadget, Jun 3, 2021
  15. Jeff KingJun 3, 2021
  16. Junio C HamanoJun 3, 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.