convert: allow core.autocrlf=input and core.eol=crlf
Even though the configuration parser errors out when core.autocrlf is set to 'input' when core.eol is set to 'crlf', there is no need to do so, because the core.autocrlf setting trumps core.eol. Allow all combinations of core.crlf and core.eol and document that core.autocrlf overrides core.eol. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Torsten Bögershausen committed
Apr 25, 2016 at 18:56 UTC
70ad8c8d8c0840fb89492063274132d28bdfbe3b
2 files changed
+3
-7
Documentation/config.txt
+3
-3
@@ -337,9 +337,9 @@ core.quotePath::
337
338
core.eol::
339
Sets the line ending type to use in the working directory for
340
- files that have the `text` property set. Alternatives are
341
- 'lf', 'crlf' and 'native', which uses the platform's native
342
- line ending. The default value is `native`. See
340
+ files that have the `text` property set when core.autocrlf is false.
341
+ Alternatives are 'lf', 'crlf' and 'native', which uses the platform's
342
+ native line ending. The default value is `native`. See
343
linkgit:gitattributes[5] for more information on end-of-line
344
conversion.
345
config.c
-4
@@ -803,8 +803,6 @@ static int git_default_core_config(const char *var, const char *value)
803
804
if (!strcmp(var, "core.autocrlf")) {
805
if (value && !strcasecmp(value, "input")) {
806
- if (core_eol == EOL_CRLF)
807
- return error("core.autocrlf=input conflicts with core.eol=crlf");
806
auto_crlf = AUTO_CRLF_INPUT;
807
return 0;
808
}
@@ -830,8 +828,6 @@ static int git_default_core_config(const char *var, const char *value)
828
core_eol = EOL_NATIVE;
829
else
830
core_eol = EOL_UNSET;
833
- if (core_eol == EOL_CRLF && auto_crlf == AUTO_CRLF_INPUT)
834
- return error("core.autocrlf=input conflicts with core.eol=crlf");
831
return 0;
832
}
833