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

Re: [PATCH 2/5] cat-file: mention --unordered along with --batch-all-objects

From
Jeff King <peff@peff.net>
Date
Oct 8, 2021, 21:44 UTC
Message-ID
<YWC7rF4mpU9W6CbI@coredump.intra.peff.net>
In-Reply-To
<xmqqo87zjlwt.fsf@gitster.g>
On Fri, Oct 08, 2021 at 01:34:26PM -0700, Junio C Hamano wrote:
Show 27 quoted lines
> >> So I don't think OPT_CMDMODE could ever present this complete set of
> >> rules, because they are not all mutually exclusive with each other. But
> >> I think calling "--batch-all-objects" a mode is just muddying the waters
> >> even further.
> >
> > I think we've got some different understanding of what a CMDMODE
> > means. --batch-all-objects should be a cmdmode, but --batch, --buffer
> > etc. can't be. Similarly it's not a bug that --filters and --textconv
> > are cmdmodes, but you think that's bad.
> 
> Among options[] elements, "batch" and "batch-check" take &batch, and
> they are obviously mutually exclusive.  "batch-all-objects" can flip
> the batch.all_objects flag to affect operations that use &batch
> (namely, these two), so it is more like a modifier and can never be
> a cmdmode.
> 
> Is "git cat-file -t tag --batch" a valid way to invoke the command?
> Are there options (like "-t" in the above example) that are marked
> with OPT_CMDMODE that can be used with "--batch" or "--batch-check"?
> 
> If the answer is "no", then "--batch" and "--batch-check" could also
> be command modes, but I suspect OPT_CMDMODE() does not have enough
> flexibility to say "use the &opt to record which command mode is
> requested, and by the way, there is this extra pointer &batch to
> stuff necessary information in and use this callback to fill it", so
> even if "--batch" and "--batch-check" are incompatible with existing
> command modes, it needs a bit or preparatory work to make them.

Yes, it would definitely need that extension. But it's also weirder than that. --textconv is an OPT_CMDMODE(), because it is mutually exclusive with "-t", etc. But it is not exclusive with "--batch". So there is not a single set of mutually exclusive cmdmodes. There are three sets:

  1. single-object options like "-t", "-p", etc
  2. --textconv and --filters, which can take a single object or batch
     input
  3. batch options like --batch-check --batch

(1) is mutually exclusive with (2) and (3), but the latter two are not exclusive with each other.

The current code uses OPT_CMDMODE() for (1) and (2), and then manually enforces the exclusion between (1) and (3). But IMHO it is (2) that is the odd-man out, in that it can be its own mode or a modifier, and it probably should not be OPT_CMDMODE() (but from the end-user perspective, that is OK, though it may influence how we document or group things).

