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

[PATCH 1/2] gitk: simplify file filtering

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Oct 25, 2012, 17:23 UTC
Message-ID
<1351185801-18543-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1351185801-18543-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 d93bd99..b79dfdf 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7519,9 +7519,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 {}
@@ -7565,17 +7569,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.0
Previous: Felipe ContrerasNext: Johannes Sixt
Message 2 of 5 in “gitk: handle --full-diff corectly”
  1. 0/2 gitk: handle --full-diff corectlyFelipe Contreras, Oct 25, 2012
  2. 1/2 gitk: simplify file filteringFelipe Contreras, Oct 25, 2012
  3. Johannes SixtOct 29, 2012
  4. 2/2 gitk: handle --full-diff correctlyFelipe Contreras, Oct 25, 2012
  5. Johannes SixtOct 29, 2012

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.