Commit a5115842 by Sven Strickroth

crlf: update checkout logic to reflect Git 2.9+ behaviour

Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent ad5a696e
...@@ -3,6 +3,8 @@ v0.27 + 1 ...@@ -3,6 +3,8 @@ v0.27 + 1
### Changes or improvements ### Changes or improvements
* Update CrLf checkout code to vanilla Git >= 2.9 logic
### API additions ### API additions
### API removals ### API removals
......
...@@ -71,6 +71,9 @@ static int crlf_input_action(struct crlf_attrs *ca) ...@@ -71,6 +71,9 @@ static int crlf_input_action(struct crlf_attrs *ca)
if (ca->eol == GIT_EOL_LF) if (ca->eol == GIT_EOL_LF)
return GIT_CRLF_INPUT; return GIT_CRLF_INPUT;
if (ca->crlf_action == GIT_CRLF_AUTO)
return GIT_CRLF_AUTO;
if (ca->eol == GIT_EOL_CRLF) if (ca->eol == GIT_EOL_CRLF)
return GIT_CRLF_CRLF; return GIT_CRLF_CRLF;
...@@ -200,6 +203,8 @@ static const char *line_ending(struct crlf_attrs *ca) ...@@ -200,6 +203,8 @@ static const char *line_ending(struct crlf_attrs *ca)
break; break;
case GIT_CRLF_AUTO: case GIT_CRLF_AUTO:
if (ca->eol == GIT_EOL_CRLF)
return "\r\n";
case GIT_CRLF_TEXT: case GIT_CRLF_TEXT:
break; break;
...@@ -253,8 +258,7 @@ static int crlf_apply_to_workdir( ...@@ -253,8 +258,7 @@ static int crlf_apply_to_workdir(
ca->crlf_action == GIT_CRLF_GUESS) { ca->crlf_action == GIT_CRLF_GUESS) {
/* If we have any existing CR or CRLF line endings, do nothing */ /* If we have any existing CR or CRLF line endings, do nothing */
if (ca->crlf_action == GIT_CRLF_GUESS && if (stats.cr > 0 && stats.crlf > 0)
stats.cr > 0 && stats.crlf > 0)
return GIT_PASSTHROUGH; return GIT_PASSTHROUGH;
/* If we have bare CR characters, do nothing */ /* If we have bare CR characters, do nothing */
...@@ -314,7 +318,7 @@ static int crlf_check( ...@@ -314,7 +318,7 @@ static int crlf_check(
ca.auto_crlf == GIT_AUTO_CRLF_FALSE) ca.auto_crlf == GIT_AUTO_CRLF_FALSE)
return GIT_PASSTHROUGH; return GIT_PASSTHROUGH;
if (ca.auto_crlf == GIT_AUTO_CRLF_INPUT && if (ca.auto_crlf == GIT_AUTO_CRLF_INPUT && ca.eol != GIT_EOL_CRLF &&
git_filter_source_mode(src) == GIT_FILTER_SMUDGE) git_filter_source_mode(src) == GIT_FILTER_SMUDGE)
return GIT_PASSTHROUGH; return GIT_PASSTHROUGH;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment