summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-12 05:15:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-12 05:15:28 (GMT)
commit04c6e9e9ca34226db095bbaa1218030f99f0b7c6 (patch)
tree908b3080f7e373c20805d917bba6c2c2d505da1d /diff.c
parent7e4ad908721445b073f3b4ecad55bbd78f032cdc (diff)
downloadgit-04c6e9e9ca34226db095bbaa1218030f99f0b7c6.zip
git-04c6e9e9ca34226db095bbaa1218030f99f0b7c6.tar.gz
git-04c6e9e9ca34226db095bbaa1218030f99f0b7c6.tar.bz2
diff --check: do not unconditionally complain about trailing empty lines
Recently "git diff --check" learned to detect new trailing blank lines just like "git apply --whitespace" does. However this check should not trigger unconditionally. This patch makes it honor the whitespace settings from core.whitespace and gitattributes. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 8746c60..6954f99 100644
--- a/diff.c
+++ b/diff.c
@@ -1631,7 +1631,8 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
ecb.priv = &data;
xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
- if (data.trailing_blanks_start) {
+ if ((data.ws_rule & WS_TRAILING_SPACE) &&
+ data.trailing_blanks_start) {
fprintf(o->file, "%s:%d: ends with blank lines.\n",
data.filename, data.trailing_blanks_start);
data.status = 1; /* report errors */