gitk: Use "gitk: repo-top-level-dir" as window title
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 <zbyszek@in.waw.pl>
Zbigniew Jędrzejewski-Szmek committed
Nov 9, 2011 at 17:28 UTC
3878e636c640763ad12bff7f4dca967c34c530d6
1 file changed
+12
-1
gitk
+12
-1
@@ -14,6 +14,15 @@ proc hasworktree {} {
14
[exec git rev-parse --is-inside-git-dir] == "false"}]
15
}
16
17
+proc reponame {} {
18
+ global gitdir
19
+ set n [file normalize $gitdir]
20
+ if {[string match "*/.git" $n]} {
21
+ set n [string range $n 0 end-5]
22
+ }
23
+ return [file tail $n]
24
+}
25
+
26
# A simple scheduler for compute-intensive stuff.
27
# The aim is to make sure that event handlers for GUI actions can
28
# run at least every 50-100 ms. Unfortunately fileevent handlers are
@@ -11607,6 +11616,8 @@ if {[package vcompare $git_version "1.6.6.2"] >= 0} {
11616
set show_notes "--show-notes"
11617
}
11618
11619
+set appname "gitk"
11620
+
11621
set runq {}
11622
set history {}
11623
set historyindex 0
@@ -11676,7 +11687,7 @@ catch {
11687
}
11688
# wait for the window to become visible
11689
tkwait visibility .
11679
-wm title . "[file tail $argv0]: [file tail [pwd]]"
11690
+wm title . "$appname: [reponame]"
11691
update
11692
readrefs
11693