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

[PATCH 15/15] git-note: Add display of notes to gitk

From
Johan Herland <johan@herland.net>
Date
May 27, 2007, 14:17 UTC
Message-ID
<200705271617.19097.johan@herland.net>
In-Reply-To
<200705271608.02122.johan@herland.net>

Teach gitk to display notes below the commit message similarly to how notes are displayed when using --decorate with git-{log,show,whatchanged}.

Signed-off-by: Johan Herland <johan@herland.net>
---
 gitk |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/gitk b/gitk
index a57e84c..7bed56b 100755
--- a/gitk
+++ b/gitk
@@ -303,7 +303,7 @@ proc getcommit {id} {
 }
 
 proc readrefs {} {
-    global tagids idtags headids idheads tagcontents
+    global tagids idtags idnotes headids idheads tagcontents
     global otherrefids idotherrefs mainhead
 
     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
@@ -318,7 +318,7 @@ proc readrefs {} {
 	if {[regexp {^remotes/.*/HEAD$} $path match]} {
 	    continue
 	}
-	if {![regexp {^(tags|heads)/(.*)$} $path match type name]} {
+	if {![regexp {^(tags|notes|heads)/(.*)$} $path match type name]} {
 	    set type others
 	    set name $path
 	}
@@ -341,6 +341,18 @@ proc readrefs {} {
 	    catch {
 	        set tagcontents($name) [exec git cat-file tag $id]
 	    }
+	} elseif { $type == "notes" } {
+	    puts stderr "note name = '$name', id = '$id'"
+	    lappend idnotes($id) $name
+	    set obj {}
+	    set type {}
+	    set tag {}
+	    catch {
+		set commit [exec git rev-parse "$id^0"]
+		if {$commit != $id} {
+		    lappend idnotes($commit) $id
+		}
+	    }
 	} elseif { $type == "heads" } {
 	    set headids($name) $id
 	    lappend idheads($id) $name
@@ -3864,7 +3876,7 @@ proc selectline {l isnew} {
     global displayorder linehtag linentag linedtag
     global canvy0 linespc parentlist childlist
     global currentid sha1entry
-    global commentend idtags linknum
+    global commentend idtags idnotes linknum
     global mergemax numcommits pending_select
     global cmitmode desc_tags anc_tags showneartags allcommits desc_heads
 
@@ -4009,6 +4021,26 @@ proc selectline {l isnew} {
     $ctext insert end "\n"
     appendwithlinks [lindex $info 5] {comment}
 
+    if {[info exists idnotes($id)]} {
+	$ctext insert end "\nNotes:\n"
+	set notes [exec git note -l "$id"]
+	# strip first line.
+	set firstLineEnd [string first "\n" $notes]
+	if {$firstLineEnd < 0} {
+	    # should never happen...
+	    set hdrend 0
+	}
+	set newnotes [string range $notes [expr {$firstLineEnd + 1}] end]
+	# Indent everything by 4 spaces
+	set notes {}
+	foreach line [split $newnotes "\n"] {
+	    append notes "    $line\n"
+	}
+	# Append to $ctext with auto-highlighting of SHA1 IDs.
+	appendwithlinks $notes {comment}
+	$ctext insert end "\n"
+    }
+
     $ctext tag delete Comments
     $ctext tag remove found 1.0 end
     $ctext conf -state disabled
-- 
1.5.2.101.gee49f
Previous: Johan HerlandNext: Junio C Hamano
Message 25 of 53 in “[RFC] Second parent for reverts”
  1. Daniel BarkalowMay 9, 2007
  2. Johannes SchindelinMay 9, 2007
  3. Shawn O. PearceMay 9, 2007
  4. Johan HerlandMay 9, 2007
  5. Junio C HamanoMay 9, 2007
  6. Linus TorvaldsMay 9, 2007
  7. Linus TorvaldsMay 10, 2007
  8. Johan HerlandMay 10, 2007
  9. Linus TorvaldsMay 10, 2007
  10. 00/15 git-note: A mechanisim for providing free-form after-the-fact annotations on commitsJohan Herland, May 27, 2007
  11. 01/15 git-note: Add git-note command for adding/listing/deleting git notesJohan Herland, May 27, 2007
  12. 02/15 git-note: (Documentation) Add git-note manual pageJohan Herland, May 27, 2007
  13. 03/15 git-note: (Administrivia) Add git-note to Makefile, .gitignore, etc.Johan Herland, May 27, 2007
  14. 04/15 git-note: (Plumbing) Add plumbing-level support for git notesJohan Herland, May 27, 2007
  15. 05/15 git-note: (Plumbing) Add support for git notes to git-rev-parse and git-show-refJohan Herland, May 27, 2007
  16. 06/15 git-note: (Documentation) Explain the new '--notes' option to git-rev-parse and git-show-refJohan Herland, May 27, 2007
  17. 07/15 git-note: (Almost plumbing) Add support for git notes to git-pack-refs and git-fsckJohan Herland, May 27, 2007
  18. 08/15 git-note: (Decorations) Add note decorations to "git-{log,show,whatchanged} --decorate"Johan Herland, May 27, 2007
  19. 09/15 git-note: (Documentation) Explain new behaviour of --decorate in git-{log,show,whatchanged}Johan Herland, May 27, 2007
  20. 10/15 git-note: (Transfer) Teach git-clone how to clone notesJohan Herland, May 27, 2007
  21. 11/15 git-note: (Transfer) Teach git-fetch to auto-follow notesJohan Herland, May 27, 2007
  22. 12/15 git-note: (Transfer) Teach git-push to push notes when --all or --notes is givenJohan Herland, May 27, 2007
  23. 13/15 git-note: (Documentation) Explain the new --notes option to git-pushJohan Herland, May 27, 2007
  24. 14/15 git-note: (Tests) Add tests for git-note and associated functionalityJohan Herland, May 27, 2007
  25. 15/15 git-note: Add display of notes to gitkJohan Herland, May 27, 2007
  26. Junio C HamanoMay 27, 2007
  27. Johan HerlandMay 28, 2007
  28. Jakub NarebskiMay 28, 2007
  29. Linus TorvaldsMay 28, 2007
  30. Johan HerlandMay 28, 2007
  31. Linus TorvaldsMay 28, 2007
  32. Johan HerlandMay 28, 2007
  33. Linus TorvaldsMay 28, 2007
  34. Johan HerlandMay 28, 2007
  35. Junio C HamanoMay 28, 2007
  36. Shawn O. PearceMay 28, 2007
  37. Johannes SchindelinMay 28, 2007
  38. Linus TorvaldsMay 29, 2007
  39. Shawn O. PearceMay 29, 2007
  40. Jakub NarebskiMay 29, 2007
  41. Andy ParkinsMay 29, 2007
  42. Johannes SchindelinMay 29, 2007
  43. Johan HerlandMay 29, 2007
  44. Jeff KingMay 29, 2007
  45. Johan HerlandMay 29, 2007
  46. Junio C HamanoMay 28, 2007
  47. Shawn O. PearceMay 28, 2007
  48. Add fsck_verify_ref_to_tag_object() to verify that refname matches name stored in tag objectJohan Herland, May 28, 2007
  49. Michael S. TsirkinMay 28, 2007
  50. Michael S. TsirkinMay 28, 2007
  51. Johan HerlandMay 28, 2007
  52. Martin LanghoffMay 10, 2007
  53. Junio C HamanoMay 10, 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.