@matheusbsbs / matheus-bagliano / commits / 57cae87b77
Fork 0

Add options to control the search for copies in blame.

On huge repositories, -C -C can be way too slow to be unconditionally enabled, and it can also be useful to control its precision. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Alexander Gavrilov committed Jul 17, 2008 at 00:43 UTC 57cae87b77c93e8bdfd11293f11f140ff827269a
3 files changed +16 -8
git-gui.sh
+2
@@ -642,6 +642,8 @@ set default_config(user.email) {}
642 set default_config(gui.matchtrackingbranch) false
643 set default_config(gui.pruneduringfetch) false
644 set default_config(gui.trustmtime) false
645 +set default_config(gui.fastcopyblame) false
646 +set default_config(gui.copyblamethreshold) 40
647 set default_config(gui.diffcontext) 5
648 set default_config(gui.commitmsgwidth) 75
649 set default_config(gui.newbranchtemplate) {}
lib/blame.tcl
+12 -8
@@ -33,13 +33,6 @@ variable group_colors {
33 #ececec
34 }
35
36 -# Switches for original location detection
37 -#
38 -variable original_options [list -C -C]
39 -if {[git-version >= 1.5.3]} {
40 - lappend original_options -w ; # ignore indentation changes
41 -}
42 -
36 # Current blame data; cleared/reset on each load
37 #
38 field commit ; # input commit to blame
@@ -511,7 +504,6 @@ method _exec_blame {cur_w cur_d options cur_s} {
504 method _read_blame {fd cur_w cur_d} {
505 upvar #0 $cur_d line_data
506 variable group_colors
514 - variable original_options
507
508 if {$fd ne $current_fd} {
509 catch {close $fd}
@@ -684,6 +676,18 @@ method _read_blame {fd cur_w cur_d} {
676 if {[eof $fd]} {
677 close $fd
678 if {$cur_w eq $w_asim} {
679 + # Switches for original location detection
680 + set threshold [get_config gui.copyblamethreshold]
681 + set original_options [list "-C$threshold"]
682 +
683 + if {![is_config_true gui.fastcopyblame]} {
684 + # thorough copy search; insert before the threshold
685 + set original_options [linsert $original_options 0 -C]
686 + }
687 + if {[git-version >= 1.5.3]} {
688 + lappend original_options -w ; # ignore indentation changes
689 + }
690 +
691 _exec_blame $this $w_amov @amov_data \
692 $original_options \
693 [mc "Loading original location annotations..."]
lib/option.tcl
+2
@@ -123,6 +123,8 @@ proc do_options {} {
123 {b gui.trustmtime {mc "Trust File Modification Timestamps"}}
124 {b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
125 {b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
126 + {b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
127 + {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
128 {i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
129 {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
130 {t gui.newbranchtemplate {mc "New Branch Name Template"}}