aboutsummaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-10-24 10:16:56 +1000
committerPaul Mackerras <paulus@samba.org>2007-10-24 10:16:56 +1000
commit74a40c71102ea925b174da15c74afb15b6b82537 (patch)
tree8ce6954629b950facbc87096aae6fca16de9ccb9 /gitk
parentbd8f677e1c8349b9128490e2a21e0f573d0bea1d (diff)
downloadgit-74a40c71102ea925b174da15c74afb15b6b82537.tar.gz
git-74a40c71102ea925b174da15c74afb15b6b82537.tar.xz
gitk: Fix a couple more bugs in the path limiting
First, paths ending in a slash were not matching anything. This fixes path_filter to handle paths ending in a slash (such entries have to match a directory, and can't match a file, e.g., foo/bar/ can't match a plain file called foo/bar). Secondly, clicking in the file list pane (bottom right) was broken because $treediffs($ids) contained all the files modified by the commit, not just those within the file list. This fixes that too. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk47
1 files changed, 29 insertions, 18 deletions
diff --git a/gitk b/gitk
index f41e30207..ff5eb5e8c 100755
--- a/gitk
+++ b/gitk
@@ -5023,28 +5023,25 @@ proc startdiff {ids} {
proc path_filter {filter name} {
foreach p $filter {
set l [string length $p]
- if {[string compare -length $l $p $name] == 0 &&
- ([string length $name] == $l || [string index $name $l] eq "/")} {
- return 1
+ if {[string index $p end] eq "/"} {
+ if {[string compare -length $l $p $name] == 0} {
+ return 1
+ }
+ } else {
+ if {[string compare -length $l $p $name] == 0 &&
+ ([string length $name] == $l ||
+ [string index $name $l] eq "/")} {
+ return 1
+ }
}
}
return 0
}
proc addtocflist {ids} {
- global treediffs cflist viewfiles curview limitdiffs
+ global treediffs
- if {$limitdiffs && $viewfiles($curview) ne {}} {
- set flist {}
- foreach f $treediffs($ids) {
- if {[path_filter $viewfiles($curview) $f]} {
- lappend flist $f
- }
- }
- } else {
- set flist $treediffs($ids)
- }
- add_flist $flist
+ add_flist $treediffs($ids)
getblobdiffs $ids
}
@@ -5100,7 +5097,7 @@ proc gettreediffs {ids} {
proc gettreediffline {gdtf ids} {
global treediff treediffs treepending diffids diffmergeid
- global cmitmode
+ global cmitmode viewfiles curview limitdiffs
set nr 0
while {[incr nr] <= 1000 && [gets $gdtf line] >= 0} {
@@ -5117,7 +5114,17 @@ proc gettreediffline {gdtf ids} {
return [expr {$nr >= 1000? 2: 1}]
}
close $gdtf
- set treediffs($ids) $treediff
+ if {$limitdiffs && $viewfiles($curview) ne {}} {
+ set flist {}
+ foreach f $treediff {
+ if {[path_filter $viewfiles($curview) $f]} {
+ lappend flist $f
+ }
+ }
+ set treediffs($ids) $flist
+ } else {
+ set treediffs($ids) $treediff
+ }
unset treepending
if {$cmitmode eq "tree"} {
gettree $diffids
@@ -7565,7 +7572,7 @@ proc prefscan {} {
proc prefsok {} {
global maxwidth maxgraphpct
global oldprefs prefstop showneartags showlocalchanges
- global charspc ctext tabstop limitdiffs
+ global charspc ctext tabstop limitdiffs treediffs
catch {destroy $prefstop}
unset prefstop
@@ -7577,6 +7584,10 @@ proc prefsok {} {
dohidelocalchanges
}
}
+ if {$limitdiffs != $oldprefs(limitdiffs)} {
+ # treediffs elements are limited by path
+ catch {unset treediffs}
+ }
if {$maxwidth != $oldprefs(maxwidth)
|| $maxgraphpct != $oldprefs(maxgraphpct)} {
redisplay