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 > 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 also agree that moving cat-file's printing over to ref-filter.c is going to introduce a lot of corner cases (like the behavior when somebody does "cat-file --batch-check=%(refname)" with a bare sha1). But I think a progression of patches handling those cases would be pretty easy to follow. E.g., I'd expect to see a patch that teaches ref-filter[1] how to handle callers that don't have a ref, but just a bare object name. And it would be easier to evaluate that on its own, because we know that's an end state we're going to have to handle, and not some funny state created as part of the transition. -Peff [1] And here's where we might start to think about calling it something besides ref-filter, if we don't necessarily have a ref. :)