Skip to content

Commit 0f32da5

Browse files
committed
git-gui: Favor the original annotations over the recent ones
Usually when you are looking at blame annotations for a region of a file you are more interested in why something was originally done then why it is here now. This is because most of the time when we get original annotation data we are looking at a simple refactoring performed to better organize code, not to change its semantic meaning or function. Reorganizations are sometimes of interest, but not usually. We now show the original commit data first in the tooltip. This actually looks quite nice as the original commit will usually have an author date prior to the current (aka move/copy) annotation's commit, so the two commits will now tend to appear in chronological order. I also found myself to always be clicking on the line of interest in the file column but I always wanted the original tracking data and not the move/copy data. So I changed our default commit from $asim_data (the simple move/copy annotation) to the more complex $amov_data (the -M -C -C original annotation). Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 949da61 commit 0f32da5

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/blame.tcl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,12 @@ method _showcommit {cur_w lno} {
731731
}
732732
}
733733

734-
if {$cur_w eq $w_amov} {
735-
set dat [lindex $amov_data $lno]
736-
set highlight_column $w_amov
737-
} else {
734+
if {$cur_w eq $w_asim} {
738735
set dat [lindex $asim_data $lno]
739736
set highlight_column $w_asim
737+
} else {
738+
set dat [lindex $amov_data $lno]
739+
set highlight_column $w_amov
740740
}
741741

742742
$w_cviewer conf -state normal
@@ -908,7 +908,9 @@ method _open_tooltip {cur_w} {
908908
$tooltip_t insert end "$summary"
909909

910910
if {$org ne {} && [lindex $org 0] ne $cmit} {
911-
$tooltip_t insert 0.0 "Copied/Moved Here By:\n" section_header
911+
set save [$tooltip_t get 0.0 end]
912+
$tooltip_t delete 0.0 end
913+
912914
set cmit [lindex $org 0]
913915
set file [lindex $org 1]
914916
lappend tooltip_commit $cmit
@@ -923,17 +925,19 @@ method _open_tooltip {cur_w} {
923925
-format {%Y-%m-%d %H:%M:%S}
924926
]}
925927

926-
$tooltip_t insert end "\n\n"
927928
$tooltip_t insert end "Originally By:\n" section_header
928929
$tooltip_t insert end "commit $cmit\n"
929930
$tooltip_t insert end "$author_name $author_time\n"
930-
$tooltip_t insert end "$summary"
931+
$tooltip_t insert end "$summary\n"
931932

932933
if {$file ne $path} {
933-
$tooltip_t insert end "\n"
934934
$tooltip_t insert end "In File: " section_header
935-
$tooltip_t insert end $file
935+
$tooltip_t insert end "$file\n"
936936
}
937+
938+
$tooltip_t insert end "\n"
939+
$tooltip_t insert end "Copied Or Moved Here By:\n" section_header
940+
$tooltip_t insert end $save
937941
}
938942

939943
$tooltip_t conf -state disabled

0 commit comments

Comments
 (0)