gitk: Fix some bugs with path limiting in the diff display
First, we weren't putting "--" between the ids and the paths in the git diff-tree/diff-index/diff-files command, so if there was a tag and a file with the same name, we could get an ambiguity in the command. This puts the "--" in to make it clear that the paths are paths. Secondly, this implements the path limiting for merge diffs as well as the normal 2-way diffs. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Oct 23, 2007 at 22:37 UTC
bd8f677e1c8349b9128490e2a21e0f573d0bea1d
1 file changed
+5
-1
gitk
+5
-1
@@ -4913,12 +4913,16 @@ proc mergediff {id l} {
4913
global diffmergeid diffopts mdifffd
4914
global diffids
4915
global parentlist
4916
+ global limitdiffs viewfiles curview
4917
4918
set diffmergeid $id
4919
set diffids $id
4920
# this doesn't seem to actually affect anything...
4921
set env(GIT_DIFF_OPTS) $diffopts
4922
set cmd [concat | git diff-tree --no-commit-id --cc $id]
4923
+ if {$limitdiffs && $viewfiles($curview) ne {}} {
4924
+ set cmd [concat $cmd -- $viewfiles($curview)]
4925
+ }
4926
if {[catch {set mdf [open $cmd r]} err]} {
4927
error_popup "Error getting merge diffs: $err"
4928
return
@@ -5152,7 +5156,7 @@ proc getblobdiffs {ids} {
5156
set env(GIT_DIFF_OPTS) $diffopts
5157
set cmd [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"]
5158
if {$limitdiffs && $viewfiles($curview) ne {}} {
5155
- set cmd [concat $cmd $viewfiles($curview)]
5159
+ set cmd [concat $cmd -- $viewfiles($curview)]
5160
}
5161
if {[catch {set bdf [open $cmd r]} err]} {
5162
puts "error getting diffs: $err"