{"thread":{"id":"39286","subject":"Request: refuse to commit .gitattributes unless the change also commits correct line endings","startedAt":"2015-05-10T00:57:37Z","lastAt":"2015-05-10T00:57:37Z","messageCount":1,"participants":["Paul Salmon"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"260910","messageId":"CA+nXY9ZfeNAmLcwvYyigKAPtWg9i_0xAiKVAvUCcGZ6OXAfv_g@mail.gmail.com","threadId":"39286","inReplyTo":null,"subject":"Request: refuse to commit .gitattributes unless the change also commits correct line endings","fromName":"Paul Salmon","fromEmail":"paul.b.salmon@gmail.com","sentAt":"2015-05-10T00:57:37Z","receivedAt":"2015-05-10T00:57:37Z","isPatch":false,"sender":{"key":"paul.b.salmon@gmail.com","avatar":null},"body":"When .gitattributes is updated to mark that certain files must contain\ncertain line endings, those files become \"due\" for an update. But git\nallows .gitattributes to be committed without updating those files to\nmatch. In fact, it won't even tell the committer that they've just\nmade some files \"stale\" in this way.\n\nThe problem is that when there are files that are pending such a line\nendings update, git behaves very badly. In particular, one gets\nmodified files that absolutely cannot be reverted, and (a much worse\nproblem) some merges become impossible: you start with a clean\ncheckout, run a merge, and then git decides that your checkout wasn't\nclean after all.\n\nThe solution is simple: commit a change that fixes all the line\nendings. But until this is done, the repo is pretty broken.\n\nREQUEST\n\nDon't let the repo get into this state in the first place. Or at least\nnot without a \"--force\" flag.\n\nBasically, if a commit contains a .gitattributes change, I'd like git\nto check whether any files that were previously OK have become \"due\"\nfor a newline fix.\n\nIf so, Git should error out, explaining that the developer should also\ncommit fixed newlines at the same time. Or if the developer insists\nthat they want to break everything, use --force.\n\nMOTIVATION\n\nI recently tried to submit a few pull requests to someone else's\nrepository that had this problem. First I went through the infuriating\nexperience of figuring out why git was being so weird (I'm not a\n_complete_ git noob but this was totally new to me). Then I found\nmyself unable to actually make any contributions. I imagine it's OK if\nyou're the owner, but pull requests require merges from time to time,\nand I was almost always prevented from merging things.\n\nOn top of this, I had to convince the repo owner that his repo\nrequired a change (a 200 kLOC change!). I wasn't even sure I was right\nto begin with. In fact I still wonder if I got it totally wrong and\nyou guys are going to tell me how dumb I am being.\n\nPaul\n"}]}