Subject: [PATCH] diff: squelch empty diffs even more

From: René Scharfe <[email-masked]>
Date: Tue, 14 Aug 2007 23:09:57 +0200

When we compare two non-tracked files or explicitly specify
--no-index then the suggestion to run git-status is not helpful.
max_count is set to -2 in these cases; don't print the warning
then.

Signed-off-by: Rene Scharfe <[email-masked]>
---

 builtin-diff.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin-diff.c b/builtin-diff.c
index 6ed7b68..b2fd8c8 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -346,8 +346,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 	if (rev.diffopt.exit_with_status)
 		result = rev.diffopt.has_changes;
 
-	if ((rev.diffopt.output_format & DIFF_FORMAT_PATCH)
-	    && (1 < rev.diffopt.skip_stat_unmatch))
+	if ((rev.diffopt.output_format & DIFF_FORMAT_PATCH) &&
+	    1 < rev.diffopt.skip_stat_unmatch && rev.max_count != -2)
 		printf("Warning: %d path%s touched but unmodified. "
 		       "Consider running git-status.\n",
 		       rev.diffopt.skip_stat_unmatch - 1,