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

Re: Bizarre missing changes (git bug?)

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 29, 2008, 17:25 UTC
Message-ID
<alpine.LFD.1.10.0807291006070.3334@nehalem.linux-foundation.org>
In-Reply-To
<20080729125247.GC12069@sigill.intra.peff.net>
On Tue, 29 Jul 2008, Jeff King wrote:
> 
> I glanced briefly over "gitk kernel/printk.c" and it looks pretty sane.
Jeff, it _is_ sane. When Roman says it's "incorrect", he is just wrong.

But it's true that "gitk kernel/printk.c" does simplify the history, and does so very aggressively. It does so very much by design, and has done it since pretty much day one. And it's a good thing - and it is "correct" - but it does mean that you may literally be missing things that are part of "history" but that didn't matter much.

The most trivial way to show this is actually by making such a simple case that it's obvious what is going on. Do this:

	mkdir test-simplification
	cd test-simplification
	git init
	echo "Hi there" > file
	git add file
	git commit -m"Initial file"
	git branch other-branch
	echo "Hello" > file
	git add file
	git commit -m"Modified file"
	git checkout other-branch
	echo "Hello" > file
	git add file
	git commit -m"Another person modified the file identically"
	echo "This is a stupid example" > another-file
	git add another-file
	git commit -m"Add another file"
	git merge master
Now, do these three things
	gitk
	gitk file
	gitk --full-history file
and compare them. They all show _different_ histories.

Which one is "correct"? They all are. It just depends on what you want to see.

The "gitk file" history is the simplest one BY FAR, because it has very aggressively simplified history to the point where it tried to find the _simplest_ history that explains the current contents of 'file'[*]

>From a practical standpoint, and from having used this a long time, I'd 

argue that the simple history is the one that you want 99.9% of all time. But not _always_. Sometimes, the things that got simplified away actually matter. It's rare, but it happens.

For example, maybe you had a bug-fix that you _know_ you did, and it it doesn't show up in the simplified history. That really pisses you off, and it apparently really pisses Roman off that it can happen. But the fact is, that still doesn't mean that the simple history is "wrong" or even "incomplete".

No, it's actually meaningful data in itself. If the bug-fix doesn't show in the simplified history, then that simply means that the bug-fix was not on a branch that could _possibly_ have mattered for the current contents.

So once you are _aware_ of history simplification and are mentally able to accept it, the fact that history got simplified is actually just another tool.

And that's why "-full-history" and "git whatchanged" exist. They are ways to start delving deeper - they shouldn't be the _default_ mode, but they are ways to show more information when the initial default simple mode turns out to show that something didn't even matter for the end result.

And yes, there is a mid-way point between "aggressive simplification" (default) and "no simplification at all" (--full-history). It's more complex than either, and I do think it would be useful to have. It's what Roman wants, but as long as he thinks it's the _only_ correct answer, and refuses to face the performance issues, the discussion with Roman is kind of pointless.

			Linus

[*] when I say "_simplest_ history", I do want to point out that the history simplification is always a "local optimization", and it doesn't try to check all possible paths: there can be other histories that are even simpler on a global scale.

But in practice it is _one_ history of the file, and it's a history that is not "unnecessarily complicated" considering the simple heurstics for finding it.

So think "local minima" instead of "global minima", and in practice the local one is pretty close to the global one, although there are obviously always extreme cases where the two can differ by a whole lot.

Previous: Jeff KingNext: Roman Zippel
Message 45 of 58 in “Bizarre missing changes (git bug?)”
  1. Tim HarperJul 21, 2008
  2. Linus TorvaldsJul 21, 2008
  3. Tim HarperJul 21, 2008
  4. Tim HarperJul 21, 2008
  5. Roman ZippelJul 26, 2008
  6. Linus TorvaldsJul 26, 2008
  7. Roman ZippelJul 27, 2008
  8. Linus TorvaldsJul 27, 2008
  9. Roman ZippelJul 27, 2008
  10. Linus TorvaldsJul 27, 2008
  11. Roman ZippelJul 28, 2008
  12. Linus TorvaldsJul 28, 2008
  13. Linus TorvaldsJul 28, 2008
  14. Roman ZippelJul 29, 2008
  15. Martin LanghoffJul 29, 2008
  16. Roman ZippelJul 30, 2008
  17. Martin LanghoffJul 30, 2008
  18. Linus TorvaldsJul 30, 2008
  19. Linus TorvaldsJul 30, 2008
  20. Junio C HamanoJul 30, 2008
  21. Junio C HamanoJul 31, 2008
  22. Linus TorvaldsJul 31, 2008
  23. revision traversal: show full history with merge simplificationJunio C Hamano, Jul 31, 2008
  24. Junio C HamanoJul 31, 2008
  25. Linus TorvaldsJul 31, 2008
  26. revision traversal: show full history with merge simplificationJunio C Hamano, Jul 31, 2008
  27. Linus TorvaldsJul 31, 2008
  28. Junio C HamanoJul 31, 2008
  29. Junio C HamanoAug 1, 2008
  30. Linus TorvaldsAug 1, 2008
  31. Junio C HamanoAug 1, 2008
  32. Jakub NarebskiJul 30, 2008
  33. Linus TorvaldsJul 29, 2008
  34. Linus TorvaldsJul 29, 2008
  35. Roman ZippelJul 29, 2008
  36. David KastrupJul 29, 2008
  37. Linus TorvaldsJul 29, 2008
  38. Roman ZippelJul 30, 2008
  39. Kevin BallardJul 30, 2008
  40. Linus TorvaldsJul 30, 2008
  41. Jeff KingJul 29, 2008
  42. Roman ZippelJul 29, 2008
  43. Olivier GalibertJul 29, 2008
  44. Jeff KingJul 29, 2008
  45. Linus TorvaldsJul 29, 2008
  46. Roman ZippelJul 30, 2008
  47. Linus TorvaldsJul 30, 2008
  48. Jeff KingJul 30, 2008
  49. Linus TorvaldsJul 30, 2008
  50. Roman ZippelJul 30, 2008
  51. Kevin BallardJul 30, 2008
  52. Linus TorvaldsJul 30, 2008
  53. Linus TorvaldsJul 30, 2008
  54. Jeff KingJul 30, 2008
  55. Martin LanghoffJul 27, 2008
  56. Roman ZippelJul 28, 2008
  57. Alex RiesenJul 21, 2008
  58. Linus TorvaldsJul 21, 2008

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.