Skip to content

Commit 8b19280

Browse files
Linus Torvaldspaulusmack
authored andcommitted
[PATCH] gitk "parent information" in commit window
This adds a useful "Parent:" line to the git commit information window. It looks something like this (from the infamous octopus merge): Author: Junio C Hamano <[email protected]> 2005-05-05 16:16:54 Committer: Junio C Hamano <[email protected]> 2005-05-05 16:16:54 Parent: fc54a9c (Update git-apply-patch-script ...) Parent: 9e30dd7 (Make git-prune-script executa ...) Parent: c4b83e6 (Do not write out new index if ...) Parent: 6602659 (diff-cache shows differences ...) Parent: b28858b (Update diff engine for symlin ...) Octopus merge of the following five patches. Update git-apply-patch-script for symbolic links. Make git-prune-script executable again. Do not write out new index if nothing has changed. diff-cache shows differences for unmerged paths without --cache. Update diff engine for symlinks stored in the cache. Signed-off-by: Junio C Hamano <[email protected]> where all the parent commit ID's are clickable, because the new lines are added as part of the "comment" string, and thus the regular clickability thing will match them automatically. I think this is good. And my random-tcl-monkey-skills are clearly getting better (although it's perfectly possible that somebody who actually knows what he is doing would have done things differently). Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent d6e8149 commit 8b19280

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

gitk

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,9 +1799,21 @@ proc selectline {l isnew} {
17991799
}
18001800
$ctext insert end "\n"
18011801
}
1802-
$ctext insert end "\n"
1802+
18031803
set commentstart [$ctext index "end - 1c"]
1804-
set comment [lindex $info 5]
1804+
set comment {}
1805+
foreach p $parents($id) {
1806+
set l "..."
1807+
if {[info exists commitinfo($p)]} {
1808+
set l [lindex $commitinfo($p) 0]
1809+
if {[string length $l] > 32} {
1810+
set l "[string range $l 0 28] ..."
1811+
}
1812+
}
1813+
append comment "Parent: $p ($l)\n"
1814+
}
1815+
append comment "\n"
1816+
append comment [lindex $info 5]
18051817
$ctext insert end $comment
18061818
$ctext insert end "\n"
18071819

0 commit comments

Comments
 (0)