[PATCH] gitk: use "gitk: repo-top-level-dir" as window title

Subsystems: the rest

STALE3717d

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] gitk: use "gitk: repo-top-level-dir" as window title

From: Zbigniew Jędrzejewski-Szmek <hidden>
Date: 2016-06-15 22:52:27

Previously, when run in a subdirectory, gitk would show the name
of this subdirectory as title, which was misleading. When run with
GIT_DIR set, it would show the cwd, which is even more misleading.

In case of non-bare repos, the .git suffix in the path is skipped.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
---
 gitk-git/gitk |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 4cde0c4..2eaf901 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -18,6 +18,14 @@ proc gitdir {} {
     }
 }
 
+proc reponame {} {
+    set n [file normalize [gitdir]]
+    if {[string match "*/.git" $n]} {
+	set n [string range $n 0 end-5]
+    }
+    return [file tail $n]
+}
+
 # A simple scheduler for compute-intensive stuff.
 # The aim is to make sure that event handlers for GUI actions can
 # run at least every 50-100 ms.  Unfortunately fileevent handlers are
@@ -11592,6 +11600,8 @@ if {[package vcompare $git_version "1.6.6.2"] >= 0} {
     set show_notes "--show-notes"
 }
 
+set appname "gitk"
+
 set runq {}
 set history {}
 set historyindex 0
@@ -11656,7 +11666,7 @@ catch {
 }
 # wait for the window to become visible
 tkwait visibility .
-wm title . "[file tail $argv0]: [file tail [pwd]]"
+wm title . "$appname: [reponame]"
 update
 readrefs
 
-- 
1.7.8.rc0.251.gccd63

Re: [PATCH] gitk: use "gitk: repo-top-level-dir" as window title

From: Paul Mackerras <hidden>
Date: 2016-06-15 22:53:20

On Wed, Nov 09, 2011 at 05:28:28PM +0100, Zbigniew Jędrzejewski-Szmek wrote:
Previously, when run in a subdirectory, gitk would show the name
of this subdirectory as title, which was misleading. When run with
GIT_DIR set, it would show the cwd, which is even more misleading.

In case of non-bare repos, the .git suffix in the path is skipped.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
Thanks, applied, with the patch fixed to use $gitdir not [gitdir]
(needed since 86e847bc removed [gitdir]).

Paul.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help