Skip to content

Commit b1ba39e

Browse files
Linus Torvaldspaulusmack
authored andcommitted
[PATCH] "Child" information in commit window - and cleanups
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]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent fa4da7b commit b1ba39e

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

gitk

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ proc makewindow {} {
387387
set ctext .ctop.cdet.left.ctext
388388
text $ctext -bg white -state disabled -font $textfont \
389389
-width $geometry(ctextw) -height $geometry(ctexth) \
390-
-yscrollcommand ".ctop.cdet.left.sb set"
390+
-yscrollcommand ".ctop.cdet.left.sb set" -wrap none
391391
scrollbar .ctop.cdet.left.sb -command "$ctext yview"
392392
pack .ctop.cdet.left.sb -side right -fill y
393393
pack $ctext -side left -fill both -expand 1
@@ -1704,10 +1704,19 @@ proc selcanvline {w x y} {
17041704
selectline $l 1
17051705
}
17061706

1707+
proc commit_descriptor {p} {
1708+
global commitinfo
1709+
set l "..."
1710+
if {[info exists commitinfo($p)]} {
1711+
set l [lindex $commitinfo($p) 0]
1712+
}
1713+
return "$p ($l)"
1714+
}
1715+
17071716
proc selectline {l isnew} {
17081717
global canv canv2 canv3 ctext commitinfo selectedline
17091718
global lineid linehtag linentag linedtag
1710-
global canvy0 linespc parents nparents
1719+
global canvy0 linespc parents nparents children nchildren
17111720
global cflist currentid sha1entry
17121721
global commentend idtags idline
17131722

@@ -1790,15 +1799,15 @@ proc selectline {l isnew} {
17901799

17911800
set commentstart [$ctext index "end - 1c"]
17921801
set comment {}
1793-
foreach p $parents($id) {
1794-
set l "..."
1795-
if {[info exists commitinfo($p)]} {
1796-
set l [lindex $commitinfo($p) 0]
1797-
if {[string length $l] > 32} {
1798-
set l "[string range $l 0 28] ..."
1799-
}
1802+
if {[info exists parents($id)]} {
1803+
foreach p $parents($id) {
1804+
append comment "Parent: [commit_descriptor $p]\n"
1805+
}
1806+
}
1807+
if {[info exists children($id)]} {
1808+
foreach c $children($id) {
1809+
append comment "Child: [commit_descriptor $c]\n"
18001810
}
1801-
append comment "Parent: $p ($l)\n"
18021811
}
18031812
append comment "\n"
18041813
append comment [lindex $info 5]

0 commit comments

Comments
 (0)