* error: core.autocrlf=input conflicts with core.eol=crlf @ 2014-12-05 5:42 Alex Stangl [not found] ` <54816863.90208@web.de> 0 siblings, 1 reply; 3+ messages in thread From: Alex Stangl @ 2014-12-05 5:42 UTC (permalink / raw) To: git Hi, There seems to be problems with the checks in the git code for conflicts between config values of core.autocrlf and core.eol. Because the various config files are read in separate passes, and the conflict check happens on the fly, it creates a situation where the order of the config file entries matters. This seems like a bug or at least a POLA violation -- ordering of lines within a section of a config file is not usually significant. Example: User has core.autocrlf=input in his ~/.gitconfig. In his project-level .git/config he wants to set core.autocrlf=false and core.eol=crlf. If the core.autocrlf=false comes first, then all is well and no conflict is reported. If the core.eol=crlf line comes first, then at the time this line is getting parsed, core.autocrlf is still set at "input" from ~/.gitconfig, and execution aborts: error: core.autocrlf=input conflicts with core.eol=crlf It seems like the conflict check should be made at the end of the config file parsing, not on the fly. I was tempted to create a patch, however I am unfamilar with the codebase, and didn't understand all the places where the config file parsing is called, so I'm not sure of the ramifications of any proposed change. A benefit of the current approach is that it reports the line number where it aborted in the config file. Trying to retain this and at the same time defer the check until the end could get complicated. Besides interaction between multiple levels of config files, the same sort of ordering issue can arise in conjunction with command-line config overrides. Example: User has core.autocrlf=input in his project-level .git/config. This command works fine: $ git -c core.autocrlf=false -c core.eol=crlf status This command blows up with conflict error: $ git -c core.eol=crlf -c core.autocrlf=false status I tested with git versions 1.9.3 and 2.1.0. Alex ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <54816863.90208@web.de>]
* Re: error: core.autocrlf=input conflicts with core.eol=crlf [not found] ` <54816863.90208@web.de> @ 2014-12-05 15:55 ` Torsten Bögershausen 2014-12-05 16:33 ` Alex Stangl 0 siblings, 1 reply; 3+ messages in thread From: Torsten Bögershausen @ 2014-12-05 15:55 UTC (permalink / raw) To: Alex Stangl, git On 12/05/2014 09:10 AM, Torsten Bögershausen wrote: > On 05.12.14 06:42, Alex Stangl wrote: >> Hi, >> >> There seems to be problems with the checks in the git code for conflicts >> between config values of core.autocrlf and core.eol. Because the various >> config files are read in separate passes, and the conflict check happens >> on the fly, it creates a situation where the order of the config file >> entries matters. This seems like a bug or at least a POLA violation -- >> ordering of lines within a section of a config file is not usually >> significant. >> >> Example: User has core.autocrlf=input in his ~/.gitconfig. In his >> project-level .git/config he wants to set core.autocrlf=false and >> core.eol=crlf. If the core.autocrlf=false comes first, then all is >> well and no conflict is reported. If the core.eol=crlf line comes >> first, then at the time this line is getting parsed, core.autocrlf >> is still set at "input" from ~/.gitconfig, and execution aborts: >> >> error: core.autocrlf=input conflicts with core.eol=crlf >> >> It seems like the conflict check should be made at the end of the >> config file parsing, not on the fly. I was tempted to create a patch, >> however I am unfamilar with the codebase, and didn't understand all >> the places where the config file parsing is called, so I'm not sure >> of the ramifications of any proposed change. A benefit of the current >> approach is that it reports the line number where it aborted in the >> config file. Trying to retain this and at the same time defer the >> check until the end could get complicated. >> >> Besides interaction between multiple levels of config files, the >> same sort of ordering issue can arise in conjunction with command-line >> config overrides. >> >> Example: User has core.autocrlf=input in his project-level .git/config. >> This command works fine: >> $ git -c core.autocrlf=false -c core.eol=crlf status >> This command blows up with conflict error: >> $ git -c core.eol=crlf -c core.autocrlf=false status >> >> I tested with git versions 1.9.3 and 2.1.0. >> Yes, this is a bug, if someone has a patch: it is welcome. Or a test case showing the problem is welcome too. Beside that, I am working on a patch to remove this restriction completely. I think that it is a legal combination to have a .gitattributes file like this: *.txt text And then set core.autocrlf=input # to avoid CRLF in the repo for e.g. *.c files, and core.eol=crlf # to have *.txt in CRLF in the working tree Which means do not touch any files, ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: error: core.autocrlf=input conflicts with core.eol=crlf 2014-12-05 15:55 ` Torsten Bögershausen @ 2014-12-05 16:33 ` Alex Stangl 0 siblings, 0 replies; 3+ messages in thread From: Alex Stangl @ 2014-12-05 16:33 UTC (permalink / raw) To: git On Fri, Dec 05, 2014 at 04:55:51PM +0100, Torsten B?gershausen wrote: > On 12/05/2014 09:10 AM, Torsten B?gershausen wrote: > Or a test case showing the problem is welcome too. I mentioned some examples in my previous post. Here they are in condensed form. They assume core.eol isn't set in your global config. These work fine: $ mkdir -p /tmp/ex1_$$;cd /tmp/ex1_$$;git init;git config --global core.autocrlf input;git config core.autocrlf false;git config core.eol crlf;git status $ mkdir -p /tmp/ex3_$$;cd /tmp/ex3_$$;git init;git config --global core.autocrlf input;git -c core.autocrlf=false -c core.eol=crlf status These equivalents fail: $ mkdir -p /tmp/ex2_$$;cd /tmp/ex2_$$;git init;git config --global core.autocrlf input;git config core.eol crlf;git config core.autocrlf false;git status $ mkdir -p /tmp/ex4_$$;cd /tmp/ex4_$$;git init;git config --global core.autocrlf input;git -c core.eol=crlf -c core.autocrlf=false status Alex ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-05 16:34 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-12-05 5:42 error: core.autocrlf=input conflicts with core.eol=crlf Alex Stangl [not found] ` <54816863.90208@web.de> 2014-12-05 15:55 ` Torsten Bögershausen 2014-12-05 16:33 ` Alex Stangl
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).