Git development
 help / color / mirror / Atom feed
From: Zbyszek Szmek <zbyszek@in.waw.pl>
To: git@vger.kernel.org
Cc: zbyszek@in.waw.pl
Subject: [PATCH] Use "gitk: /path/to/repo" as gitk window title.
Date: Thu, 13 Aug 2009 21:58:30 +0200	[thread overview]
Message-ID: <20090813195830.GL24561@in.waw.pl> (raw)

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

Previously, when run in a subdirectory, gitk would show the name
of this subdirectory as the title, which was misleading.
---
 gitk-git/gitk |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 4604c83..e656e81 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -16,6 +16,14 @@ proc gitdir {} {
     }
 }
 
+proc reponame {} {
+    set n [file normalize [gitdir]]
+    if {[string match "*/.git" $n]} {
+	set n [string range $n 0 end-5]
+    }
+    return $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
@@ -11156,6 +11164,8 @@ set nullfile "/dev/null"
 set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
 set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
 
+set appname "gitk"
+
 set runq {}
 set history {}
 set historyindex 0
@@ -11220,7 +11230,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.6.3.3

                 reply	other threads:[~2009-08-13 20:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090813195830.GL24561@in.waw.pl \
    --to=zbyszek@in.waw.pl \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox