git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: simplify file filtering

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 27, 2013, 22:01 UTC
Message-ID
<1367100099-13798-1-git-send-email-felipe.contreras@gmail.com>

git diff is perfectly able to do this with '-- files', no need for manual filtering.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 gitk-git/gitk | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index b3706fc..0863877 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7571,9 +7571,13 @@ proc diffcmd {ids flags} {
 }
 
 proc gettreediffs {ids} {
-    global treediff treepending
+    global treediff treepending limitdiffs vfilelimit curview
 
-    if {[catch {set gdtf [open [diffcmd $ids {--no-commit-id}] r]}]} return
+    set cmd [diffcmd $ids {--no-commit-id}]
+    if {$limitdiffs && $vfilelimit($curview) ne {}} {
+	    set cmd [concat $cmd -- $vfilelimit($curview)]
+    }
+    if {[catch {set gdtf [open $cmd r]}]} return
 
     set treepending $ids
     set treediff {}
@@ -7617,17 +7621,7 @@ proc gettreediffline {gdtf ids} {
 	return [expr {$nr >= $max? 2: 1}]
     }
     close $gdtf
-    if {$limitdiffs && $vfilelimit($curview) ne {}} {
-	set flist {}
-	foreach f $treediff {
-	    if {[path_filter $vfilelimit($curview) $f]} {
-		lappend flist $f
-	    }
-	}
-	set treediffs($ids) $flist
-    } else {
-	set treediffs($ids) $treediff
-    }
+    set treediffs($ids) $treediff
     unset treepending
     if {$cmitmode eq "tree" && [llength $diffids] == 1} {
 	gettree $diffids
-- 
1.8.2.1.1031.g2ee5873
Next: Paul Mackerras
Message 1 of 8 in “gitk: simplify file filtering”
  1. gitk: simplify file filteringFelipe Contreras, Apr 27, 2013
  2. Paul MackerrasMay 11, 2013
  3. Junio C HamanoMay 12, 2013
  4. Paul MackerrasMay 13, 2013
  5. Stefan HallerMay 13, 2013
  6. Paul MackerrasMay 13, 2013
  7. Paul MackerrasMay 13, 2013
  8. Junio C HamanoMay 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.