Skip to content

Commit b449eb2

Browse files
Thomas Rastpaulusmack
authored andcommitted
gitk: Split out diff part in $commitinfo
So far we just parsed everything after the headers into the "comment" bit of $commitinfo, including notes and -- if you gave weird options -- the diff. Split out the diff, if any, into a separate field. It's easy to recognize, since it always starts with /^diff/ and is preceded by an empty line. We take care to snip away said empty line. The display code already properly spaces the end of the message from the first diff, and leaving another empty line at the end looks ugly. Signed-off-by: Thomas Rast <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 5de460a commit b449eb2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gitk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,8 +1704,17 @@ proc parsecommit {id contents listed} {
17041704
set comment $newcomment
17051705
}
17061706
set hasnote [string first "\nNotes:\n" $contents]
1707+
set diff ""
1708+
# If there is diff output shown in the git-log stream, split it
1709+
# out. But get rid of the empty line that always precedes the
1710+
# diff.
1711+
set i [string first "\n\ndiff" $comment]
1712+
if {$i >= 0} {
1713+
set diff [string range $comment $i+1 end]
1714+
set comment [string range $comment 0 $i-1]
1715+
}
17071716
set commitinfo($id) [list $headline $auname $audate \
1708-
$comname $comdate $comment $hasnote]
1717+
$comname $comdate $comment $hasnote $diff]
17091718
}
17101719

17111720
proc getcommit {id} {

0 commit comments

Comments
 (0)