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

[PATCH 00/10] object-file API: pass object enums, tidy up streaming interface

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 1, 2022, 14:53 UTC
Message-ID
<cover-00.10-00000000000-20220201T144803Z-avarab@gmail.com>

This is intended to help along the "unpack large blobs in stream" series that Han Xin has been submitting. The v9 of it is available at[1], but not currently picked up by Junio.

This changes those parts of the object-file.c API that took a "const char *" type to take an "enum object_type" instead. We had a lot of places that would convert back & forth between the two for no good reason. We're still left with the "literally" interface for "git hash-object --literally", but it's now a tiny part of the API that's sidelined.

This also has various small API cleanups, such as returning "void" in a case where no caller did (or should) use a return value in the case of hash_object_file().

We then introduce the format_object_header() helper, part of that was in Han Xin's version, but we had various other in-tree users that could use it (which I found later, after my initial RFC patch).

We can then split up the two classes of API users of check_object_signature() to use two different functions, which suits their uses much better. Half of them were making use of a very early return.

1. https://lore.kernel.org/git/20220120112114.47618-1-chiyutianyi@gmail.com/
Ævar Arnfjörð Bjarmason (10):
  object-file.c: split up declaration of unrelated variables
  object-file API: return "void", not "int" from hash_object_file()
  object-file API: add a format_object_header() function
  object-file API: have write_object_file() take "enum object_type"
  object-file API: provide a hash_object_file_oideq()
  object-file API: replace some use of check_object_signature()
  object-file API: have hash_object_file() take "enum object_type"
  object-file API: replace check_object_signature() with stream_*
  object-file.c: add a literal version of write_object_file_prepare()
  object-file API: pass an enum to read_object_with_reference()
 apply.c                  |  12 ++--
 builtin/cat-file.c       |  11 +--
 builtin/checkout.c       |   2 +-
 builtin/fast-export.c    |   4 +-
 builtin/fast-import.c    |  12 ++--
 builtin/grep.c           |   4 +-
 builtin/hash-object.c    |   4 +-
 builtin/index-pack.c     |  10 ++-
 builtin/mktag.c          |   7 +-
 builtin/mktree.c         |   2 +-
 builtin/notes.c          |   3 +-
 builtin/pack-objects.c   |   2 +-
 builtin/receive-pack.c   |   2 +-
 builtin/replace.c        |   4 +-
 builtin/tag.c            |   2 +-
 builtin/unpack-objects.c |   8 +--
 bulk-checkin.c           |   4 +-
 cache-tree.c             |   8 +--
 cache.h                  |  13 ++--
 commit.c                 |   2 +-
 convert.c                |   2 +-
 diffcore-rename.c        |   2 +-
 dir.c                    |   2 +-
 http-push.c              |   2 +-
 log-tree.c               |   2 +-
 match-trees.c            |   2 +-
 merge-ort.c              |   4 +-
 merge-recursive.c        |   2 +-
 notes-cache.c            |   2 +-
 notes.c                  |   8 +--
 object-file.c            | 142 ++++++++++++++++++++++++++-------------
 object-store.h           |  39 ++++++++---
 object.c                 |   6 +-
 pack-check.c             |   8 ++-
 read-cache.c             |   2 +-
 tree-walk.c              |   6 +-
 36 files changed, 213 insertions(+), 134 deletions(-)
