This adds "Child: " lines to the commit window, which tells what children 
a commit has. 

It also cleans things up: it marks the text widget as no-wrap, which means
that it doesn't need to truncate the commit description arbitrarily by
hand. Also, the description itself is now done by a common helper routine
that handles both the parent and the children.

Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

[ NOTE! The list of children is "calculated" information, since git itself
  doesn't actually keep any child pointers, and that means that it only
  lists any children that gitk has seen. There may be other children of a
  commit in other branches in the same repository, and gitk will not show
  such children that it doesn't know about.

  But this is useful for walking up and down the links - you get the same 
  information as if you had clicked on a link ]

diff --git a/gitk b/gitk
--- a/gitk
+++ b/gitk
@@ -387,7 +387,7 @@ proc makewindow {} {
     set ctext .ctop.cdet.left.ctext
     text $ctext -bg white -state disabled -font $textfont \
        -width $geometry(ctextw) -height $geometry(ctexth) \
-       -yscrollcommand " set"
+       -yscrollcommand " set" -wrap none
     scrollbar -command "$ctext yview"
     pack -side right -fill y
     pack $ctext -side left -fill both -expand 1
@@ -1704,10 +1704,19 @@ proc selcanvline {w x y} {
     selectline $l 1
+proc commit_descriptor {p} {
+    global commitinfo
+    set l "..."
+    if {[info exists commitinfo($p)]} {
+       set l [lindex $commitinfo($p) 0]
+    }
+    return "$p ($l)"
 proc selectline {l isnew} {
     global canv canv2 canv3 ctext commitinfo selectedline
     global lineid linehtag linentag linedtag
-    global canvy0 linespc parents nparents
+    global canvy0 linespc parents nparents children nchildren
     global cflist currentid sha1entry
     global commentend idtags idline
@@ -1790,15 +1799,15 @@ proc selectline {l isnew} {
     set commentstart [$ctext index "end - 1c"]
     set comment {}
-    foreach p $parents($id) {
-       set l "..."
-       if {[info exists commitinfo($p)]} {
-           set l [lindex $commitinfo($p) 0]
-           if {[string length $l] > 32} {
-               set l "[string range $l 0 28] ..."
-           }
+    if {[info exists parents($id)]} {
+       foreach p $parents($id) {
+           append comment "Parent: [commit_descriptor $p]\n"
+       }
+    }
+    if {[info exists children($id)]} {
+       foreach c $children($id) {
+           append comment "Child:  [commit_descriptor $c]\n"
-       append comment "Parent: $p  ($l)\n"
     append comment "\n"
     append comment [lindex $info 5]
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to