Skip to content

Commit

Permalink
gitk: use "gitk: repo-top-level-dir" as window title
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
keszybz committed Feb 20, 2012
1 parent 811c70f commit 554977d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 554977d

Please sign in to comment.