summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2011-11-09 17:28:28 +0100
committerPaul Mackerras <paulus@samba.org>2012-03-19 10:00:22 +1100
commit3878e636c640763ad12bff7f4dca967c34c530d6 (patch)
tree13dcb2c393ff80d1a95b6a409776e2beca58786a
parent811c70fc8369cfeae2f1e843c695c37e3b0c3109 (diff)
downloadgit-3878e636c640763ad12bff7f4dca967c34c530d6.tar.gz
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>
-rwxr-xr-xgitk13
1 files changed, 12 insertions, 1 deletions
diff --git a/gitk b/gitk
index 64ef3c4013..aa9b2e341d 100755
--- a/gitk
+++ b/gitk
@@ -14,6 +14,15 @@ proc hasworktree {} {
[exec git rev-parse --is-inside-git-dir] == "false"}]
}
+proc reponame {} {
+ global gitdir
+ 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
@@ -11607,6 +11616,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
@@ -11676,7 +11687,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