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

Re: [PATCH] Documentation/git-diff: remove -r from --name-status example

From
Jeff King <peff@peff.net>
Date
Jul 29, 2007, 09:49 UTC
Message-ID
<20070729094955.GA14915@coredump.intra.peff.net>
In-Reply-To
<7vwswjmu08.fsf@assigned-by-dhcp.cox.net>
On Sun, Jul 29, 2007 at 02:36:23AM -0700, Junio C Hamano wrote:
> In short, I think recursive behaviour by default makes sense for
> "git diff".
Your reasoning sounds sane to me.

Here is the patch with a commit message more succint than all of these emails.

-- >8 -- git-diff: turn on recursion by default

The tree recursion behavior of git-diff may appear inconsistent to the user because it depends on the format of the patch as well as whether one is diffing between trees or against the index.

Since git-diff is a porcelain wrapper for low-level diff commands, it makes sense for its behavior to be consistent no matter what is being diffed. This patch turns on recursion in all cases.

diff --git a/builtin-diff.c b/builtin-diff.c
index 7f367b6..b48121e 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -233,6 +233,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 			die("diff_setup_done failed");
 	}
 	rev.diffopt.allow_external = 1;
+	rev.diffopt.recursive = 1;
 
 	/* Do we have --cached and not have a pending object, then
 	 * default to HEAD by hand.  Eek.
Previous: Junio C HamanoNext: Johannes Schindelin
Message 9 of 18 in “Documentation/git-diff: remove -r from --name-status example”
  1. Documentation/git-diff: remove -r from --name-status exampleJeff King, Jul 29, 2007
  2. Linus TorvaldsJul 29, 2007
  3. Jeff KingJul 29, 2007
  4. Linus TorvaldsJul 29, 2007
  5. Junio C HamanoJul 29, 2007
  6. Jeff KingJul 29, 2007
  7. David KastrupJul 29, 2007
  8. Junio C HamanoJul 29, 2007
  9. Jeff KingJul 29, 2007
  10. Johannes SchindelinJul 29, 2007
  11. David KastrupJul 29, 2007
  12. Jeff KingJul 29, 2007
  13. Johannes SchindelinJul 29, 2007
  14. Jeff KingJul 29, 2007
  15. Johannes SchindelinJul 29, 2007
  16. Jeff KingJul 29, 2007
  17. Linus TorvaldsJul 29, 2007
  18. Jeff KingJul 29, 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.