Re: [PATCH v1 5/7] CRLF: unify the "auto" handling
From: Eric Sunshine <hidden>
Date: 2016-06-15 23:09:06
On Tue, Mar 29, 2016 at 9:25 AM, [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Make .gitattributes "* text=auto eol=crlf" to do the same as setting core.autocrlf=true and "* text=auto eol=crlf" the same as core.autocrlf=input Signed-off-by: Torsten Bögershausen <redacted> ---diff --git a/Documentation/config.txt b/Documentation/config.txt@@ -389,14 +389,15 @@ file with mixed line endings would be reported by the `core.safecrlf` core.autocrlf:: - Setting this variable to "true" is almost the same as setting - the `text` attribute to "auto" on all files except that text - files are not guaranteed to be normalized: files that contain + Setting this variable to "true" is the same as setting + the attributes to "auto eol=crlf" on all files. + Files are not guaranteed to be normalized: files that contain `CRLF` in the repository will not be touched. Use this setting if you want to have `CRLF` line endings in your - working directory even though the repository does not have - normalized line endings. This variable can be set to 'input', + working directory and he repository has normalized line endings.
s/he/the/
+ This variable can be set to 'input',
in which case no output conversion is performed.
+ Note: older versions of Git behave different.Would it make sense to spell out what "different" means since new readers won't know what the old behavior was?
quoted hunk ↗ jump to hunk
diff --git a/convert.c b/convert.c@@ -370,12 +369,10 @@ static int crlf_to_worktree(const char *path, const char *src, size_t len, if (crlf_action == CRLF_AUTO || crlf_action == CRLF_AUTO_INPUT || crlf_action == CRLF_AUTO_CRLF) { - if (crlf_action == CRLF_AUTO_INPUT || crlf_action == CRLF_AUTO_CRLF) { - /* If we have any CR or CRLF line endings, we do not touch it */ - /* This is the new safer autocrlf-handling */ - if (stats.lonecr || stats.crlf ) - return 0; - } + /* If we have any CR or CRLF line endings, we do not touch it */ + /* This is the new safer autocrlf-handling */
The comment style violation could have been fixed while outdenting, but perhaps it's not worth the churn.
+ if (stats.lonecr || stats.crlf ) + return 0;