Re: [PATCHv3 3/7] show: honor --textconv for blobs
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:14
Michael J Gruber [off-list ref] writes:
But you do have the possibility to use different drivers for diff and show. For example, for showing a file some sort of automatic pagination or line numbering can be helpful whereas it would hurt the diff case.
I do not find the example convincing (yet); it looks more like you are grasping for straws. You would certainly do not want "line numbering" in grep. My gut feeling is that normal users would expect to have a single "text version" and pass that to "pr" (if they want pagination) or "cat -n" (if they want line numbering), regardless of where it comes from, be it "git show --textconv" or some other program output, but you seem to want to have different "text version"s for different purposes out of a single binary file....
I strongly disagree here. I have textconv filters for pdf, gpg, odf, xls, doc, xoj... I know, ugly. At least some of them would benefit from different filteres or different settings.
.... and an example to show why it is useful would help here. I do not feel that I have seen anything to substantiate "at least some of them would benefit" yet. Would it follow that "grep" and "cat-file" should be controlled by yet two other knobs so that optionally the user can use different "text version"s meant for them?
The way I propose it, a user would just have to add "show=foo" to the "diff=foo" lines without having to ad an extra filter, but with the flexibility to do so.quoted
And of course for any workflow-oriented config, you will sometimes want to override it for a particular operation. But that is why we have a command-line escape hatch, and that part is already implemented.One may ask what a purely ui output oriented setting like "show" has to do in .gitattributes, of course, but that applies to "diff" as well. Separating the two (one in attributes, one in config) looks artificial to me.
I am not sure what you mean by "artificial", but the separation of the roles between attribute and config is not artificial at all. It is very much deliberate and done for a good reason. The attribute specifies what the type of the file is project wide and is meant to go in in-tree .gitattrbute file, shared among people on different platforms. It says things like "These files are PDF". The config specifies what should happen to the type of a file on a particular platform each user uses to work in the copy of the project, i.e. repository. It says things like "Pass PDF files through /opt/bin/pdf2txt", which obviously cannot be shared across platforms.