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

Re: git-show --stat on first commit

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 21, 2006, 16:31 UTC
Message-ID
<Pine.LNX.4.64.0611210820100.3338@woody.osdl.org>
In-Reply-To
<slrnem694k.4lm.Peter.B.Baumann@xp.machine.xx>
On Tue, 21 Nov 2006, Peter Baumann wrote:
> 
> Why not make --root the default? I also stumbled over this behaviour and
> even asked on this list.

I suspect we should make the thing a config option, and default it to "on".

I personally do _not_ want to see the root commit, because for the kernel, it's a honking huge import that does not make sense as a "diff". It's not really a diff against anything, after all - it's an import.

That's really the reason why git defaults to not showing the root diff at all: exactly because for the kernel, the initial commit was state that "just came to be", and I found it both illogical and annoying to see it as a diff, since that commit really was a "black hole" where previous history just disappeared.

But if you have the _full_ history with a new project, "--root" by default probably makes tons of sense.

> And one less "wart" to clean, which another thread is all about. :-)

I really don't think it's a wart - see above - but it depends on the project.

There's also another reason for the root being special, which is purely git-internal: the root really has no parents at all, and the normal "git diff" is "diff against parents". So from a purely implementation standpoint, the "root" case is actually a special case, and for a while I was kind of wondering whether I should do what a lot of other SCM's seem to do, namely start out with an "empty root" when doing "git init-db".

git didn't end up doing that (and I'm personally pretty happy about it), but it was one of the things I was kind of thinking about: a "git import" kind of thing would have created an initial commit which was pre-populated with the thing to import, and a "git init-db" would have created an initial root commit that was empty.

That would have made the current "don't show the root diff" behaviour very natural (and you'd still have gotten the initial diff for a new project), but on the other hand, it would have had that annoying unnecessary "init" commit, and you'd _still_ have wanted to have something like "--root" in order to show the import commit as a patch (which you _sometimes_ want to do).

So having a config option would solve the problem, but what annoys me right now about the config options is that we really should have a graphical front-end to setting those things or something, because while _I_ don't have any issues with editing a ".git/config" file, I think we're getting to the point where a lot of our problems are really about "you can do it, but you have to know a lot about git to even know you can do it".

Previous: Peter BaumannNext: Shawn Pearce
Message 7 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.