From: Peter Baumann <waste.manager@gmx•de>
To: git@vger•kernel.org
Cc: Paul Mackerras <paulus@samba•org>
Subject: [PATCH] Show selected subdirectory paths in gitk
Date: Sun, 31 May 2009 10:50:45 +0200 [thread overview]
Message-ID: <20090531085045.GA8129@m62s10.vlinux.de> (raw)
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
reply other threads:[~2009-05-31 8:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090531085045.GA8129@m62s10.vlinux.de \
--to=waste.manager@gmx$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=paulus@samba$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox