1
0
mirror of https://github.com/git/git.git synced 2024-11-05 22:19:47 +01:00

git-gui: Refactor reponame computation.

We use reponame in a number of locations, and every time its always the
same value.  Instead of computing this multiple times with code that was
copied and pasted around we can compute it once immediately after the
global gitdir has been computed and set.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2007-01-20 21:36:21 -05:00
parent 8ff487c737
commit 16d18b853b

@ -239,6 +239,9 @@ if {[catch {cd [file dirname $gitdir]} err]} {
error_popup "No working directory [file dirname $gitdir]:\n\n$err"
exit 1
}
set reponame [lindex [file split \
[file normalize [file dirname $gitdir]]] \
end]
set single_commit 0
if {$appname eq {git-citool}} {
@ -2417,7 +2420,7 @@ proc do_include_all {} {
}
proc revert_helper {txt paths} {
global gitdir appname
global gitdir appname reponame
global file_states current_diff
if {![lock_index begin-update]} return
@ -2450,10 +2453,6 @@ proc revert_helper {txt paths} {
set s "these $n files"
}
set reponame [lindex [file split \
[file normalize [file dirname $gitdir]]] \
end]
set reply [tk_dialog \
.confirm_revert \
"$appname ($reponame)" \
@ -2599,7 +2598,7 @@ $copyright" \
}
proc do_options {} {
global appname gitdir font_descs
global appname gitdir reponame font_descs
global repo_config global_config
global repo_config_new global_config_new
@ -2618,9 +2617,6 @@ proc do_options {} {
foreach name [array names global_config] {
set global_config_new($name) $global_config($name)
}
set reponame [lindex [file split \
[file normalize [file dirname $gitdir]]] \
end]
set w .options_editor
toplevel $w
@ -2756,11 +2752,7 @@ proc do_save_config {w} {
}
proc do_windows_shortcut {} {
global gitdir appname argv0
set reponame [lindex [file split \
[file normalize [file dirname $gitdir]]] \
end]
global gitdir appname reponame argv0
if {[catch {
set desktop [exec cygpath \
@ -2806,11 +2798,7 @@ proc do_windows_shortcut {} {
}
proc do_macosx_app {} {
global gitdir appname argv0 env
set reponame [lindex [file split \
[file normalize [file dirname $gitdir]]] \
end]
global gitdir appname reponame argv0 env
set fn [tk_getSaveFile \
-parent . \