diff options
author | Torsten Bögershausen <tboegi@web.de> | 2016-02-23 18:07:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-23 12:53:15 -0800 |
commit | 817a0c7968c1d7e0f574b6d07451445832f781aa (patch) | |
tree | a550bc41523ad300752b161eaad2c0b2d8508adb /convert.c | |
parent | 6e336a530b0dd98d1c751440ca5666a6999ab020 (diff) | |
download | git-817a0c7968c1d7e0f574b6d07451445832f781aa.tar.gz |
convert.c: correct attr_action()tb/conversion
df747b81 (convert.c: refactor crlf_action, 2016-02-10) introduced a
bug to "git ls-files --eol".
The "text" attribute was shown as "text eol=lf" or "text eol=crlf",
depending on core.autocrlf or core.eol.
Correct this and add test cases in t0027.
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.c')
-rw-r--r-- | convert.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -708,7 +708,7 @@ static enum crlf_action git_path_check_crlf(struct git_attr_check *check) const char *value = check->value; if (ATTR_TRUE(value)) - return text_eol_is_crlf() ? CRLF_TEXT_CRLF : CRLF_TEXT_INPUT; + return CRLF_TEXT; else if (ATTR_FALSE(value)) return CRLF_BINARY; else if (ATTR_UNSET(value)) @@ -778,20 +778,20 @@ static void convert_attrs(struct conv_attrs *ca, const char *path) } if (!git_check_attr(path, NUM_CONV_ATTRS, ccheck)) { - enum eol eol_attr; ca->crlf_action = git_path_check_crlf(ccheck + 4); if (ca->crlf_action == CRLF_UNDEFINED) ca->crlf_action = git_path_check_crlf(ccheck + 0); ca->attr_action = ca->crlf_action; ca->ident = git_path_check_ident(ccheck + 1); ca->drv = git_path_check_convert(ccheck + 2); - if (ca->crlf_action == CRLF_BINARY) - return; - eol_attr = git_path_check_eol(ccheck + 3); - if (eol_attr == EOL_LF) - ca->crlf_action = CRLF_TEXT_INPUT; - else if (eol_attr == EOL_CRLF) - ca->crlf_action = CRLF_TEXT_CRLF; + if (ca->crlf_action != CRLF_BINARY) { + enum eol eol_attr = git_path_check_eol(ccheck + 3); + if (eol_attr == EOL_LF) + ca->crlf_action = CRLF_TEXT_INPUT; + else if (eol_attr == EOL_CRLF) + ca->crlf_action = CRLF_TEXT_CRLF; + } + ca->attr_action = ca->crlf_action; } else { ca->drv = NULL; ca->crlf_action = CRLF_UNDEFINED; |