{"thread":{"id":"48641","subject":"Regression (?) in core.safecrlf=false messaging","startedAt":"2018-06-04T05:54:06Z","lastAt":"2018-06-04T19:15:38Z","messageCount":5,"participants":["Anthony Sottile","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"349218","messageId":"CA+dzEBm_doNMjEs_OWwia_mm7u3ztAFpCpaFJP3DRpFhEo93jg@mail.gmail.com","threadId":"48641","inReplyTo":null,"subject":"Regression (?) in core.safecrlf=false messaging","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2018-06-04T05:54:00Z","receivedAt":"2018-06-04T05:54:06Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"I'm a bit unclear if I was depending on undocumented behaviour or not\nhere but it seems the messaging has recently changed with respect to\n`core.safecrlf`\n\nMy reading of the documentation\nhttps://git-scm.com/docs/git-config#git-config-coresafecrlf (I might\nbe wrong here)\n\n- core.safecrlf = true -> fail hard when converting\n- core.safecrlf = warn -> produce message when converting\n- core.safecrlf = false -> convert silently\n\n(note that these are all only relevant when `core.autocrlf = true`)\n\nI've created a small script to demonstrate:\n\n```\nset -euxo pipefail\n\ngit --version\n\nrm -rf repo\ngit init repo\ncd repo\ngit config core.autocrlf input\ngit config core.safecrlf false\necho -en 'foo\\r\\nbar\\r\\n' > f\ngit add f\n```\n\nWhen run against 2.16.4:\n\n```\n$ PATH=$PWD/prefix/bin:$PATH bash test.sh\n+ git --version\ngit version 2.16.4\n+ rm -rf repo\n+ git init repo\nInitialized empty Git repository in /tmp/git/repo/.git/\n+ cd repo\n+ git config core.autocrlf input\n+ git config core.safecrlf false\n+ echo -en 'foo\\r\\nbar\\r\\n'\n+ git add f\n```\n\n(notice how there are no messages about crlf conversion while adding\n-- this is what I expect given I have core.safecrlf=false)\n\n\nWhen run against master:\n\n```console\n$ PATH=$PWD/prefix/bin:$PATH bash test.sh\n+ git --version\ngit version 2.18.0.rc0.42.gc2c7d17\n+ rm -rf repo\n+ git init repo\nInitialized empty Git repository in /tmp/git/repo/.git/\n+ cd repo\n+ git config core.autocrlf input\n+ git config core.safecrlf false\n+ echo -en 'foo\\r\\nbar\\r\\n'\n+ git add f\nwarning: CRLF will be replaced by LF in f.\nThe file will have its original line endings in your working directory.\n```\n\nA `git bisect` shows this as the first commit which breaks this\nbehaviour: 8462ff43e42ab67cecd16fdfb59451a53cc8a945\n\nhttps://github.com/git/git/commit/8462ff43e42ab67cecd16fdfb59451a53cc8a945\n\nThe commit appears to be a refactor (?) that shouldn't have changed behaviour?\n\nHere's the script I was using to bisect:\nhttps://i.fluffy.cc/2L4ZtqV3cHfzNRkKPbHgTcz43HMQJxdK.html\n\n```\ngit bisect start\ngit bisect bad v2.17.0\ngit bisect good v2.16.4\ngit bisect run ./test.sh\n```\n\nNoticed this due to test failures here:\nhttps://github.com/pre-commit/pre-commit/pull/762#issuecomment-394236625\n\nThanks,\n\nAnthony\n"},{"id":"349219","messageId":"20180604073855.GA20922@tor.lan","threadId":"48641","inReplyTo":"CA+dzEBm_doNMjEs_OWwia_mm7u3ztAFpCpaFJP3DRpFhEo93jg@mail.gmail.com","subject":"Re: Regression (?) in core.safecrlf=false messaging","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2018-06-04T07:38:55Z","receivedAt":"2018-06-04T07:39:06Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"(as usual, no top-posting here, please see my answers at the end)\n\nOn Sun, Jun 03, 2018 at 10:54:00PM -0700, Anthony Sottile wrote:\n> I'm a bit unclear if I was depending on undocumented behaviour or not\n> here but it seems the messaging has recently changed with respect to\n> `core.safecrlf`\n> \n> My reading of the documentation\n> https://git-scm.com/docs/git-config#git-config-coresafecrlf (I might\n> be wrong here)\n> \n> - core.safecrlf = true -> fail hard when converting\n> - core.safecrlf = warn -> produce message when converting\n> - core.safecrlf = false -> convert silently\n> \n> (note that these are all only relevant when `core.autocrlf = true`)\n> \n> I've created a small script to demonstrate:\n> \n> ```\n> set -euxo pipefail\n> \n> git --version\n> \n> rm -rf repo\n> git init repo\n> cd repo\n> git config core.autocrlf input\n> git config core.safecrlf false\n> echo -en 'foo\\r\\nbar\\r\\n' > f\n> git add f\n> ```\n> \n> When run against 2.16.4:\n> \n> ```\n> $ PATH=$PWD/prefix/bin:$PATH bash test.sh\n> + git --version\n> git version 2.16.4\n> + rm -rf repo\n> + git init repo\n> Initialized empty Git repository in /tmp/git/repo/.git/\n> + cd repo\n> + git config core.autocrlf input\n> + git config core.safecrlf false\n> + echo -en 'foo\\r\\nbar\\r\\n'\n> + git add f\n> ```\n> \n> (notice how there are no messages about crlf conversion while adding\n> -- this is what I expect given I have core.safecrlf=false)\n> \n> \n> When run against master:\n> \n> ```console\n> $ PATH=$PWD/prefix/bin:$PATH bash test.sh\n> + git --version\n> git version 2.18.0.rc0.42.gc2c7d17\n> + rm -rf repo\n> + git init repo\n> Initialized empty Git repository in /tmp/git/repo/.git/\n> + cd repo\n> + git config core.autocrlf input\n> + git config core.safecrlf false\n> + echo -en 'foo\\r\\nbar\\r\\n'\n> + git add f\n> warning: CRLF will be replaced by LF in f.\n> The file will have its original line endings in your working directory.\n> ```\n> \n> A `git bisect` shows this as the first commit which breaks this\n> behaviour: 8462ff43e42ab67cecd16fdfb59451a53cc8a945\n> \n> https://github.com/git/git/commit/8462ff43e42ab67cecd16fdfb59451a53cc8a945\n> \n> The commit appears to be a refactor (?) that shouldn't have changed behaviour?\n> \n> Here's the script I was using to bisect:\n> https://i.fluffy.cc/2L4ZtqV3cHfzNRkKPbHgTcz43HMQJxdK.html\n> \n> ```\n> git bisect start\n> git bisect bad v2.17.0\n> git bisect good v2.16.4\n> git bisect run ./test.sh\n> ```\n> \n> Noticed this due to test failures here:\n> https://github.com/pre-commit/pre-commit/pull/762#issuecomment-394236625\n> \n> Thanks,\n> \n> Anthony\n\nThanks so much for the report, and the detailed analyzes that has been done.\nGood work, I would say.\n\nThis looks very much as an (unplanned) regression.\nI will have a look within the next days, as soon as my time allows it.\n"},{"id":"349220","messageId":"20180604075549.GA21063@tor.lan","threadId":"48641","inReplyTo":"20180604073855.GA20922@tor.lan","subject":"Re: Regression (?) in core.safecrlf=false messaging","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2018-06-04T07:55:49Z","receivedAt":"2018-06-04T07:56:00Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\nDoes the following patch fix your problem ?\n\ndiff --git a/config.c b/config.c\nindex 6f8f1d8c11..c625aec96a 100644\n--- a/config.c\n+++ b/config.c\n@@ -1233,7 +1233,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\t}\n \t\teol_rndtrp_die = git_config_bool(var, value);\n \t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n-\t\t\tCONV_EOL_RNDTRP_DIE : CONV_EOL_RNDTRP_WARN;\n+\t\t\tCONV_EOL_RNDTRP_DIE : 0;\n \t\treturn 0;\n \t}\n \n"},{"id":"349255","messageId":"CA+dzEBn7cCey-LDa1Y-PUeFQs7JiucS30FFiLfw4sfu6ZX34JQ@mail.gmail.com","threadId":"48641","inReplyTo":"20180604075549.GA21063@tor.lan","subject":"Re: Regression (?) in core.safecrlf=false messaging","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2018-06-04T15:43:16Z","receivedAt":"2018-06-04T15:43:20Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"On Mon, Jun 4, 2018 at 12:55 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n>\n> Does the following patch fix your problem ?\n>\n> diff --git a/config.c b/config.c\n> index 6f8f1d8c11..c625aec96a 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -1233,7 +1233,7 @@ static int git_default_core_config(const char *var, const char *value)\n>                 }\n>                 eol_rndtrp_die = git_config_bool(var, value);\n>                 global_conv_flags_eol = eol_rndtrp_die ?\n> -                       CONV_EOL_RNDTRP_DIE : CONV_EOL_RNDTRP_WARN;\n> +                       CONV_EOL_RNDTRP_DIE : 0;\n>                 return 0;\n>         }\n>\n\n\nYes!  After applying that patch:\n\n```\n\n$ PATH=$PWD/prefix/bin:$PATH bash test.sh\n+ git --version\ngit version 2.18.0.rc1.dirty\n+ rm -rf repo\n+ git init repo\nInitialized empty Git repository in /tmp/git/repo/.git/\n+ cd repo\n+ git config core.autocrlf input\n+ git config core.safecrlf false\n+ echo -en 'foo\\r\\nbar\\r\\n'\n+ git add f\n\n```\n\nAnthony\n"},{"id":"349295","messageId":"81c6709d-8f8d-9387-1649-6bdc80c30ae8@web.de","threadId":"48641","inReplyTo":"CA+dzEBn7cCey-LDa1Y-PUeFQs7JiucS30FFiLfw4sfu6ZX34JQ@mail.gmail.com","subject":"Re: Regression (?) in core.safecrlf=false messaging","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2018-06-04T19:15:21Z","receivedAt":"2018-06-04T19:15:38Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 04.06.18 17:43, Anthony Sottile wrote:\n> On Mon, Jun 4, 2018 at 12:55 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n>>\n>> Does the following patch fix your problem ?\n>>\n>> diff --git a/config.c b/config.c\n>> index 6f8f1d8c11..c625aec96a 100644\n>> --- a/config.c\n>> +++ b/config.c\n>> @@ -1233,7 +1233,7 @@ static int git_default_core_config(const char *var, const char *value)\n>>                 }\n>>                 eol_rndtrp_die = git_config_bool(var, value);\n>>                 global_conv_flags_eol = eol_rndtrp_die ?\n>> -                       CONV_EOL_RNDTRP_DIE : CONV_EOL_RNDTRP_WARN;\n>> +                       CONV_EOL_RNDTRP_DIE : 0;\n>>                 return 0;\n>>         }\n>>\n> \n> \n> Yes!  After applying that patch:\n> \n> ```\n> \n> $ PATH=$PWD/prefix/bin:$PATH bash test.sh\n> + git --version\n> git version 2.18.0.rc1.dirty\n> + rm -rf repo\n> + git init repo\n> Initialized empty Git repository in /tmp/git/repo/.git/\n> + cd repo\n> + git config core.autocrlf input\n> + git config core.safecrlf false\n> + echo -en 'foo\\r\\nbar\\r\\n'\n> + git add f\n> \n> ```\n> \n> Anthony\n> \nGood.\nDo you want to send the patch to the list ?\n(You don't have too, if you don't want,\nbut as you already did all the work...)\n\n\n"}]}