Skip to content

Commit

Permalink
gitk: Split out diff part in $commitinfo
Browse files Browse the repository at this point in the history
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 <trast@inf.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Thomas Rast authored and Paul Mackerras committed Dec 1, 2013
1 parent 5de460a commit b449eb2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -1704,8 +1704,17 @@ proc parsecommit {id contents listed} {
set comment $newcomment
}
set hasnote [string first "\nNotes:\n" $contents]
set diff ""
# If there is diff output shown in the git-log stream, split it
# out. But get rid of the empty line that always precedes the
# diff.
set i [string first "\n\ndiff" $comment]
if {$i >= 0} {
set diff [string range $comment $i+1 end]
set comment [string range $comment 0 $i-1]
}
set commitinfo($id) [list $headline $auname $audate \
$comname $comdate $comment $hasnote]
$comname $comdate $comment $hasnote $diff]
}

proc getcommit {id} {
Expand Down

0 comments on commit b449eb2

Please sign in to comment.