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

Re: [PATCH] config option core.showroot to enable showing the diff of the root commit

From
Junio C Hamano <junkio@cox.net>
Date
Nov 24, 2006, 08:54 UTC
Message-ID
<7vlkm1cjht.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<slrnemd98k.a3v.Peter.B.Baumann@xp.machine.xx>

Peter Baumann <Peter.B.Baumann@stud.informatik.uni-erlangen.de> writes:

> One question, what's the difference between git-log -p and
> git-whatchanged -p?
> ...
> As you can see, the root commit isn't shown. Is this intentional?
Some historical background.

The traditional command do do log-minded things was whatchanged and it was implemented as

	git rev-list $revision_args -- $path_limits |
        git diff-tree --stdin --pretty -r $format_args

and whatchanged did not give --root to diff-tree by default. And 'diff-tree' does not show --pretty logs when there is no diff to be shown (which still is true today and is a useful behaviour), hence no mention of the root commit.

On the other hand, "git-log" traditionally looked like this:
	git rev-list --pretty $revision_args 

Back then, there was no path_limits nor even diff options to it.

Later, Linus (with help from others) made the revision walk machinery as callable inside programs other than "rev-list", eliminating the need to pipe rev-list into diff-tree to perform log-minded things. That enriched what "git log" can do, and mostly made "whatchanged" a redundant command. As you may have noticed, there isn't much difference between these two commands in builtin-log.c; their differences are solely what default options for diff and revision machinery are used and are meant to match the traditional behaviour of these commands.

So there shouldn't be any differences, really, when you override their defaults with the likes of -p.

Honestly speaking, I do not think there was _any_ consciously designed intention to handle root commits, either to make these commands behave identically or differently; regarding parentless commits, they just behave the way they happen to behave, because root commits were not something either Linus nor I were interested in.

Given the recent discussion, however, the intention now should be that Porcelain level commands should default to do --root (i.e. when asked to do "diff" to show how a commit without a parent differs from its nonexistent parent, show diff with emptiness).

Previous: Peter BaumannNext: Peter Baumann
Message 32 of 35 in “git-show --stat on first commit”
  1. Andy ParkinsNov 21, 2006
  2. Jakub NarebskiNov 21, 2006
  3. Santi BéjarNov 21, 2006
  4. Peter BaumannNov 21, 2006
  5. Jakub NarebskiNov 21, 2006
  6. Peter BaumannNov 21, 2006
  7. Linus TorvaldsNov 21, 2006
  8. Shawn PearceNov 21, 2006
  9. Peter BaumannNov 21, 2006
  10. Linus TorvaldsNov 21, 2006
  11. Olivier GalibertNov 21, 2006
  12. Shawn PearceNov 21, 2006
  13. Petr BaudisNov 21, 2006
  14. Petr BaudisNov 21, 2006
  15. Jakub NarebskiNov 21, 2006
  16. Petr BaudisNov 21, 2006
  17. Shawn PearceNov 21, 2006
  18. Andy ParkinsNov 21, 2006
  19. Petr BaudisNov 21, 2006
  20. Shawn PearceNov 21, 2006
  21. Petr BaudisNov 21, 2006
  22. Junio C HamanoNov 21, 2006
  23. Jakub NarebskiNov 21, 2006
  24. Andy ParkinsNov 23, 2006
  25. Jakub NarebskiNov 24, 2006
  26. config option core.showroot to enable showing the diff of the root commitPeter Baumann, Nov 23, 2006
  27. Junio C HamanoNov 23, 2006
  28. Peter BaumannNov 23, 2006
  29. Junio C HamanoNov 24, 2006
  30. Junio C HamanoNov 24, 2006
  31. Peter BaumannNov 24, 2006
  32. Junio C HamanoNov 24, 2006
  33. Peter BaumannNov 24, 2006
  34. Carl WorthNov 21, 2006
  35. Junio C HamanoNov 21, 2006

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.