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

Re: The merge from hell...

From
Linus Torvalds <torvalds@osdl.org>
Date
Feb 2, 2006, 08:44 UTC
Message-ID
<Pine.LNX.4.64.0602020027400.21884@g5.osdl.org>
In-Reply-To
<cc723f590602020007s43f89d10i4529d118ade7c764@mail.gmail.com>
On Thu, 2 Feb 2006, Aneesh Kumar wrote:
> 
> Ok i tried using --cc. But then as per the man page if the
> optimization makes the all the hunks disapper then commit log is not
> show unless -m is used.
Ahh. You're mis-using git-diff-tree.

git-diff-tree will _never_ show the commit log if the diff ends up being empty. That can actually happen even for a regular commit, because we had some early bugs that allowed them.

See commit 69d37960b578be0a69383bd71d06c1fcfb86e8b9, for example. Notice how

	git-diff-tree --pretty 69d37960
is entirely silent, even though 
	git log 69d37960

clearly shows that the commit exists. I screwed up a commit, and effectively applied an empty patch (this was before git-apply would notice, and consider it an error - something I fixed very soon afterwards ;^).

> Is there a way to get the commit log printed.
Yes. What you should do is to do
	git-rev-list --parents --pretty
which gives the revision _log_ in pretty format. 

The difference between "git-rev-list --pretty" and "git-diff-tree --pretty" is really exactly that "git-rev-list" lists every revision, while git-diff-tree only lists revisions that _differ_ in the trees.

This, btw, is also really the main difference between doing a "git log" and doing a "git whatchanged". A "git log" shows all revisions (and uses "git-rev-list --pretty"). While "git whatchanged" shows what _changed_ (and uses "git-diff-tree --pretty").

For a revision tool like gitview, you want to use "git-rev-list --pretty".
[ SIDE NOTE! Actually, there's another format that you may find easier to 
  parse automatically: "git-rev-list --header". It uses the raw format, 
  and adds a NUL character between each rev. That makes things like the 
  date etc trivial to parse, and it's also slightly easier to see the end 
  of a commit message vs just a normal end-of-line. 
  So "gitk", for example, really parses the output of
	git-rev-list --header --topo-order --parents
  to generate the revision list. The "--topo-order" part guarantees that 
  all children will always be shown before any parents. ]
Hope that clarifies the issue.
		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 29 of 40 in “The merge from hell...”
  1. Linus TorvaldsFeb 2, 2006
  2. Junio C HamanoFeb 2, 2006
  3. combine-diff: reuse diff from the same blob.Junio C Hamano, Feb 2, 2006
  4. Linus TorvaldsFeb 2, 2006
  5. Linus TorvaldsFeb 2, 2006
  6. Linus TorvaldsFeb 2, 2006
  7. combine-diff: update --cc "uninteresting hunks" logic.Junio C Hamano, Feb 2, 2006
  8. combine-diff: add safety check to --cc.Junio C Hamano, Feb 2, 2006
  9. Linus TorvaldsFeb 2, 2006
  10. Junio C HamanoFeb 3, 2006
  11. Linus TorvaldsFeb 3, 2006
  12. [Attn - repository browser authors] diff-tree combined format.Junio C Hamano, Feb 3, 2006
  13. Marco CostalbaFeb 3, 2006
  14. Junio C HamanoFeb 3, 2006
  15. Junio C HamanoFeb 3, 2006
  16. Marco CostalbaFeb 4, 2006
  17. Paul MackerrasFeb 4, 2006
  18. Junio C HamanoFeb 3, 2006
  19. Paul MackerrasFeb 4, 2006
  20. Junio C HamanoFeb 4, 2006
  21. Paul MackerrasFeb 4, 2006
  22. Junio C HamanoFeb 4, 2006
  23. Linus TorvaldsFeb 4, 2006
  24. Linus TorvaldsFeb 4, 2006
  25. Marco CostalbaFeb 2, 2006
  26. Linus TorvaldsFeb 2, 2006
  27. Aneesh KumarFeb 2, 2006
  28. Junio C HamanoFeb 2, 2006
  29. Linus TorvaldsFeb 2, 2006
  30. Junio C HamanoFeb 2, 2006
  31. Linus TorvaldsFeb 5, 2006
  32. Add a "git show" command to show a commitLinus Torvalds, Feb 5, 2006
  33. Fix git-rev-parse over-eager errorsLinus Torvalds, Feb 5, 2006
  34. Junio C HamanoFeb 5, 2006
  35. Linus TorvaldsFeb 5, 2006
  36. Junio C HamanoFeb 6, 2006
  37. Junio C HamanoFeb 5, 2006
  38. Linus TorvaldsFeb 5, 2006
  39. Linus TorvaldsFeb 5, 2006
  40. Junio C HamanoFeb 6, 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.