[PATCH v2 3/7] gitk: split out diff part in $commitinfo
- From
Thomas Rast <tr@thomasrast.ch>
- Date
- Oct 29, 2013, 07:20 UTC
- Message-ID
- <9b4daa449f4cb8228f75477f0d32826edfc401cd.1383031141.git.tr@thomasrast.ch>
- In-Reply-To
- <21f40508f83a9407986d29f002adf5ad366c8b88.1382287779.git.trast@inf.ethz.ch>
From: Thomas Rast <trast@inf.ethz.ch>
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> --- gitk-git/gitk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk index 11e988e..78b4354 100755 --- a/gitk-git/gitk +++ b/gitk-git/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} {
-- 1.8.4.2.838.ga9a3e20