I do not think talking about --batch-all-objects makes sense here. As you said above (and I said already several times), it is a modifier for --batch/--batch-check. Making it into a CMDMODE does not break anything (currently), but:

  - it does not really help; it only makes sense with batch options, and
    we already must manually catch those interacting with single-object
    options (because making them OPT_CMDMODE does not work for the
    reasons above).
  - if we _were_ to make the batch options CMDMODEs, then it would be
    doing the wrong thing (though I don't foresee that happening because
    of those same reasons)
  - if we allowed "--textconv --batch --batch-all-objects", then it
    would likewise do the wrong thing (by conflicting with --textconv's
    CMDMODE). We disallow that now, but it is a potentially well-formed
    request (show all objects, textconv-ing blobs). It's not useful
    enough for anybody to have cared, but I think it shows why the
    semantic distinction of treating --batch-all-objects as a
    batch-option and not itself a mode is important.
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 101 in “cat-file replace handling and optimization”
  1. 0/5 cat-file replace handling and optimizationJeff King, Oct 5, 2021
  2. 1/5 t1006: clean up broken objectsJeff King, Oct 5, 2021
  3. 2/5 cat-file: mention --unordered along with --batch-all-objectsJeff King, Oct 5, 2021
  4. Ævar Arnfjörð BjarmasonOct 5, 2021
  5. Jeff KingOct 5, 2021
  6. Ævar Arnfjörð BjarmasonOct 6, 2021
  7. Jeff KingOct 6, 2021
  8. Ævar Arnfjörð BjarmasonOct 7, 2021
  9. Jeff KingOct 8, 2021
  10. Ævar Arnfjörð BjarmasonOct 8, 2021
  11. Junio C HamanoOct 8, 2021
  12. Jeff KingOct 8, 2021
  13. Junio C HamanoOct 8, 2021
  14. 00/10 cat-file: better usage UX & error messagesÆvar Arnfjörð Bjarmason, Nov 6, 2021
  15. 01/10 cat-file tests: test bad usageÆvar Arnfjörð Bjarmason, Nov 6, 2021
  16. Eric SunshineNov 7, 2021
  17. 02/10 cat-file tests: test messaging on bad objects/pathsÆvar Arnfjörð Bjarmason, Nov 6, 2021
  18. 03/10 parse-options API: add a usage_msg_optf()Ævar Arnfjörð Bjarmason, Nov 6, 2021
  19. 04/10 cat-file docs: fix SYNOPSIS and "-h" outputÆvar Arnfjörð Bjarmason, Nov 6, 2021
  20. 05/10 cat-file: move "usage" variable to cmd_cat_file()Ævar Arnfjörð Bjarmason, Nov 6, 2021
  21. 06/10 cat-file: make --batch-all-objects a CMDMODEÆvar Arnfjörð Bjarmason, Nov 6, 2021
  22. Eric SunshineNov 7, 2021
  23. 07/10 cat-file: fix remaining usage bugsÆvar Arnfjörð Bjarmason, Nov 6, 2021
  24. 08/10 cat-file: correct and improve usage informationÆvar Arnfjörð Bjarmason, Nov 6, 2021
  25. 09/10 object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLYÆvar Arnfjörð Bjarmason, Nov 6, 2021
  26. Eric SunshineNov 7, 2021
  27. 10/10 cat-file: improve --(textconv|filters) disambiguationÆvar Arnfjörð Bjarmason, Nov 6, 2021
  28. 00/10 cat-file: better usage UX & error messagesÆvar Arnfjörð Bjarmason, Nov 12, 2021
  29. 01/10 cat-file tests: test bad usageÆvar Arnfjörð Bjarmason, Nov 12, 2021
  30. 04/10 cat-file docs: fix SYNOPSIS and "-h" outputÆvar Arnfjörð Bjarmason, Nov 12, 2021
  31. 03/10 parse-options API: add a usage_msg_optf()Ævar Arnfjörð Bjarmason, Nov 12, 2021
  32. 02/10 cat-file tests: test messaging on bad objects/pathsÆvar Arnfjörð Bjarmason, Nov 12, 2021
  33. 05/10 cat-file: move "usage" variable to cmd_cat_file()Ævar Arnfjörð Bjarmason, Nov 12, 2021
  34. 06/10 cat-file: make --batch-all-objects a CMDMODEÆvar Arnfjörð Bjarmason, Nov 12, 2021
  35. 07/10 cat-file: fix remaining usage bugsÆvar Arnfjörð Bjarmason, Nov 12, 2021
  36. 08/10 cat-file: correct and improve usage informationÆvar Arnfjörð Bjarmason, Nov 12, 2021
  37. 09/10 object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLYÆvar Arnfjörð Bjarmason, Nov 12, 2021
  38. 10/10 cat-file: improve --(textconv|filters) disambiguationÆvar Arnfjörð Bjarmason, Nov 12, 2021
  39. 00/10 cat-file: better usage UX & error messagesÆvar Arnfjörð Bjarmason, Nov 29, 2021
  40. 02/10 cat-file tests: test messaging on bad objects/pathsÆvar Arnfjörð Bjarmason, Nov 29, 2021
  41. 01/10 cat-file tests: test bad usageÆvar Arnfjörð Bjarmason, Nov 29, 2021
  42. 03/10 parse-options API: add a usage_msg_optf()Ævar Arnfjörð Bjarmason, Nov 29, 2021
  43. 04/10 cat-file docs: fix SYNOPSIS and "-h" outputÆvar Arnfjörð Bjarmason, Nov 29, 2021
  44. 05/10 cat-file: move "usage" variable to cmd_cat_file()Ævar Arnfjörð Bjarmason, Nov 29, 2021
  45. 06/10 cat-file: make --batch-all-objects a CMDMODEÆvar Arnfjörð Bjarmason, Nov 29, 2021
  46. 07/10 cat-file: fix remaining usage bugsÆvar Arnfjörð Bjarmason, Nov 29, 2021
  47. Jiang XinDec 6, 2021
  48. 10/10 cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)Ævar Arnfjörð Bjarmason, Nov 29, 2021
  49. 09/10 object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLYÆvar Arnfjörð Bjarmason, Nov 29, 2021
  50. 08/10 cat-file: correct and improve usage informationÆvar Arnfjörð Bjarmason, Nov 29, 2021
  51. 00/10 cat-file: better usage UX & error messagesÆvar Arnfjörð Bjarmason, Dec 8, 2021
  52. 01/10 cat-file tests: test bad usageÆvar Arnfjörð Bjarmason, Dec 8, 2021
  53. 02/10 cat-file tests: test messaging on bad objects/pathsÆvar Arnfjörð Bjarmason, Dec 8, 2021
  54. 04/10 cat-file docs: fix SYNOPSIS and "-h" outputÆvar Arnfjörð Bjarmason, Dec 8, 2021
  55. 03/10 parse-options API: add a usage_msg_optf()Ævar Arnfjörð Bjarmason, Dec 8, 2021
  56. 05/10 cat-file: move "usage" variable to cmd_cat_file()Ævar Arnfjörð Bjarmason, Dec 8, 2021
  57. 06/10 cat-file: make --batch-all-objects a CMDMODEÆvar Arnfjörð Bjarmason, Dec 8, 2021
  58. 07/10 cat-file: fix remaining usage bugsÆvar Arnfjörð Bjarmason, Dec 8, 2021
  59. John CaiDec 20, 2021
  60. 08/10 cat-file: correct and improve usage informationÆvar Arnfjörð Bjarmason, Dec 8, 2021
  61. 09/10 object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLYÆvar Arnfjörð Bjarmason, Dec 8, 2021
  62. 10/10 cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)Ævar Arnfjörð Bjarmason, Dec 8, 2021
  63. 00/10 cat-file: better usage UX & error messagesÆvar Arnfjörð Bjarmason, Dec 22, 2021
  64. 02/10 cat-file tests: test messaging on bad objects/pathsÆvar Arnfjörð Bjarmason, Dec 22, 2021
  65. 01/10 cat-file tests: test bad usageÆvar Arnfjörð Bjarmason, Dec 22, 2021
  66. 03/10 parse-options API: add a usage_msg_optf()Ævar Arnfjörð Bjarmason, Dec 22, 2021
  67. 04/10 cat-file docs: fix SYNOPSIS and "-h" outputÆvar Arnfjörð Bjarmason, Dec 22, 2021
  68. 05/10 cat-file: move "usage" variable to cmd_cat_file()Ævar Arnfjörð Bjarmason, Dec 22, 2021
  69. 06/10 cat-file: make --batch-all-objects a CMDMODEÆvar Arnfjörð Bjarmason, Dec 22, 2021
  70. 07/10 cat-file: fix remaining usage bugsÆvar Arnfjörð Bjarmason, Dec 22, 2021
  71. Junio C HamanoDec 26, 2021
  72. 10/10 cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)Ævar Arnfjörð Bjarmason, Dec 22, 2021
  73. 08/10 cat-file: correct and improve usage informationÆvar Arnfjörð Bjarmason, Dec 22, 2021
  74. 09/10 object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLYÆvar Arnfjörð Bjarmason, Dec 22, 2021
  75. 00/10 cat-file: better usage UX & error messagesÆvar Arnfjörð Bjarmason, Dec 28, 2021
  76. 01/10 cat-file tests: test bad usageÆvar Arnfjörð Bjarmason, Dec 28, 2021
  77. 02/10 cat-file tests: test messaging on bad objects/pathsÆvar Arnfjörð Bjarmason, Dec 28, 2021
  78. 03/10 parse-options API: add a usage_msg_optf()Ævar Arnfjörð Bjarmason, Dec 28, 2021
  79. 04/10 cat-file docs: fix SYNOPSIS and "-h" outputÆvar Arnfjörð Bjarmason, Dec 28, 2021
  80. 05/10 cat-file: move "usage" variable to cmd_cat_file()Ævar Arnfjörð Bjarmason, Dec 28, 2021
  81. 07/10 cat-file: fix remaining usage bugsÆvar Arnfjörð Bjarmason, Dec 28, 2021
  82. 08/10 cat-file: correct and improve usage informationÆvar Arnfjörð Bjarmason, Dec 28, 2021
  83. Jiang XinJan 8, 2022
  84. 0/2 fixups for issues in next-merged ab/cat-fileÆvar Arnfjörð Bjarmason, Jan 10, 2022
  85. 1/2 cat-file: don't whitespace-pad "(...)" in SYNOPSIS and usage outputÆvar Arnfjörð Bjarmason, Jan 10, 2022
  86. 2/2 cat-file: s/_/-/ in typo'd usage_msg_optf() messageÆvar Arnfjörð Bjarmason, Jan 10, 2022
  87. Junio C HamanoJan 10, 2022
  88. Taylor BlauJan 11, 2022
  89. Junio C HamanoJan 12, 2022
  90. 09/10 object-name.c: don't have GET_OID_ONLY_TO_DIE imply *_QUIETLYÆvar Arnfjörð Bjarmason, Dec 28, 2021
  91. 10/10 cat-file: use GET_OID_ONLY_TO_DIE in --(textconv|filters)Ævar Arnfjörð Bjarmason, Dec 28, 2021
  92. 06/10 cat-file: make --batch-all-objects a CMDMODEÆvar Arnfjörð Bjarmason, Dec 28, 2021
  93. 3/5 cat-file: disable refs/replace with --batch-all-objectsJeff King, Oct 5, 2021
  94. Derrick StoleeOct 6, 2021
  95. Junio C HamanoOct 7, 2021
  96. 4/5 cat-file: split ordered/unordered batch-all-objects callbacksJeff King, Oct 5, 2021
  97. 5/5 cat-file: use packed_object_info() for --batch-all-objectsJeff King, Oct 5, 2021
  98. Junio C HamanoOct 7, 2021
  99. Jeff KingOct 8, 2021
  100. Derrick StoleeOct 6, 2021
  101. Jeff KingOct 7, 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.