{"thread":{"id":"3497","subject":"Quick question: end of lines","startedAt":"2006-02-28T18:32:58Z","lastAt":"2006-03-01T09:01:38Z","messageCount":6,"participants":["Emmanuel Guerin","Johannes Schindelin","Martin Langhoff","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16913","messageId":"f898cca90602281032n6603bf14q@mail.gmail.com","threadId":"3497","inReplyTo":null,"subject":"Quick question: end of lines","fromName":"Emmanuel Guerin","fromEmail":"emmanuel@guerin.fr.eu.org","sentAt":"2006-02-28T18:32:58Z","receivedAt":"2006-02-28T18:32:58Z","isPatch":false,"sender":{"key":"emmanuel@guerin.fr.eu.org","avatar":null},"body":"Hi all,\n\nI  began recently to use git, and there is one thing I still do not\nknow how to do.\n\nIs it possible to checkout sources out of the GIT repository with\nWindows style end of lines?\nIn a manner much like the one Subversion is using?\n\nTo be more precise, I need to be able to checkout files on Unix and\nWindows, and it is important that the end of lines are set\naccordingly.\n\nThanks for any hints or pointers,\n\nRegards,\n\nManu\n"},{"id":"16919","messageId":"Pine.LNX.4.63.0602282101530.10710@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3497","inReplyTo":"f898cca90602281032n6603bf14q@mail.gmail.com","subject":"Re: Quick question: end of lines","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-02-28T20:07:19Z","receivedAt":"2006-02-28T20:07:19Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 28 Feb 2006, Emmanuel Guerin wrote:\n\n> Is it possible to checkout sources out of the GIT repository with\n> Windows style end of lines?\n\nNo.\n\nAs far as git is concerned, every versioned file is equal. IMHO this \ndecision is good, since\n\n- different handling is more complicated (you have to keep track of the \nfile type), and\n- it is not really worth doing.\n\nWindows can handle Unix line endings quite properly (with the notable \nexception of notepad.exe), and even Apple has learnt that it might be a \nstupid idea to insist on being different when it's just not worth it.\n\nThe only reason I would accept: you have to work with MS-DOS tools. But \neven in this case, I'd rather write a wrapper which converts to DOS line \nendings, executes the tool, and converts back.\n\nHth,\nDscho\n"},{"id":"16920","messageId":"46a038f90602281215n259066b1qe2e6421625b82e75@mail.gmail.com","threadId":"3497","inReplyTo":"f898cca90602281032n6603bf14q@mail.gmail.com","subject":"Re: Quick question: end of lines","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-02-28T20:15:53Z","receivedAt":"2006-02-28T20:15:53Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 3/1/06, Emmanuel Guerin <emmanuel@guerin.fr.eu.org> wrote:\n> To be more precise, I need to be able to checkout files on Unix and\n> Windows, and it is important that the end of lines are set\n> accordingly.\n\nWhy is this important?\n\n(I am thinking: any reasonably good text editor will know how to deal\nwith unix newlines, but you may have different reasons).\n\n\nmartin\n"},{"id":"16928","messageId":"f898cca90602281612n777a4f17m@mail.gmail.com","threadId":"3497","inReplyTo":"46a038f90602281215n259066b1qe2e6421625b82e75@mail.gmail.com","subject":"Re: Quick question: end of lines","fromName":"Emmanuel Guerin","fromEmail":"emmanuel@guerin.fr.eu.org","sentAt":"2006-03-01T00:12:36Z","receivedAt":"2006-03-01T00:12:36Z","isPatch":false,"sender":{"key":"emmanuel@guerin.fr.eu.org","avatar":null},"body":"2006/3/1, Martin Langhoff <martin.langhoff@gmail.com>:\n> Why is this important?\n>\n> (I am thinking: any reasonably good text editor will know how to deal\n> with unix newlines, but you may have different reasons).\n\nActually, you have found the problem. My particular setup is that\nVisual Studio is used on Windows. The editor will handle unix end of\nlines all right, but tends to insert windows ones when modifications\nare made. This leads to files with inconsistent end of lines, and\nnightmares with merges. We use Subversion for the moment, and we have\nto make sure that all text files are declared properly in svn to avoid\nconflicts.\n\nWhat I begin to realize is that the only possibility probably lies in\nusing a tool that converts the modified files \"on the fly\" before\ncommits. I just want to make sure that no other solution was found by\nothers facing a similar problem.\n\nAnyway, thanks for the answers,\n\nEmmanuel\n"},{"id":"16933","messageId":"46a038f90603010031g31f8bc33xd3f45f2e19950c78@mail.gmail.com","threadId":"3497","inReplyTo":"f898cca90602281612n777a4f17m@mail.gmail.com","subject":"Re: Quick question: end of lines","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-03-01T08:31:52Z","receivedAt":"2006-03-01T08:31:52Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 3/1/06, Emmanuel Guerin <emmanuel@guerin.fr.eu.org> wrote:\n> What I begin to realize is that the only possibility probably lies in\n> using a tool that converts the modified files \"on the fly\" before\n> commits. I just want to make sure that no other solution was found by\n> others facing a similar problem.\n\nPerhaps a pre-commit hook? Read the documentation (and search the list\narchives). I'm pretty sure you can do newline cleanup before commit or\nat least newline checks before commits.\n\nThere's always the option of filing a bug in MS's bugzilla ;-)\n\ncheers,\n\n\nmartin\n"},{"id":"16934","messageId":"7vwtfelerx.fsf@assigned-by-dhcp.cox.net","threadId":"3497","inReplyTo":"46a038f90603010031g31f8bc33xd3f45f2e19950c78@mail.gmail.com","subject":"Re: Quick question: end of lines","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-01T09:01:38Z","receivedAt":"2006-03-01T09:01:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Martin Langhoff\" <martin.langhoff@gmail.com> writes:\n\n> On 3/1/06, Emmanuel Guerin <emmanuel@guerin.fr.eu.org> wrote:\n>> What I begin to realize is that the only possibility probably lies in\n>> using a tool that converts the modified files \"on the fly\" before\n>> commits. I just want to make sure that no other solution was found by\n>> others facing a similar problem.\n>\n> Perhaps a pre-commit hook? Read the documentation (and search the list\n> archives). I'm pretty sure you can do newline cleanup before commit or\n> at least newline checks before commits.\n>\n> There's always the option of filing a bug in MS's bugzilla ;-)\n\nYou can use .git/hooks/pre-commit hook in the repository the\neditor that munges line-termination, to fix things up.\n\nThe hook is called with GIT_INDEX_FILE set to the appropriate\nindex file, so you could \"git-diff-index --cached --name-only\nHEAD\" to obtain the list of files being committed, sanitize the\nworking tree files and update-index them again before returning\ntrue from the hook.\n\nThis is a silly example to standardize on uppercase.\n\n        git-diff-index --cached --name-only HEAD |\n        xargs sh -c '\n                while case \"$#\" in 0) break ;; esac\n                do\n                        perl -p -i -e \"\\$_ = uc(\\$_)\" \"$1\"\n                        git-update-index \"$1\"\n                        shift\n                done\n        ' dummy\n        exit 0\n"}]}