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]