On Fri, Jul 1, 2022 at 1:39 AM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > On Thu, Jun 30 2022, Siddharth Asthana wrote: > > > git cat-file is not a plumbing command anymore, especially as it gained > > more and more high level features like its `--batch-command` mode. So > > tools do use it to get commit and tag contents that are then displayed > > to users. This content which has author, committer or tagger > > information, could benefit from passing through the mailmap mechanism, > > before being sent or displayed. > > > > This patch adds --[no-]use-mailmap command line option to the git > > cat-file command. It also adds --[no-]mailmap option as an alias to > > --[no-]use-mailmap. > > I think I know the answer, but I think it would be helpful to discuss > the underlying motivations too. I.e. an obvious alternative is "why not > just get this information out of git show/log then?". > > The "I think I know the answer" being that I suspect this is to cater to > gitaly having persistent "cat-file" processes around, whereas for "git > log" it would entail spinning up a new process per-request. > > But maybe I'm missing something :) No, you are not missing anything :) > So not as a blocker for this change, which I think can be made small > enough to be justified in cat-file, but just for context: If "git log" > had a similar --batch mode, would there be a need for this change, One nice thing with `git cat-file` is that it works for any kind of git object. But yeah we could perhaps use `git show` if it had a --batch mode, or a mix of `git cat-file` for blobs and trees, and `git log --batch` for commits and tag objects. > or is > this just adding a common case to "cat-file" to "tide us over" (as it > were) while that sort of thing doesn't exist yet (and maybe never will > :()? By the way there have been 2 GSoC contributors working on adding ref-filter formating support to `git cat-file` and that hasn't succeeded yet, mostly for performance reasons. So another way would be to wait until ref-filter formats support everything that pretty formats support, which Jaydeep is currently working on, including %aN (author name respecting .mailmap) and %aE (author email respecting .mailmap), and then wait until `git cat-file`'s --batch formats support ref-filter formats. But yeah, we hope the change can be made small enough to be justified in cat-file.