On Tue, 8 Jan 2008, Junio C Hamano wrote:
>
> I think the project can mark text files as text with attributes
> and if the port to the platform initialized core.autocrlf
> appropriately for the platform everything should work as you
> described.
Yes, I think core.autocrlf should default to "true" on Windows, since
that is what it's about. The alternative is to have "fail"/"warn", to just
make sure that nobody can do the wrong thing by mistake.
We could just do something like this, although that probably does mean
that the whole test-suite needs to be double-checked (ie now we really do
behave differently on windows outside of any config options!))
People who really dislike it can always do the
git config --global core.autocrlf false
thing.
(And no, I don't know if "#ifdef __WINDOWS__" is the right thing to do,
it's almost certainly not. This is just a draft.)
Linus
---
environment.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/environment.c b/environment.c
index 18a1c4e..5766bee 100644
--- a/environment.c
+++ b/environment.c
@@ -34,9 +34,23 @@ char *pager_program;
int pager_use_color = 1;
char *editor_program;
char *excludes_file;
-int auto_crlf = 0; /* 1: both ways, -1: only when adding git objects */
unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
+/*
+ * Automatic CRLF conversion on files that look like
+ * text:
+ * 0: none (unix)
+ * 1: convert to LF on check-in and to CRLF on check-out
+ * -1: only on check-in (check-out with just LF)
+ */
+#ifdef __WINDOWS__
+ #define DEF_AUTOCRLF 1
+#else
+ #define DEF_AUTOCRLF 0
+#endif
+
+int auto_crlf = DEF_AUTOCRLF;
+
/* This is set by setup_git_dir_gently() and/or git_default_config() */
char *git_work_tree_cfg;
static const char *work_tree;