summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-11 20:05:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-11 20:05:45 (GMT)
commit77f3c3f17401a74b9036188a6a6a4fe2c4b53ccb (patch)
tree495b1e7e6400c0fb506d97bceb3bacd005f9021e /diff.c
parente29497d28ce1ec9f76493542fcab4a8d61ca5fce (diff)
parent5430bb283b478991a979437a79e10dcbb6f20e28 (diff)
downloadgit-77f3c3f17401a74b9036188a6a6a4fe2c4b53ccb.zip
git-77f3c3f17401a74b9036188a6a6a4fe2c4b53ccb.tar.gz
git-77f3c3f17401a74b9036188a6a6a4fe2c4b53ccb.tar.bz2
Merge branch 'jc/maint-diff-core-safecrlf'
"git diff" refused to even show difference when core.safecrlf is set to true (i.e. error out) and there are offending lines in the working tree files. * jc/maint-diff-core-safecrlf: diff: demote core.safecrlf=true to core.safecrlf=warn
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 208094f..e53ddad 100644
--- a/diff.c
+++ b/diff.c
@@ -2677,6 +2677,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))
@@ -2732,7 +2740,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;