git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] diff: squelch empty diffs even more

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Aug 14, 2007, 21:09 UTC
Message-ID
<46C21A25.2040304@lsrfire.ath.cx>

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 <rene.scharfe@lsfire.ath.cx>
---
 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,
Next: Junio C Hamano
Message 1 of 5 in “diff: squelch empty diffs even more”
  1. diff: squelch empty diffs even moreRené Scharfe, Aug 14, 2007
  2. Junio C HamanoAug 14, 2007
  3. René ScharfeAug 14, 2007
  4. Junio C HamanoAug 14, 2007
  5. Johannes SchindelinAug 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.