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

Re: Any objectsions to enhancing git-log to show tags/branch heads?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 16, 2007, 23:00 UTC
Message-ID
<Pine.LNX.4.64.0704161552160.5473@woody.linux-foundation.org>
In-Reply-To
<E1HdQah-0008Q2-7E@candygram.thunk.org>
On Mon, 16 Apr 2007, Theodore Ts'o wrote:
Show 10 quoted lines
> 
> I've recently noticed that I'm often firing up gitk for no other purpose
> than to see which changesets have which tags and branch heads.  Often
> I'll fire up gitk, quickly look at the tags/branches, and then kill it
> before it's done parsing the repository, resulting in python errors as
> it dies.
> 
> So I'm wondering why we haven't arranged to have git-log show this
> information, and whether there would be any objections if "git-log"
> showed something like this:
Ok, the next few emails will send out a series of two patches to do this.

The patches are much larger than necessary, because the way I did it was to add a totally generic notion of "object decorations", ie random data structures that can be attached to an object.

I actually stole the implementation from "object-refs", and in fact made object refs just be a normal decoration.

The exact syntax is up in the air, but with this, I can say
	git log --decorate

(we could obviously make the "--decorate" thing be the default if really wants to), and it will result in something like this:

	commit 02cfc097c2351a2b6e3a65626ce619f038f73c03 (refs/heads/master)
	Author: Linus Torvalds <torvalds@osdl.org>
	Date:   Mon Apr 16 15:49:58 2007 -0700
	
	    Add support for "commit name decorations" to log family of commands
	
	    Right now, it adds "--decorate" as a log option, which prints out the
	    ref names that point to that object if any.
	
	    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
	
	commit b1beb21820bea9c2fb9c04019c485d7810cba710 (refs/tags/test-tag)
	Author: Linus Torvalds <torvalds@osdl.org>
	Date:   Mon Apr 16 15:11:54 2007 -0700
	
	    Add a generic "object decorator" interface, and make object refs use it
	
	    This allows you to add an arbitrary "decoration" of your choice to any
	    object.  It's a space- and time-efficient way to add information to
	    arbitrary objects, especially if most objects probably do not have the
	    decoration.
	
	    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
	
	commit 7a1593972c19df26aee7d14c7d7c8c4fce24fb26 (refs/heads/parent)
	Merge: b073211... 5f2e1df...
	Author: Junio C Hamano <junkio@cox.net>
	Date:   Sun Apr 15 17:52:07 2007 -0700
	
	    Merge branch 'maint'
	....

ie notice the "decorations" after the commit name that actually tell what branch that commit is on.

A commit may obviously be on multiple branches, in which case it will have multiple decorations, and they will show up like so:

	commit 1ed91937e5cd59fdbdfa5f15f6fac132d2b21ce0 (tag: refs/tags/v1.0rc6, tag: refs/tags/v0.99.9n)

where that is an example of a commit that is tagged with two different tag objects (it's also an example of the difference of having a direct ref to it and having a ref that is a tag object that points to it: see the "refs/tags/test-tag" example above on what a *direct* tag reference will look like, while the "tag: refs/tags/xyzzy" format means that it's an *indirect* reference through a tag object.

Patches to follow.
		Linus
Previous: Peter BaumannNext: Theodore Tso
Message 10 of 15 in “Any objectsions to enhancing git-log to show tags/branch heads?”
  1. Theodore Ts'oApr 16, 2007
  2. Junio C HamanoApr 16, 2007
  3. Theodore TsoApr 16, 2007
  4. Peter BaumannApr 16, 2007
  5. J. Bruce FieldsApr 16, 2007
  6. Peter BaumannApr 17, 2007
  7. J. Bruce FieldsApr 17, 2007
  8. Julian PhillipsApr 16, 2007
  9. Peter BaumannApr 17, 2007
  10. Linus TorvaldsApr 16, 2007
  11. Theodore TsoApr 17, 2007
  12. Jakub NarebskiApr 17, 2007
  13. Linus TorvaldsApr 17, 2007
  14. Junio C HamanoApr 23, 2007
  15. Theodore TsoApr 17, 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.