Skip to content

Commit 7dcbf89

Browse files
committed
Merge branch 'tb/core-eol-fix' into maint
A couple of bugs around core.autocrlf have been fixed. * tb/core-eol-fix: convert.c: ident + core.autocrlf didn't work t0027: test cases for combined attributes convert: allow core.autocrlf=input and core.eol=crlf t0027: make commit_chk_wrnNNO() reliable
2 parents 05781d3 + caa47ad commit 7dcbf89

File tree

4 files changed

+141
-189
lines changed

4 files changed

+141
-189
lines changed

Documentation/config.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ core.quotePath::
353353

354354
core.eol::
355355
Sets the line ending type to use in the working directory for
356-
files that have the `text` property set. Alternatives are
357-
'lf', 'crlf' and 'native', which uses the platform's native
358-
line ending. The default value is `native`. See
356+
files that have the `text` property set when core.autocrlf is false.
357+
Alternatives are 'lf', 'crlf' and 'native', which uses the platform's
358+
native line ending. The default value is `native`. See
359359
linkgit:gitattributes[5] for more information on end-of-line
360360
conversion.
361361

config.c

-4
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,6 @@ static int git_default_core_config(const char *var, const char *value)
803803

804804
if (!strcmp(var, "core.autocrlf")) {
805805
if (value && !strcasecmp(value, "input")) {
806-
if (core_eol == EOL_CRLF)
807-
return error("core.autocrlf=input conflicts with core.eol=crlf");
808806
auto_crlf = AUTO_CRLF_INPUT;
809807
return 0;
810808
}
@@ -830,8 +828,6 @@ static int git_default_core_config(const char *var, const char *value)
830828
core_eol = EOL_NATIVE;
831829
else
832830
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");
835831
return 0;
836832
}
837833

convert.c

+7-12
Original file line numberDiff line numberDiff line change
@@ -1380,27 +1380,22 @@ static struct stream_filter *ident_filter(const unsigned char *sha1)
13801380
struct stream_filter *get_stream_filter(const char *path, const unsigned char *sha1)
13811381
{
13821382
struct conv_attrs ca;
1383-
enum crlf_action crlf_action;
13841383
struct stream_filter *filter = NULL;
13851384

13861385
convert_attrs(&ca, path);
1387-
13881386
if (ca.drv && (ca.drv->smudge || ca.drv->clean))
1389-
return filter;
1387+
return NULL;
1388+
1389+
if (ca.crlf_action == CRLF_AUTO || ca.crlf_action == CRLF_AUTO_CRLF)
1390+
return NULL;
13901391

13911392
if (ca.ident)
13921393
filter = ident_filter(sha1);
13931394

1394-
crlf_action = ca.crlf_action;
1395-
1396-
if ((crlf_action == CRLF_BINARY) ||
1397-
crlf_action == CRLF_AUTO_INPUT ||
1398-
(crlf_action == CRLF_TEXT_INPUT))
1399-
filter = cascade_filter(filter, &null_filter_singleton);
1400-
1401-
else if (output_eol(crlf_action) == EOL_CRLF &&
1402-
!(crlf_action == CRLF_AUTO || crlf_action == CRLF_AUTO_CRLF))
1395+
if (output_eol(ca.crlf_action) == EOL_CRLF)
14031396
filter = cascade_filter(filter, lf_to_crlf_filter());
1397+
else
1398+
filter = cascade_filter(filter, &null_filter_singleton);
14041399

14051400
return filter;
14061401
}

0 commit comments

Comments
 (0)