OSDN Git Service

git-gui: Move feature option selection before GIT_DIR init
authorShawn O. Pearce <spearce@spearce.org>
Wed, 18 Jul 2007 03:23:56 +0000 (23:23 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 18 Jul 2007 03:23:56 +0000 (23:23 -0400)
By moving our feature option determination up before we look for GIT_DIR
we can make a decision about whether or not we need a working tree up
front, before we look for GIT_DIR.  A future change could then allow
us to start in a bare Git repository if we only need access to the ODB.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh

index 0443129..f13fa80 100755 (executable)
@@ -632,6 +632,43 @@ You are using [git-version]:
 
 ######################################################################
 ##
+## feature option selection
+
+if {[regexp {^git-(.+)$} [appname] _junk subcommand]} {
+       unset _junk
+} else {
+       set subcommand gui
+}
+if {$subcommand eq {gui.sh}} {
+       set subcommand gui
+}
+if {$subcommand eq {gui} && [llength $argv] > 0} {
+       set subcommand [lindex $argv 0]
+       set argv [lrange $argv 1 end]
+}
+
+enable_option multicommit
+enable_option branch
+enable_option transport
+
+switch -- $subcommand {
+browser -
+blame {
+       disable_option multicommit
+       disable_option branch
+       disable_option transport
+}
+citool {
+       enable_option singlecommit
+
+       disable_option multicommit
+       disable_option branch
+       disable_option transport
+}
+}
+
+######################################################################
+##
 ## repository setup
 
 if {[catch {
@@ -1598,43 +1635,6 @@ apply_config
 
 ######################################################################
 ##
-## feature option selection
-
-if {[regexp {^git-(.+)$} [appname] _junk subcommand]} {
-       unset _junk
-} else {
-       set subcommand gui
-}
-if {$subcommand eq {gui.sh}} {
-       set subcommand gui
-}
-if {$subcommand eq {gui} && [llength $argv] > 0} {
-       set subcommand [lindex $argv 0]
-       set argv [lrange $argv 1 end]
-}
-
-enable_option multicommit
-enable_option branch
-enable_option transport
-
-switch -- $subcommand {
-browser -
-blame {
-       disable_option multicommit
-       disable_option branch
-       disable_option transport
-}
-citool {
-       enable_option singlecommit
-
-       disable_option multicommit
-       disable_option branch
-       disable_option transport
-}
-}
-
-######################################################################
-##
 ## ui construction
 
 set ui_comm {}