On Wed, Jan 17, 2018 at 10:43 PM, Jeff King <peff@xxxxxxxx> wrote: > On Tue, Jan 16, 2018 at 09:55:22AM +0300, Оля Тележная wrote: > >> > IOW, the progression I'd expect in a series like this is: >> > >> > 1. Teach ref-filter.c to support everything that cat-file can do. >> > >> > 2. Convert cat-file to use ref-filter.c. >> >> I agree, I even made this and it's working fine: >> https://github.com/git/git/pull/450/commits/1b74f1047f07434dccb207534d1ad45a143e3f2b (Nit: it looks like the above link does not work any more, but it seems that you are talking about the last patch on the catfile branch.) >> But I decided not to add that to patch because I expand the >> functionality of several commands (not only cat-file and >> for-each-ref), and I need to support all new functionality in a proper >> way, make these error messages, test everything and - the hardest one >> - support many new commands for cat-file. As I understand, it is not >> possible unless we finally move to ref-filter and print results also >> there. Oh, and I also need to rewrite docs in that case. And I decided >> to apply this in another patch. But, please, say your opinion, maybe >> we could do that here in some way. > > Yeah, I agree that it will cause changes to other users of ref-filter, > and you'd need to deal with documentation and tests there. But I think > we're going to have to do those things eventually (since supporting > those extra fields everywhere is part of the point of the project). And > by doing them now, I think it can make the transition for cat-file a lot > simpler, because we never have to puzzle over this intermediate state > where only some of the atoms are valid for cat-file. I agree that you will have to deal with documentation and tests at one point and that it could be a good idea to do that now. I wonder if it is possible to add atoms one by one into ref-filter and to add tests and documentation at the same time, instead of merging cat-file atoms with ref-filter atoms in one big step. When all the cat-file atoms have been added to ref-filter's valid_atom, maybe you could add ref-filter's atoms to cat-file's valid_cat_file_atom one by one and add tests and documentation at the same time. And then when ref-filter's valid_atom and cat-file's valid_cat_file_atom are identical you can remove cat-file's valid_cat_file_atom and maybe after that rename "ref-filter" to "format".