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

[PATCH 1/2] Fix "git diff" setup code

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Sep 14, 2007, 17:17 UTC
Message-ID
<alpine.LFD.0.999.0709141014130.16478@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.999.0709141002360.16478@woody.linux-foundation.org>

For some inexplicable reason, "git diff" would call "diff_setup_done()" iff we hadn't given an explicit output format.

That makes no sense, since much of what diff_setup_done() does is exactly about checking the output format!

This just moves the call to "diff_setup_done()" out of the conditional, and to where we've actually done all of the diffopt changes.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 builtin-diff.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/builtin-diff.c b/builtin-diff.c
index f77352b..cb4743b 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -252,13 +252,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 		argc = 0;
 	else
 		argc = setup_revisions(argc, argv, &rev, NULL);
-	if (!rev.diffopt.output_format) {
+	if (!rev.diffopt.output_format)
 		rev.diffopt.output_format = DIFF_FORMAT_PATCH;
-		if (diff_setup_done(&rev.diffopt) < 0)
-			die("diff_setup_done failed");
-	}
 	rev.diffopt.allow_external = 1;
 	rev.diffopt.recursive = 1;
+	if (diff_setup_done(&rev.diffopt) < 0)
+		die("diff_setup_done failed");
 
 	/* If the user asked for our exit code then don't start a
 	 * pager or we would end up reporting its exit code instead.
Previous: Linus TorvaldsNext: Linus Torvalds
Message 5 of 13 in “git-commit: Disallow unchanged tree in non-merge mode”
  1. 1/2 git-commit: Disallow unchanged tree in non-merge modeDmitry V. Levin, Sep 5, 2007
  2. Shawn O. PearceSep 6, 2007
  3. Dmitry V. LevinSep 6, 2007
  4. Linus TorvaldsSep 14, 2007
  5. 1/2 Fix "git diff" setup codeLinus Torvalds, Sep 14, 2007
  6. 2/2 Fix the rename detection limit checkingLinus Torvalds, Sep 14, 2007
  7. Linus TorvaldsSep 14, 2007
  8. Linus TorvaldsSep 14, 2007
  9. Junio C HamanoSep 14, 2007
  10. Linus TorvaldsSep 14, 2007
  11. Junio C HamanoSep 14, 2007
  12. Linus TorvaldsSep 14, 2007
  13. Junio C HamanoSep 14, 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.