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>
Shawn O. Pearce committed
Jun 1, 2007 at 01:04 UTC
c9e6bfd8a9a18c12d01e0d96c74ca0a7f64a2846
1 file changed
+22
-3
lib/blame.tcl
+22
-3
@@ -267,7 +267,18 @@ method _read_blame {fd} {
267
set n $r_line_count
268
set lno $r_final_line
269
set cmit $r_commit
270
- set abbr [string range $cmit 0 4]
270
+
271
+ if {[regexp {^0{40}$} $cmit]} {
272
+ set abbr work
273
+ } else {
274
+ set abbr [string range $cmit 0 4]
275
+ }
276
+
277
+ if {![catch {set ncmit $line_commit([expr {$lno - 1}])}]} {
278
+ if {$ncmit eq $cmit} {
279
+ set abbr |
280
+ }
281
+ }
282
283
while {$n > 0} {
284
set lno_e "$lno.0 lineend + 1c"
@@ -286,8 +297,9 @@ method _read_blame {fd} {
297
set line_commit($lno) $cmit
298
set line_file($lno) $file
299
289
- $w_cgrp delete $lno.0 $lno_e
290
- $w_cgrp insert $lno.0 "$abbr\n"
300
+ $w_cgrp delete $lno.0 "$lno.0 lineend"
301
+ $w_cgrp insert $lno.0 $abbr
302
+ set abbr |
303
304
$w_cgrp tag add g$cmit $lno.0 $lno_e
305
$w_line tag add g$cmit $lno.0 $lno_e
@@ -311,6 +323,13 @@ method _read_blame {fd} {
323
incr blame_lines
324
}
325
326
+ if {![catch {set ncmit $line_commit($lno)}]} {
327
+ if {$ncmit eq $cmit} {
328
+ $w_cgrp delete $lno.0 "$lno.0 lineend + 1c"
329
+ $w_cgrp insert $lno.0 "|\n"
330
+ }
331
+ }
332
+
333
set hc $highlight_commit
334
if {$hc ne {}
335
&& [expr {$order($hc) + 1}] == $order($cmit)} {