-- 
2.35.0.913.g12b4baa2536
Next: Ævar Arnfjörð Bjarmason
Message 1 of 46 in “object-file API: pass object enums, tidy up streaming interface”
  1. 00/10 object-file API: pass object enums, tidy up streaming interfaceÆvar Arnfjörð Bjarmason, Feb 1, 2022
  2. 01/10 object-file.c: split up declaration of unrelated variablesÆvar Arnfjörð Bjarmason, Feb 1, 2022
  3. 02/10 object-file API: return "void", not "int" from hash_object_file()Ævar Arnfjörð Bjarmason, Feb 1, 2022
  4. 03/10 object-file API: add a format_object_header() functionÆvar Arnfjörð Bjarmason, Feb 1, 2022
  5. 04/10 object-file API: have write_object_file() take "enum object_type"Ævar Arnfjörð Bjarmason, Feb 1, 2022
  6. Junio C HamanoFeb 1, 2022
  7. 05/10 object-file API: provide a hash_object_file_oideq()Ævar Arnfjörð Bjarmason, Feb 1, 2022
  8. Junio C HamanoFeb 1, 2022
  9. Ævar Arnfjörð BjarmasonFeb 1, 2022
  10. 06/10 object-file API: replace some use of check_object_signature()Ævar Arnfjörð Bjarmason, Feb 1, 2022
  11. Junio C HamanoFeb 1, 2022
  12. 08/10 object-file API: replace check_object_signature() with stream_*Ævar Arnfjörð Bjarmason, Feb 1, 2022
  13. 07/10 object-file API: have hash_object_file() take "enum object_type"Ævar Arnfjörð Bjarmason, Feb 1, 2022
  14. 09/10 object-file.c: add a literal version of write_object_file_prepare()Ævar Arnfjörð Bjarmason, Feb 1, 2022
  15. 10/10 object-file API: pass an enum to read_object_with_reference()Ævar Arnfjörð Bjarmason, Feb 1, 2022
  16. 00/11 object-file API: pass object enums, tidy up streaming interfaceÆvar Arnfjörð Bjarmason, Feb 4, 2022
  17. 02/11 object-file API: return "void", not "int" from hash_object_file()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  18. 03/11 object-file API: add a format_object_header() functionÆvar Arnfjörð Bjarmason, Feb 4, 2022
  19. 04/11 object-file API: have write_object_file() take "enum object_type"Ævar Arnfjörð Bjarmason, Feb 4, 2022
  20. Junio C HamanoFeb 4, 2022
  21. 01/11 object-file.c: split up declaration of unrelated variablesÆvar Arnfjörð Bjarmason, Feb 4, 2022
  22. 05/11 object API: correct "buf" v.s. "map" mismatch in *.c and *.hÆvar Arnfjörð Bjarmason, Feb 4, 2022
  23. Junio C HamanoFeb 4, 2022
  24. 06/11 object API: make check_object_signature() oideq()-like, move docsÆvar Arnfjörð Bjarmason, Feb 4, 2022
  25. Junio C HamanoFeb 4, 2022
  26. 07/11 object-file API: split up and simplify check_object_signature()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  27. 08/11 object API: rename hash_object_file_literally() to write_*()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  28. 09/11 object-file API: have hash_object_file() take "enum object_type"Ævar Arnfjörð Bjarmason, Feb 4, 2022
  29. 10/11 object-file.c: add a literal version of write_object_file_prepare()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  30. 11/11 object-file API: pass an enum to read_object_with_reference()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  31. 00/12 object-file API: pass object enums, tidy up streaming interfaceÆvar Arnfjörð Bjarmason, Feb 4, 2022
  32. 01/12 object-file.c: split up declaration of unrelated variablesÆvar Arnfjörð Bjarmason, Feb 4, 2022
  33. 02/12 object-file API: return "void", not "int" from hash_object_file()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  34. 03/12 object-file API: add a format_object_header() functionÆvar Arnfjörð Bjarmason, Feb 4, 2022
  35. Jiang XinFeb 17, 2022
  36. Ævar Arnfjörð BjarmasonFeb 17, 2022
  37. Jiang XinMar 1, 2022
  38. 04/12 object-file API: have write_object_file() take "enum object_type"Ævar Arnfjörð Bjarmason, Feb 4, 2022
  39. 05/12 object API: correct "buf" v.s. "map" mismatch in *.c and *.hÆvar Arnfjörð Bjarmason, Feb 4, 2022
  40. 06/12 object API docs: move check_object_signature() docs to cache.hÆvar Arnfjörð Bjarmason, Feb 4, 2022
  41. 09/12 object API: rename hash_object_file_literally() to write_*()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  42. 08/12 object-file API: split up and simplify check_object_signature()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  43. 07/12 object API users + docs: check <0, not !0 with check_object_signature()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  44. 10/12 object-file API: have hash_object_file() take "enum object_type"Ævar Arnfjörð Bjarmason, Feb 4, 2022
  45. 12/12 object-file API: pass an enum to read_object_with_reference()Ævar Arnfjörð Bjarmason, Feb 4, 2022
  46. 11/12 object-file.c: add a literal version of write_object_file_prepare()Ævar Arnfjörð Bjarmason, Feb 4, 2022

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.