aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorEyvind Bernhardsen <eyvind.bernhardsen@gmail.com>2010-06-04 21:29:08 +0200
committerJunio C Hamano <gitster@pobox.com>2010-06-06 21:20:04 -0700
commit942e7747678ecf5f118ea5b2d0c763166de21f3a (patch)
tree0e5f1e1e72682b183831d0ee76485b6b09e0df41 /config.c
parent5ec3e67052289217c84e53d2cda90d939ac5725b (diff)
downloadgit-942e7747678ecf5f118ea5b2d0c763166de21f3a.tar.gz
git-942e7747678ecf5f118ea5b2d0c763166de21f3a.tar.xz
Add "core.eol" config variable
Introduce a new configuration variable, "core.eol", that allows the user to set which line endings to use for end-of-line-normalized files in the working directory. It defaults to "native", which means CRLF on Windows and LF everywhere else. Note that "core.autocrlf" overrides core.eol. This means that [core] autocrlf = true puts CRLFs in the working directory even if core.eol is set to "lf". Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/config.c b/config.c
index b60a1ff64..1479ee6ed 100644
--- a/config.c
+++ b/config.c
@@ -461,6 +461,8 @@ static int git_default_core_config(const char *var, const char *value)
if (!strcmp(var, "core.autocrlf")) {
if (value && !strcasecmp(value, "input")) {
+ if (eol == EOL_CRLF)
+ return error("core.autocrlf=input conflicts with core.eol=crlf");
auto_crlf = AUTO_CRLF_INPUT;
return 0;
}
@@ -477,6 +479,20 @@ static int git_default_core_config(const char *var, const char *value)
return 0;
}
+ if (!strcmp(var, "core.eol")) {
+ if (value && !strcasecmp(value, "lf"))
+ eol = EOL_LF;
+ else if (value && !strcasecmp(value, "crlf"))
+ eol = EOL_CRLF;
+ else if (value && !strcasecmp(value, "native"))
+ eol = EOL_NATIVE;
+ else
+ eol = EOL_UNSET;
+ if (eol == EOL_CRLF && auto_crlf == AUTO_CRLF_INPUT)
+ return error("core.autocrlf=input conflicts with core.eol=crlf");
+ return 0;
+ }
+
if (!strcmp(var, "core.notesref")) {
notes_ref_name = xstrdup(value);
return 0;