{"thread":{"id":"16481","subject":"git cat-file blob does not convert crlf","startedAt":"2008-11-26T19:34:56Z","lastAt":"2008-11-27T01:41:39Z","messageCount":3,"participants":["Quim K. Holland","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"96570","messageId":"20081127013456.6117@qkholland.gmail.com","threadId":"16481","inReplyTo":null,"subject":"git cat-file blob does not convert crlf","fromName":"Quim K. Holland","fromEmail":"qkholland@gmail.com","sentAt":"2008-11-26T19:34:56Z","receivedAt":"2008-11-26T19:34:56Z","isPatch":false,"sender":{"key":"qkholland@gmail.com","avatar":null},"body":"I think git is buggy.\nI wanted to discard the changes I made to my file by checking out a copy from the last commit, so I said\n% git cat-file blob HEAD:my-file >my-file\nBut this does not respect core.autocrlf and the file becomes one long line.\nAlso it feels stupid that I have to say my-file twice at the command prompt.\n"},{"id":"96571","messageId":"7v3ahegtpi.fsf@gitster.siamese.dyndns.org","threadId":"16481","inReplyTo":"20081127013456.6117@qkholland.gmail.com","subject":"Re: git cat-file blob does not convert crlf","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-26T19:42:17Z","receivedAt":"2008-11-26T19:42:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Quim K. Holland\" <qkholland@gmail.com> writes:\n\n> I think git is buggy.\n\nThanks for pointing it out X-<.\n\n> I wanted to discard the changes I made to my file by checking out a copy from the last commit, so I said\n> % git cat-file blob HEAD:my-file >my-file\n> But this does not respect core.autocrlf and the file becomes one long line.\n\nThat is pretty much intentional.  cat-file is a low-level command that is\nmeant to inspect the raw object contents.  The output from the command has\nto be reproducible regardless of what customization you have in your\nparticular repository and omission of attributes support (including the\ncrlf conversion) is quite deliberate.\n\nYou said that you wanted to discard the changes by checking out a copy out\nof the HEAD commit.  This can literally be done by:\n\n\t$ git checkout HEAD my-file\n\nIf you want to check out a copy out of the index (i.e, \"the last staged\nversion\"), you can say:\n\n\t$ git checkout my-file\n\nIn other words, if you want to checkout, you can say checkout ;-)\n"},{"id":"96595","messageId":"alpine.DEB.1.00.0811270241060.30769@pacific.mpi-cbg.de","threadId":"16481","inReplyTo":"20081127013456.6117@qkholland.gmail.com","subject":"Re: git cat-file blob does not convert crlf","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-11-27T01:41:39Z","receivedAt":"2008-11-27T01:41:39Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 27 Nov 2008, Quim K. Holland wrote:\n\n> I think git is buggy.\n\nYou probably missed the difference between porcelain and plumbing.  Git is \nnot buggy.\n\nCiao,\nDscho\n"}]}