{"thread":{"id":"34265","subject":"Another core.safecrlf behavor with git diff/git status","startedAt":"2013-06-24T16:37:04Z","lastAt":"2013-06-25T08:52:10Z","messageCount":5,"participants":["Yann Droneaud","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"221829","messageId":"866f886ef5e48ba22eec0f67203666bb@meuh.org","threadId":"34265","inReplyTo":null,"subject":"Another core.safecrlf behavor with git diff/git status","fromName":"Yann Droneaud","fromEmail":"ydroneaud@opteya.com","sentAt":"2013-06-24T16:37:04Z","receivedAt":"2013-06-24T16:37:04Z","isPatch":false,"sender":{"key":"ydroneaud@opteya.com","avatar":"https://avatars.githubusercontent.com/u/881377?v=4"},"body":"Hi,\n\nI'm still trying to use .gitattributes \"text\" flag with CRLF line ending \nfiles\nunder Linux.\n\nI'm surprised about the interaction between the index and the working \ndirectory,\nmore specificaly about the interaction between git diff and git status:\n\n   $ git init\n   Initialized empty Git repository in /home/ydroneaud/tmp/.git/\n   $ echo \"test text\" > .gitattributes\n   $ git add .gitattributes\n   $ git commit -m \".gitattributes\"\n   [master (root-commit) 67c2a06] attrib\n    1 file changed, 1 insertion(+)\n    create mode 100644 .gitattributes\n   $ printf \"One\\r\\nLine\\r\\n\" > test\n   $ git add test\n   warning: CRLF will be replaced by LF in test.\n   The file will have its original line endings in your working \ndirectory.\n   $ git commit -m \"test\"\n   [master 8b06aed] test\n   warning: CRLF will be replaced by LF in test.\n   The file will have its original line endings in your working \ndirectory.\n    1 file changed, 2 insertions(+)\n    create mode 100644 test\n   $ git diff\n   # <git diff report nothing>\n   $ touch test\n   $ git diff\n   warning: CRLF will be replaced by LF in test.\n   The file will have its original line endings in your working \ndirectory.\n   $ git diff                                    # <= twice\n   warning: CRLF will be replaced by LF in test.\n   The file will have its original line endings in your working \ndirectory.\n   $ git status\n   # On branch master\n   nothing to commit, working directory clean\n   $ git diff\n   # <git diff report nothing>\n\n\n- Why git diff does not always report the CRLF/LF mismatch ?\n\n- Why git status does not report about the CRLF/LF mismatch before \nupdating the index:\n   it silently hide the CRLF/LF warning.\n   git add, git commit report the warning. git status should probably do \nthe same.\n\nRegards.\n\n-- \nYann Droneaud\nOPTEYA\n"},{"id":"221838","messageId":"a52e61e60f626e8ad75435af94a85042@meuh.org","threadId":"34265","inReplyTo":"866f886ef5e48ba22eec0f67203666bb@meuh.org","subject":"Re: Another core.safecrlf behavor with git diff/git status","fromName":"Yann Droneaud","fromEmail":"ydroneaud@opteya.com","sentAt":"2013-06-24T16:43:48Z","receivedAt":"2013-06-24T16:43:48Z","isPatch":false,"sender":{"key":"ydroneaud@opteya.com","avatar":"https://avatars.githubusercontent.com/u/881377?v=4"},"body":"Le 24.06.2013 18:37, Yann Droneaud a écrit :\n\n> I'm still trying to use .gitattributes \"text\" flag with CRLF line \n> ending files\n> under Linux.\n> \n> I'm surprised about the interaction between the index and the working \n> directory,\n> more specificaly about the interaction between git diff and git status:\n\n[...]\n\n> - Why git diff does not always report the CRLF/LF mismatch ?\n> \n> - Why git status does not report about the CRLF/LF mismatch before\n> updating the index:\n>   it silently hide the CRLF/LF warning.\n>   git add, git commit report the warning. git status should probably\n> do the same.\n\nCan this problem be related to the rebase failure I've described in \nthread\n\"git rebase fail with CRLF conversion\" [1][2][3] ?\n\n1. <fb20a7d711fdd218f58f1f2090b1c515@meuh.org>\n2. <http://thread.gmane.org/gmane.comp.version-control.git/228613>\n3. <http://marc.info/?l=git&m=137182211414404&w=2>\n\nRegards.\n\n-- \nYann Droneaud\nOPTEYA\n"},{"id":"221852","messageId":"7v7ghjbg8i.fsf@alter.siamese.dyndns.org","threadId":"34265","inReplyTo":"866f886ef5e48ba22eec0f67203666bb@meuh.org","subject":"Re: Another core.safecrlf behavor with git diff/git status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-24T16:55:41Z","receivedAt":"2013-06-24T16:55:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yann Droneaud <ydroneaud@opteya.com> writes:\n\n> - Why git diff does not always report the CRLF/LF mismatch ?\n\nMost likely because you are telling safecrlf not to error out but\njust warn, and then you are not fixing the cause of the warning?  So\ndiff would say \"Ok, you must know what you are doing, so I trust\nwhat is in the index\", perhaps?\n\n> - Why git status does not report about the CRLF/LF mismatch before\n> updating the index:\n\nMy suspicion is the same as \"diff\".\n"},{"id":"221855","messageId":"400f1e3599efcbdcad82c2da89a3875c@meuh.org","threadId":"34265","inReplyTo":"866f886ef5e48ba22eec0f67203666bb@meuh.org","subject":"Re: Another core.safecrlf behavor with git diff/git status","fromName":"Yann Droneaud","fromEmail":"ydroneaud@opteya.com","sentAt":"2013-06-24T17:02:11Z","receivedAt":"2013-06-24T17:02:11Z","isPatch":false,"sender":{"key":"ydroneaud@opteya.com","avatar":"https://avatars.githubusercontent.com/u/881377?v=4"},"body":"Le 24.06.2013 18:37, Yann Droneaud a écrit :\n\n> I'm still trying to use .gitattributes \"text\" flag with CRLF line \n> ending files\n> under Linux.\n> \n> I'm surprised about the interaction between the index and the working \n> directory,\n> more specificaly about the interaction between git diff and git status:\n\n[...]\n\n> - Why git diff does not always report the CRLF/LF mismatch ?\n> \n> - Why git status does not report about the CRLF/LF mismatch before\n> updating the index:\n>   it silently hide the CRLF/LF warning.\n>   git add, git commit report the warning. git status should probably\n> do the same.\n> \n\nOne last try for today, still under Linux, with git 1.8.1.4:\n\n   $ git init\n   Initialized empty Git repository in \n/home/ydroneaud/src/tmp/onemore/work1/.git/\n   $ git commit --allow-empty -m \"root\"\n   [master (root-commit) 89c2ff9] root\n\n   $ CRLF=\"\\r\\n\"\n   $ printf \"Hello World 1${CRLF}Hello World 2${CRLF}Hello World \n3${CRLF}Hello World 4\" > test\n   $ git add test\n   $ git commit -m \"test\"\n   [master 36d4628] test\n    1 file changed, 4 insertions(+)\n    create mode 100644 test\n\n   $ echo \"test text\" > .gitattributes\n   $ git add .gitattributes\n   $ git commit -m \".gitattributes\"\n   [master 3b9f3cc] .gitattributes\n    1 file changed, 1 insertion(+)\n    create mode 100644 .gitattributes\n\n   $ git diff                      # print nothing\n   $ git status\n   # On branch master\n   nothing to commit, working directory clean\n   $ touch test\n   $ git diff\n   warning: CRLF will be replaced by LF in test.\n   The file will have its original line endings in your working \ndirectory.\n   diff --git a/test b/test\n   index b043836..63ba10f 100644\n   --- a/test\n   +++ b/test\n   @@ -1,4 +1,4 @@\n   -Hello World 1\n   -Hello World 2\n   -Hello World 3\n   +Hello World 1\n   +Hello World 2\n   +Hello World 3\n    Hello World 4\n   \\ No newline at end of file\n\n\n- commiting .gitattributes should have trigger a warning about CRLF \nconversion\n- doing git diff after commiting .gitattributes should have reported the \nwarning about CRLF/LF.\n\nI dislike complaining all the time about such unusual corner cases, I \napologize not having patches\nto provides to Git to try to \"fix\"/improve this.\n\nRegards.\n\n-- \nYann Droneaud\nOPTEYA\n"},{"id":"221926","messageId":"48dfe0b092fdf977a823725ddbc91e32@meuh.org","threadId":"34265","inReplyTo":"7v7ghjbg8i.fsf@alter.siamese.dyndns.org","subject":"Re: Another core.safecrlf behavor with git diff/git status","fromName":"Yann Droneaud","fromEmail":"ydroneaud@opteya.com","sentAt":"2013-06-25T08:52:10Z","receivedAt":"2013-06-25T08:52:10Z","isPatch":false,"sender":{"key":"ydroneaud@opteya.com","avatar":"https://avatars.githubusercontent.com/u/881377?v=4"},"body":"Hi,\n\nLe 24.06.2013 18:55, Junio C Hamano a écrit :\n> Yann Droneaud <ydroneaud@opteya.com> writes:\n> \n>> - Why git diff does not always report the CRLF/LF mismatch ?\n> \n> Most likely because you are telling safecrlf not to error out but\n> just warn, and then you are not fixing the cause of the warning?  So\n> diff would say \"Ok, you must know what you are doing, so I trust\n> what is in the index\", perhaps?\n> \n>> - Why git status does not report about the CRLF/LF mismatch before\n>> updating the index:\n> \n> My suspicion is the same as \"diff\".\n\nI'm ok with theses answers regarding the test case provided first:\nthe warning was emitted when the files were commited.\n\n(But still I would like git diff/git status to behave the same regarding \nthe \"index\":\n  emit the warning and update the index,\n  I suppose it's not related to core.safecrlf but inner Git way of \nworking).\n\nCould you have a look at the other test case I've sent later in this \nthread / the rebase problem I've sent earlier in another thread.\n\nRegards.\n\n-- \nYann Droneaud\nOPTEYA\n"}]}