Skip to content

Commit 2c8cd90

Browse files
felipecpaulusmack
authored andcommitted
gitk: Simplify file filtering
git diff is perfectly able to do this with '-- files', no need for manual filtering. This makes gettreediffs consistent with getblobdiffs. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 685316c commit 2c8cd90

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

gitk

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7618,9 +7618,13 @@ proc diffcmd {ids flags} {
76187618
}
76197619

76207620
proc gettreediffs {ids} {
7621-
global treediff treepending
7621+
global treediff treepending limitdiffs vfilelimit curview
76227622

7623-
if {[catch {set gdtf [open [diffcmd $ids {--no-commit-id}] r]}]} return
7623+
set cmd [diffcmd $ids {--no-commit-id}]
7624+
if {$limitdiffs && $vfilelimit($curview) ne {}} {
7625+
set cmd [concat $cmd -- $vfilelimit($curview)]
7626+
}
7627+
if {[catch {set gdtf [open $cmd r]}]} return
76247628

76257629
set treepending $ids
76267630
set treediff {}
@@ -7664,17 +7668,7 @@ proc gettreediffline {gdtf ids} {
76647668
return [expr {$nr >= $max? 2: 1}]
76657669
}
76667670
close $gdtf
7667-
if {$limitdiffs && $vfilelimit($curview) ne {}} {
7668-
set flist {}
7669-
foreach f $treediff {
7670-
if {[path_filter $vfilelimit($curview) $f]} {
7671-
lappend flist $f
7672-
}
7673-
}
7674-
set treediffs($ids) $flist
7675-
} else {
7676-
set treediffs($ids) $treediff
7677-
}
7671+
set treediffs($ids) $treediff
76787672
unset treepending
76797673
if {$cmitmode eq "tree" && [llength $diffids] == 1} {
76807674
gettree $diffids

0 commit comments

Comments
 (0)