* [PATCH] Show selected subdirectory paths in gitk
@ 2009-05-31 8:50 Peter Baumann
0 siblings, 0 replies; only message in thread
From: Peter Baumann @ 2009-05-31 8:50 UTC (permalink / raw)
To: git; +Cc: Paul Mackerras
Previously, running 'gitk -- file' in a subdirectory of the worktree didn't
show the file in the file selection widget. This is especially annoying if
multiple files and/or a subdirectory was given as parameter to gitk, because
no visual reprasentation on the changed files was given besides the commit
diff itself.
By prefixing all file filters with the result of the newly added function
get_subdir_prefix which returns the subdirectory relative to the GIT_DIR,
we make sure we always use the correct file name.
Signed-off-by: Peter Baumann <waste.manager@gmx.de>
---
The problem this patch fixes could be reproduced in the git repo by
cd Documentation
gitk git-add.txt
Running the above commands and you should not see any file listed in the
file selection widget in gitk. After applying the patch, the file is listed
there (for any non merge commit).
gitk-git/gitk | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
mode change 100644 => 100755 gitk-git/gitk
diff --git a/gitk-git/gitk b/gitk-git/gitk
old mode 100644
new mode 100755
index 1a7887b..2355d82
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7104,8 +7104,17 @@ proc startdiff {ids} {
}
}
+# Return the current subdirectory relative to the repository root
+proc get_subdir_prefix {} {
+ return [exec git rev-parse --show-prefix]
+}
+
proc path_filter {filter name} {
- foreach p $filter {
+ set prefix [get_subdir_prefix]
+ foreach f $filter {
+ # get full pathname starting from the workdir root
+ set p "$prefix$f"
+
set l [string length $p]
if {[string index $p end] eq "/"} {
if {[string compare -length $l $p $name] == 0} {
--
1.6.3.1.70.ga80aa.dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-05-31 8:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-31 8:50 [PATCH] Show selected subdirectory paths in gitk Peter Baumann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).