Skip to content

Commit 3878e63

Browse files
keszybzpaulusmack
authored andcommitted
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 <[email protected]>
1 parent 811c70f commit 3878e63

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

gitk

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ proc hasworktree {} {
1414
[exec git rev-parse --is-inside-git-dir] == "false"}]
1515
}
1616

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+
1726
# A simple scheduler for compute-intensive stuff.
1827
# The aim is to make sure that event handlers for GUI actions can
1928
# 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} {
1160711616
set show_notes "--show-notes"
1160811617
}
1160911618

11619+
set appname "gitk"
11620+
1161011621
set runq {}
1161111622
set history {}
1161211623
set historyindex 0
@@ -11676,7 +11687,7 @@ catch {
1167611687
}
1167711688
# wait for the window to become visible
1167811689
tkwait visibility .
11679-
wm title . "[file tail $argv0]: [file tail [pwd]]"
11690+
wm title . "$appname: [reponame]"
1168011691
update
1168111692
readrefs
1168211693

0 commit comments

Comments
 (0)