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

Re: Inconsistencies with git log

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Nov 9, 2007, 18:36 UTC
Message-ID
<alpine.LFD.0.999.0711091029160.15101@woody.linux-foundation.org>
In-Reply-To
<20071109182248.GD28800@xp.machine.xx>
On Fri, 9 Nov 2007, Peter Baumann wrote:
> 
> Hm. I tried to run your 'git log' and 'git log .' example and a diff
> revealed that the output of those two isn't the same, contrary to what I
> thought.
Btw, you can *make* them the same by using
	git log --full-history --sparse .

which basically tells git that you do not want any of the history simplification that git log does by default.

There's two different kinds of simplifications (which is why there are two kinds of switches above):

 - the "simplify merges to just the parent that is identical"
   This basically means that if a merge result comes 100% from one of the 
   parents, by default we will only look at that parent. Using 
   --full-history avoids this.
 - the "dense" history, which removes simple commits that don't make any 
   changes
   This is the "--sparse" thing: it says that we're interested even in 
   regular commits that simply don't make any changes.
> In the 'git-log .' case, there should be done a history simplification,
> but then only commits which don't change anything are pruned and AFAIR
> 'git commit' doesn't allow this.
Actually, git itself creates these commits under several circumstances:
 - you can *force* it. No, "git commit" on its own doesn't allow it, but 
   you can do it quite easily with "git commit-tree" and setting things 
   up by hand.
 - you can import history from other SCM's. I think all importers will 
   honor other SCM's, and if they allow empty commits then the end result 
   will have empty commits in it too!
 - merges. This is the common case. You have a "git merge --ours" or 
   similar, which basically merges just one side (or, even without 
   "--ours", this is really common for the non-"." case: a merge just 
   doesn't touch some files at all). Then, the merge simplifier will first 
   turn it into a "single parent", and then densification will remove that 
   (now uninteresting) empty merge.
> Using core git, one could create commits with the same tree as their 
> parent, but I don't think that all the commits which get removed in the 
> '.' case where produced that way. There has to be another case I can't 
> figure out.
See above. Three cases, in fact.
		Linus
Previous: Peter BaumannNext: Jakub Narebski
Message 23 of 48 in “Inconsistencies with git log”
  1. Jon SmirlNov 7, 2007
  2. Johannes SchindelinNov 7, 2007
  3. Jon SmirlNov 7, 2007
  4. Johannes SchindelinNov 7, 2007
  5. Jon SmirlNov 7, 2007
  6. Johannes SchindelinNov 7, 2007
  7. Jon SmirlNov 7, 2007
  8. Jon SmirlNov 7, 2007
  9. Johannes SchindelinNov 8, 2007
  10. Jon SmirlNov 8, 2007
  11. Andreas EricssonNov 8, 2007
  12. Johannes SchindelinNov 8, 2007
  13. Linus TorvaldsNov 9, 2007
  14. Jon SmirlNov 9, 2007
  15. Linus TorvaldsNov 9, 2007
  16. Linus TorvaldsNov 9, 2007
  17. Jon SmirlNov 9, 2007
  18. Linus TorvaldsNov 9, 2007
  19. Peter BaumannNov 9, 2007
  20. Junio C HamanoNov 9, 2007
  21. Jakub NarebskiNov 9, 2007
  22. Peter BaumannNov 9, 2007
  23. Linus TorvaldsNov 9, 2007
  24. Jakub NarebskiNov 9, 2007
  25. Wincent ColaiutaNov 8, 2007
  26. Daniel BarkalowNov 8, 2007
  27. Brian GernhardtNov 7, 2007
  28. David SymondsNov 7, 2007
  29. Johannes SchindelinNov 8, 2007
  30. David SymondsNov 8, 2007
  31. Brian GernhardtNov 8, 2007
  32. 1/2 Makefile: wt-status.h is also a lib headerJohannes Schindelin, Nov 8, 2007
  33. Andreas EricssonNov 8, 2007
  34. Peter BaumannNov 8, 2007
  35. David SymondsNov 8, 2007
  36. Andreas EricssonNov 8, 2007
  37. Alex RiesenNov 8, 2007
  38. Alex RiesenNov 8, 2007
  39. 2/2 git status: show relative paths when run in a subdirectoryJohannes Schindelin, Nov 8, 2007
  40. David SymondsNov 8, 2007
  41. Johannes SchindelinNov 8, 2007
  42. Junio C HamanoNov 8, 2007
  43. 2/2 git status: show relative paths when run in a subdirectoryJohannes Schindelin, Nov 9, 2007
  44. Michel MartiNov 10, 2007
  45. Johannes SchindelinNov 10, 2007
  46. Wincent ColaiutaNov 8, 2007
  47. Miles BaderNov 10, 2007
  48. David SymondsNov 7, 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.