summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c950c66)
raw | patch | inline | side by side (parent: c950c66)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 21 Jan 2007 02:55:05 +0000 (21:55 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 21 Jan 2007 07:54:21 +0000 (02:54 -0500) |
Because it is such a common idiom to use [gitdir] along with [file join]
to locate the path of an item within the .git directory of the current
repository we might as well allow gitdir to act as a wrapper for the
file join operation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
to locate the path of an item within the .git directory of the current
repository we might as well allow gitdir to act as a wrapper for the
file join operation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index b937cf216358e83656ed3802778a698bdcb7de15..84205b08bfa67977b08260f5114a9da116f0cae9 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
return $_appname
}
-proc gitdir {} {
+proc gitdir {args} {
global _gitdir
- return $_gitdir
+ if {$args eq {}} {
+ return $_gitdir
+ }
+ return [eval [concat [list file join $_gitdir] $args]]
}
proc reponame {} {
return
}
- set merge_head [file join [gitdir] MERGE_HEAD]
+ set merge_head [gitdir MERGE_HEAD]
if {[file exists $merge_head]} {
set ct merge
set fd_mh [open $merge_head r]
set ls_others [list | git ls-files --others -z \
--exclude-per-directory=.gitignore]
- set info_exclude [file join [gitdir] info exclude]
+ set info_exclude [gitdir info exclude]
if {[file readable $info_exclude]} {
lappend ls_others "--exclude-from=$info_exclude"
}
proc load_message {file} {
global ui_comm
- set f [file join [gitdir] $file]
+ set f [gitdir $file]
if {[file isfile $f]} {
if {[catch {set fd [open $f r]}]} {
return 0
proc commit_prehook {curHEAD msg} {
global ui_status_value pch_error
- set pchook [file join [gitdir] hooks pre-commit]
+ set pchook [gitdir hooks pre-commit]
# On Cygwin [file executable] might lie so we need to ask
# the shell if the hook is executable. Yes that's annoying.
# -- Cleanup after ourselves.
#
- catch {file delete [file join [gitdir] MERGE_HEAD]}
- catch {file delete [file join [gitdir] MERGE_MSG]}
- catch {file delete [file join [gitdir] SQUASH_MSG]}
- catch {file delete [file join [gitdir] GITGUI_MSG]}
+ catch {file delete [gitdir MERGE_HEAD]}
+ catch {file delete [gitdir MERGE_MSG]}
+ catch {file delete [gitdir SQUASH_MSG]}
+ catch {file delete [gitdir GITGUI_MSG]}
# -- Let rerere do its thing.
#
- if {[file isdirectory [file join [gitdir] rr-cache]]} {
+ if {[file isdirectory [gitdir rr-cache]]} {
catch {exec git rerere}
}
# -- Run the post-commit hook.
#
- set pchook [file join [gitdir] hooks post-commit]
+ set pchook [gitdir hooks post-commit]
if {[is_Windows] && [file isfile $pchook]} {
set pchook [list sh -c [concat \
"if test -x \"$pchook\";" \
set all_remotes [list]
array unset tracking_branches
- set rm_dir [file join [gitdir] remotes]
+ set rm_dir [gitdir remotes]
if {[file isdirectory $rm_dir]} {
set all_remotes [glob \
-types f \
}
} else {
catch {
- set fd [open [file join [gitdir] remotes $r] r]
+ set fd [open [gitdir remotes $r] r]
while {[gets $fd n] >= 0} {
if {[regexp {^Pull:[ \t]*([^:]+):} $n]} {
set enable 1
}
} else {
catch {
- set fd [open [file join [gitdir] remotes $r] r]
+ set fd [open [gitdir remotes $r] r]
while {[gets $fd n] >= 0} {
if {[regexp {^Push:[ \t]*([^:]+):} $n]} {
set enable 1
}
} else {
catch {
- set fd [open [file join [gitdir] remotes $remote] r]
+ set fd [open [gitdir remotes $remote] r]
while {[gets $fd line] >= 0} {
if {[regexp {^Pull:[ \t]*([^:]+):} $line line rb]} {
lappend rb_list $rb
# -- Stash our current commit buffer.
#
- set save [file join [gitdir] GITGUI_MSG]
+ set save [gitdir GITGUI_MSG]
set msg [string trim [$ui_comm get 0.0 end]]
if {![string match amend* $commit_type]
&& [$ui_comm edit modified]