From: Jeff King Date: Wed, 05 Jan 2011 05:18:07 GMT Subject: Re: PostScript files: textconv and "git add -p" Message-ID: <20110105051807.GB5884@sigill.intra.peff.net> In-Reply-To: On Tue, Jan 04, 2011 at 04:50:44PM +0100, Matthieu Moy wrote: > If I do this: > > ,----[ .gitattributes ] > | *.ps diff=ps > `---- > > ,----[ .gitconfig ] > | [diff "ps"] > | textconv=ps2ascii > `---- > > then I get the textconv niceness when running "git diff", which is > cool, but "git add -p" still proposes me to stage hunks one by one, > which isn't. > > If I set "*.ps binary" in .gitattributes, "git add -p" becomes quiet, > but textconv is disabled. Yeah the "binary" attribute (which is a synonym for !diff along with some crlf stuff) and "diff" are mutually exclusive. One says "don't diff this" and the other says "diff this according to some special rules". But fortunately, those special rules can contain "this is binary". So you can get what you want with: echo '*.ps diff=ps' >.gitattributes git config diff.ps.textconv ps2ascii git config diff.ps.binary true which will textconv the file in the usual places, but consider it binary in all other circumstances (like "add -p"). -Peff PS Your question made me very happy. I implemented "diff.*.binary" the way I did out of a vague sense of orthogonality, but I never quite came up with a concrete example where it was useful to set both. Thanks for providing one. :)