1
0
mirror of https://github.com/git/git.git synced 2024-11-18 05:53:54 +01:00

git-gui: Simplify consecutive lines that come from the same commit

If two consecutive lines in the final file came from the same commit
then we store a "|" in the first column rather than the commit id,
for the second and subsequent lines in that block.  This cleans up
the interface so runs associated with the same commit can be more
easily seen visually.

We also now use the abbreviation "work" for the uncommitted stuff in
your working directory, rather than "0000".  This looks nicer to the
eyes and explains pretty quickly what is going on.

There was also a minor bug in the commit abbreviation column for the
last line of the file.  This is now also fixed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2007-06-01 01:04:46 -04:00
parent f96cd7b6c9
commit c9e6bfd8a9

@ -267,7 +267,18 @@ method _read_blame {fd} {
set n $r_line_count set n $r_line_count
set lno $r_final_line set lno $r_final_line
set cmit $r_commit set cmit $r_commit
set abbr [string range $cmit 0 4]
if {[regexp {^0{40}$} $cmit]} {
set abbr work
} else {
set abbr [string range $cmit 0 4]
}
if {![catch {set ncmit $line_commit([expr {$lno - 1}])}]} {
if {$ncmit eq $cmit} {
set abbr |
}
}
while {$n > 0} { while {$n > 0} {
set lno_e "$lno.0 lineend + 1c" set lno_e "$lno.0 lineend + 1c"
@ -286,8 +297,9 @@ method _read_blame {fd} {
set line_commit($lno) $cmit set line_commit($lno) $cmit
set line_file($lno) $file set line_file($lno) $file
$w_cgrp delete $lno.0 $lno_e $w_cgrp delete $lno.0 "$lno.0 lineend"
$w_cgrp insert $lno.0 "$abbr\n" $w_cgrp insert $lno.0 $abbr
set abbr |
$w_cgrp tag add g$cmit $lno.0 $lno_e $w_cgrp tag add g$cmit $lno.0 $lno_e
$w_line tag add g$cmit $lno.0 $lno_e $w_line tag add g$cmit $lno.0 $lno_e
@ -311,6 +323,13 @@ method _read_blame {fd} {
incr blame_lines incr blame_lines
} }
if {![catch {set ncmit $line_commit($lno)}]} {
if {$ncmit eq $cmit} {
$w_cgrp delete $lno.0 "$lno.0 lineend + 1c"
$w_cgrp insert $lno.0 "|\n"
}
}
set hc $highlight_commit set hc $highlight_commit
if {$hc ne {} if {$hc ne {}
&& [expr {$order($hc) + 1}] == $order($cmit)} { && [expr {$order($hc) + 1}] == $order($cmit)} {