From: Ævar Arnfjörð Bjarmason Date: Tue, 23 Nov 2021 02:28:15 GMT Subject: Re: [PATCH v3 1/1] ls-tree.c: support `--oid-only` option for "git-ls-tree" Message-ID: <211123.868rxfwqdw.gmgdl@evledraar.gmail.com> In-Reply-To: On Mon, Nov 22 2021, Junio C Hamano wrote: > Ævar Arnfjörð Bjarmason writes: > >> All of which (and more) would also be addressed in an obvious way by >> just supporting --format as I suggested in >> https://lore.kernel.org/git/211115.86o86lqe3c.gmgdl@evledraar.gmail.com/; >> don't you think that's a better approach? > > That is what I would call over-engineering that I would rather not > to have in low level plumbing. > > I am all for making _parsing_ the output from the tool easier by > scripts; I am not interested in eliminating the _output_ by scripts. > They should capture and format the pieces we output in any way they > want. > > So, no, I do not think it is a better approach at all. We've got --format for for-each-ref and family (also branch etc.), and for the "log" family. I'm not sure I understand what you're saying, do you think if we could go back and change it that the "FIELD NAMES" in git-for-each-ref (which is plumbing) would have been better done as --field-name=refname,objecttype,... etc? Having used it extensively it's been very hard to have the flexibility of formatting, e.g. to specify arbitrary delimiters. It also leaves the door open to teaching ls-tree etc. the %(if) syntax in the ref-filter, e.g. if you'd like to only print out certain data for certain object types or whatever.