summaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorThomas Rast <trast@inf.ethz.ch>2013-11-16 17:37:42 (GMT)
committerPaul Mackerras <paulus@samba.org>2013-12-01 22:24:20 (GMT)
commitb449eb2cb34fbdcb5cab7101a527985013818c9b (patch)
tree92b14d702b994b41bd3ef2b856a02feff0575b4a /gitk
parent5de460a2cfdd4acbadd41355a5b34dc69e93b89e (diff)
downloadgit-b449eb2cb34fbdcb5cab7101a527985013818c9b.zip
git-b449eb2cb34fbdcb5cab7101a527985013818c9b.tar.gz
git-b449eb2cb34fbdcb5cab7101a527985013818c9b.tar.bz2
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 <trast@inf.ethz.ch> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk11
1 files changed, 10 insertions, 1 deletions
diff --git a/gitk b/gitk
index 79c8bb1..7c961c5 100755
--- a/gitk
+++ b/gitk
@@ -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} {