Re: PostScript files: textconv and "git add -p"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. :)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]