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