{"thread":{"id":"34942","subject":".gitattributes and defaulting to binary","startedAt":"2013-09-16T21:35:24Z","lastAt":"2013-09-16T22:09:08Z","messageCount":2,"participants":["Matthieu Vachon","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"227718","messageId":"CAOTvmonjWtUM42ATpEu+s6GVcpTO10BT0izXVB_aqK2npgRfWQ@mail.gmail.com","threadId":"34942","inReplyTo":null,"subject":".gitattributes and defaulting to binary","fromName":"Matthieu Vachon","fromEmail":"matthieu.o.vachon@gmail.com","sentAt":"2013-09-16T21:35:24Z","receivedAt":"2013-09-16T21:35:24Z","isPatch":false,"sender":{"key":"matthieu.o.vachon@gmail.com","avatar":null},"body":"Hi all,\n\nI would like to craft my `.gitattributes` in a way that all files\nexpect those specified in it are treated as binary from a line-ending\nnormalization point of view (and diff viewing).\n\nBut I was not able to achieve it right now. When having this in my\n`.gitattributes`, git treats all files as binary, even the one\nexplicitly specified like `*.txt`:\n\n    *.txt text\n    * binary\n\nI tried with:\n\n    *.txt text\n    * -text\n\nAnd it does not seem to work correctly neither because then, my\n`test.txt` file is not having correct line ending when setting\n`core.eol` to `crlf` (or using `eol=crlf` in the `.gitattributes`\nfile).\n\nSo, is it possible to do something like that? If yes, is my sample\n`.gitattributes` should work?\n\nRegards,\nMatt\n"},{"id":"227721","messageId":"20130916220908.GC5477@sigill.intra.peff.net","threadId":"34942","inReplyTo":"CAOTvmonjWtUM42ATpEu+s6GVcpTO10BT0izXVB_aqK2npgRfWQ@mail.gmail.com","subject":"Re: .gitattributes and defaulting to binary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-09-16T22:09:08Z","receivedAt":"2013-09-16T22:09:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 16, 2013 at 05:35:24PM -0400, Matthieu Vachon wrote:\n\n> But I was not able to achieve it right now. When having this in my\n> `.gitattributes`, git treats all files as binary, even the one\n> explicitly specified like `*.txt`:\n> \n>     *.txt text\n>     * binary\n\n>From \"git help attributes\":\n\n  When more than one pattern matches the path, a later line overrides an\n  earlier line. This overriding is done per attribute.\n\nReversing the two lines should do what you want.\n\nYou may also want to use \"-text\" instead of \"binary\"; the latter also\nimplies \"-diff\", which means you will never see diffs of those files,\neven if they are actually text.\n\n-Peff\n"}]}