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

[GITK PATCH 3/3] gitk: strip prefix from filenames in subdirectories

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 23, 2010, 17:12 UTC
Message-ID
<alpine.DEB.1.00.1002231811021.3980@intel-tinevez-2-302>
In-Reply-To
<alpine.DEB.1.00.1002231810020.3980@intel-tinevez-2-302>

Again in the lower right panel, where the file names of the files touched by the current commit are clickable: let's not show the prefix when we are in a subdirectory, as it wastes precious screen estate conveying information the user already knows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	Sorry, I tested 1/3 only in the gitk-git/ subdirectory. And of 
	course, I was bitten by the fact that this subdirectory is pulled
	using the subtree strategy, so there are files in the history 
	which lack the prefix. Therefore, I saw the files even if the fix
	was incomplete.
 gitk-git/gitk |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index bad9ebc..0b2c351 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -3203,10 +3203,14 @@ proc unhighlight_filelist {} {
 }
 
 proc add_flist {fl} {
-    global cflist
+    global cflist pathprefix
 
     $cflist conf -state normal
+    set l [string length $pathprefix]
     foreach f $fl {
+        if {$l > 0 && [string compare -length $l $pathprefix $f] == 0} {
+	    set f [string range $f $l end]
+	}
 	$cflist insert end "\n"
 	$cflist insert end $f [highlight_tag $f]
     }
-- 
1.6.4.297.gcb4cc
Previous: Johannes SchindelinNext: Kirill
Message 3 of 10 in “gitk: support "gitk <tracheophyte> -- ."”
  1. gitk: support "gitk <tracheophyte> -- ."Johannes Schindelin, Feb 23, 2010
  2. 2/3 gitk: support path filters even in subdirectoriesJohannes Schindelin, Feb 23, 2010
  3. 3/3 gitk: strip prefix from filenames in subdirectoriesJohannes Schindelin, Feb 23, 2010
  4. KirillFeb 23, 2010
  5. Johannes SchindelinFeb 23, 2010
  6. KirillFeb 23, 2010
  7. KirillFeb 23, 2010
  8. Johannes SchindelinFeb 23, 2010
  9. Pat ThoytsFeb 25, 2010
  10. Johannes SchindelinFeb 25, 2010

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.