From: "Łukasz Stelmach" <stlman@poczta.fm>
To: git@vger.kernel.org
Cc: mbranchaud@xiplink.com, paulus@samba.org, gitster@pobox.com,
"Łukasz Stelmach" <stlman@poczta.fm>
Subject: [PATCH] gitk: read and write a repository specific configuration file
Date: Sat, 8 Dec 2012 12:27:47 +0100 [thread overview]
Message-ID: <1354966067-2865-1-git-send-email-stlman@poczta.fm> (raw)
In-Reply-To: <50BF6629.8050806@xiplink.com>
Enable gitk read and write repository specific configuration
file: ".git/k" if the file exists. To make gitk use the local
file simply create one, e.g. with the touch(1) command.
This is very useful if one uses different views for different
repositories. Now there is no need to store all of them in
~/.gitk and make the views list needlessly long.
Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
---
gitk | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/gitk b/gitk
index 379582a..c6b7dc3 100755
--- a/gitk
+++ b/gitk
@@ -2703,7 +2703,7 @@ proc doprogupdate {} {
proc savestuff {w} {
global canv canv2 canv3 mainfont textfont uifont tabstop
- global stuffsaved findmergefiles maxgraphpct
+ global stuffsaved findmergefiles maxgraphpct gitdir
global maxwidth showneartags showlocalchanges
global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
global cmitmode wrapcomment datetimeformat limitdiffs
@@ -2714,10 +2714,12 @@ proc savestuff {w} {
if {$stuffsaved} return
if {![winfo viewable .]} return
catch {
- if {[file exists ~/.gitk-new]} {file delete -force ~/.gitk-new}
- set f [open "~/.gitk-new" w]
+ set fn [expr [file exists [file join $gitdir k]] ? \
+ {[file join $gitdir k-new]} : {"~/.gitk-new"}]
+ if {[file exists $fn]} {file delete -force $fn}
+ set f [open $fn w]
if {$::tcl_platform(platform) eq {windows}} {
- file attributes "~/.gitk-new" -hidden true
+ catch {file attributes "~/.gitk-new" -hidden true}
}
puts $f [list set mainfont $mainfont]
puts $f [list set textfont $textfont]
@@ -2769,7 +2771,7 @@ proc savestuff {w} {
}
puts $f "}"
close $f
- file rename -force "~/.gitk-new" "~/.gitk"
+ file rename -force $fn [regsub {\-new$} $fn {}]
}
set stuffsaved 1
}
@@ -11723,7 +11725,14 @@ namespace import ::msgcat::mc
## And eventually load the actual message catalog
::msgcat::mcload $gitk_msgsdir
+# check that we can find a .git directory somewhere...
+if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
+ show_error {} . [mc "Cannot find a git repository here."]
+ exit 1
+}
+
catch {source ~/.gitk}
+catch {source [file join $gitdir k]}
parsefont mainfont $mainfont
eval font create mainfont [fontflags mainfont]
@@ -11740,12 +11749,6 @@ setui $uicolor
setoptions
-# check that we can find a .git directory somewhere...
-if {[catch {set gitdir [exec git rev-parse --git-dir]}]} {
- show_error {} . [mc "Cannot find a git repository here."]
- exit 1
-}
-
set selecthead {}
set selectheadid {}
--
1.7.8.6
next prev parent reply other threads:[~2012-12-08 11:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 21:08 [PATCH] gitk: add a checkbox to control the visibility of tags Łukasz Stelmach
2012-12-02 2:16 ` Junio C Hamano
2012-12-02 21:25 ` Lukasz Stelmach
2012-12-02 21:29 ` [PATCH] gitk: read and write a repository specific configuration file Łukasz Stelmach
2012-12-03 21:15 ` Stefan Haller
2012-12-04 20:12 ` Lukasz Stelmach
2012-12-05 0:49 ` [PATCH v2] " Łukasz Stelmach
2012-12-05 15:20 ` Marc Branchaud
2012-12-08 11:27 ` Łukasz Stelmach [this message]
2012-12-09 9:18 ` [PATCH] " Junio C Hamano
2012-12-09 10:44 ` Paul Mackerras
2012-12-09 13:25 ` Lukasz Stelmach
2012-12-09 13:13 ` Lukasz Stelmach
2012-12-02 21:40 ` [PATCH] gitk: add a checkbox to control the visibility of tags Felipe Contreras
2013-01-02 7:17 ` Paul Mackerras
2013-01-02 7:24 ` Junio C Hamano
2013-01-02 8:03 ` Lukasz Stelmach
2013-01-02 17:08 ` Junio C Hamano
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=1354966067-2865-1-git-send-email-stlman@poczta.fm \
--to=stlman@poczta.fm \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mbranchaud@xiplink.com \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).