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
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 29, 2007, 12:04 UTC
Message-ID
<Pine.LNX.4.64.0707291258410.14781@racer.site>
In-Reply-To
<20070729113850.GA17796@coredump.intra.peff.net>
Hi,
On Sun, 29 Jul 2007, Jeff King wrote:
Show 10 quoted lines
> On Sun, Jul 29, 2007 at 12:14:49PM +0100, Johannes Schindelin wrote:
> 
> > How about
> > 
> > 	if (!rev.diffopt.quiet)
> > 		rev.diffopt.recursive = 1;
> > 
> > instead?
> 
> Can you explain?

The idea is this: when "--quiet" was given, we do not output anything, and therefore do not have to recurse into the directories, because we already know that there are differences when a _tree_ is different. I do not remember all details of the "--quiet" implementation, but I think that it

- exits early (as you said)
- does not turn on "recursive" to avoid unnecessary work.

Imagine something like this: tree "a" and "b" contain 100,000 elements each, which are identical except for the last entry. "--quiet" does not need to check the 99,999 elements before that one, since the tree hashes are already different.

Of course, this reasoning breaks down fatally when you specify something like "--ignore-whitespace", but those cases should turn on recursive explicitely, so that the performance penalty of "recursive = 1" does not percolate back to the (much more common) trivial cases.

Ciao, Dscho

Previous: Jeff KingNext: Jeff King
Message 13 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.