Re: [PATCH 0/3] cat-file: add %(objectmode) avoid verifying submodules' OIDs
- From
Jeff King <peff@peff.net>
- Date
- Mar 12, 2024, 22:03 UTC
- Message-ID
- <20240312220341.GA106249@coredump.intra.peff.net>
- In-Reply-To
- <xmqq1q8fl05r.fsf@gitster.g>
On Tue, Mar 12, 2024 at 12:28:48PM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> > Or if you wanted to mix-and-match with other cat-file placeholders, you > > can do: > > > > git ls-tree --format='%(objectname) %(objectmode)' HEAD | > > git cat-file --batch-check='%(objectname) %(deltabase) %(rest)' > > > > That is a little less efficient (we look up the object twice), but once > > you are working with hex object ids it is not too bad (cat-file is > > heavily optimized here). Of course in the long run I think we should > > move to a future where the formatting code is shared, and you can just > > ask ls-tree for deltabase if you want to. > > I was imagining more about a use case "cat-file --batch" was > originally designed for---having a long-running single process > and ask any and all questions you have about various objects in the > object database by interacting with it. So "yes, ls-tree can > already give us that information", while it is true, shoots at a > different direction from what I had in mind.
Ah, yeah, that is one thing that cat-file does that no other part of the system will. I do wonder in the long term if it is easier to teach cat-file everything that all of the other commands can do, or to teach all of the other commands some way of handling multiple requests in a single process. ;)
(All obviously orthogonal to this patch series).
-Peff