@matheusbsbs / matheus-bagliano / commits / d7f4633405
Fork 0

Make AutoCRLF ternary variable.

This allows you to do: [core] AutoCRLF = input and it should do only the CRLF->LF translation (ie it simplifies CRLF only when reading working tree files, but when checking out files, it leaves the LF alone, and doesn't turn it into a CRLF). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Feb 13, 2007 at 18:16 UTC d7f4633405acf3dc09798a759463c616c7c49dfd
3 files changed +6 -2
config.c
+4
@@ -325,6 +325,10 @@ int git_default_config(const char *var, const char *value)
325 }
326
327 if (!strcmp(var, "core.autocrlf")) {
328 + if (value && !strcasecmp(value, "input")) {
329 + auto_crlf = -1;
330 + return 0;
331 + }
332 auto_crlf = git_config_bool(var, value);
333 return 0;
334 }
convert.c
+1 -1
@@ -140,7 +140,7 @@ int convert_to_working_tree(const char *path, char **bufp, unsigned long *sizep)
140 * based on filename patterns. Right now we just do the
141 * stupid auto-CRLF one.
142 */
143 - if (!auto_crlf)
143 + if (auto_crlf <= 0)
144 return 0;
145
146 size = *sizep;
environment.c
+1 -1
@@ -28,7 +28,7 @@ size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
28 size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
29 int pager_in_use;
30 int pager_use_color = 1;
31 -int auto_crlf = 0;
31 +int auto_crlf = 0; /* 1: both ways, -1: only when adding git objects */
32
33 static const char *git_dir;
34 static char *git_object_dir, *git_index_file, *git_refs_dir, *git_graft_file;