summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-24 21:35:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-25 20:55:03 (GMT)
commit5430bb283b478991a979437a79e10dcbb6f20e28 (patch)
tree4f9a2a82ee0ffc5080b3fd5e1502adc1440f3d36 /diff.c
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-5430bb283b478991a979437a79e10dcbb6f20e28.zip
git-5430bb283b478991a979437a79e10dcbb6f20e28.tar.gz
git-5430bb283b478991a979437a79e10dcbb6f20e28.tar.bz2
diff: demote core.safecrlf=true to core.safecrlf=warn
Otherwise the user will not be able to start to guess where in the contents in the working tree the offending unsafe CR lies. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 32142db..3e406f1 100644
--- a/diff.c
+++ b/diff.c
@@ -2647,6 +2647,14 @@ static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
int diff_populate_filespec(struct diff_filespec *s, int size_only)
{
int err = 0;
+ /*
+ * demote FAIL to WARN to allow inspecting the situation
+ * instead of refusing.
+ */
+ enum safe_crlf crlf_warn = (safe_crlf == SAFE_CRLF_FAIL
+ ? SAFE_CRLF_WARN
+ : safe_crlf);
+
if (!DIFF_FILE_VALID(s))
die("internal error: asking to populate invalid file.");
if (S_ISDIR(s->mode))
@@ -2702,7 +2710,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
/*
* Convert from working tree format to canonical git format
*/
- if (convert_to_git(s->path, s->data, s->size, &buf, safe_crlf)) {
+ if (convert_to_git(s->path, s->data, s->size, &buf, crlf_warn)) {
size_t size = 0;
munmap(s->data, s->size);
s->should_munmap = 0;