Code

git-gui: Use git-config now over git-repo-config.
[git.git] / git-gui.sh
index 66d85dc6d06cffae2c5e13068886ce50042cbef1..ae22338be353e4ba588948a0778ea8b0b8a1a60e 100755 (executable)
@@ -140,7 +140,7 @@ proc load_config {include_global} {
        array unset global_config
        if {$include_global} {
                catch {
-                       set fd_rc [open "| git repo-config --global --list" r]
+                       set fd_rc [open "| git config --global --list" r]
                        while {[gets $fd_rc line] >= 0} {
                                if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
                                        if {[is_many_config $name]} {
@@ -156,7 +156,7 @@ proc load_config {include_global} {
 
        array unset repo_config
        catch {
-               set fd_rc [open "| git repo-config --list" r]
+               set fd_rc [open "| git config --list" r]
                while {[gets $fd_rc line] >= 0} {
                        if {[regexp {^([^=]+)=(.*)$} $line line name value]} {
                                if {[is_many_config $name]} {
@@ -202,14 +202,14 @@ proc save_config {} {
                set value $global_config_new($name)
                if {$value ne $global_config($name)} {
                        if {$value eq $default_config($name)} {
-                               catch {exec git repo-config --global --unset $name}
+                               catch {exec git config --global --unset $name}
                        } else {
                                regsub -all "\[{}\]" $value {"} value
-                               exec git repo-config --global $name $value
+                               exec git config --global $name $value
                        }
                        set global_config($name) $value
                        if {$value eq $repo_config($name)} {
-                               catch {exec git repo-config --unset $name}
+                               catch {exec git config --unset $name}
                                set repo_config($name) $value
                        }
                }
@@ -219,10 +219,10 @@ proc save_config {} {
                set value $repo_config_new($name)
                if {$value ne $repo_config($name)} {
                        if {$value eq $global_config($name)} {
-                               catch {exec git repo-config --unset $name}
+                               catch {exec git config --unset $name}
                        } else {
                                regsub -all "\[{}\]" $value {"} value
-                               exec git repo-config $name $value
+                               exec git config $name $value
                        }
                        set repo_config($name) $value
                }
@@ -4151,7 +4151,7 @@ proc do_quit {} {
                        set rc_geometry {}
                }
                if {$cfg_geometry ne $rc_geometry} {
-                       catch {exec git repo-config gui.geometry $cfg_geometry}
+                       catch {exec git config gui.geometry $cfg_geometry}
                }
        }
 
@@ -4917,20 +4917,32 @@ 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
 
-if {[appname] eq {git-citool}} {
-       enable_option singlecommit
-
+switch -- $subcommand {
+blame {
        disable_option multicommit
        disable_option branch
        disable_option transport
 }
+citool {
+       enable_option singlecommit
 
-switch -- [lindex $argv 0] {
-blame {
        disable_option multicommit
        disable_option branch
        disable_option transport
@@ -5112,7 +5124,7 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
        lappend disable_on_lock \
                [list .mbar.commit entryconf [.mbar.commit index last] -state]
 
-       .mbar.commit add command -label {Add All To Commit} \
+       .mbar.commit add command -label {Add Existing To Commit} \
                -command do_add_all \
                -accelerator $M1T-I \
                -font font_ui
@@ -5257,20 +5269,30 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
 
 # -- Not a normal commit type invocation?  Do that instead!
 #
-switch -- [lindex $argv 0] {
+switch -- $subcommand {
 blame {
-       if {[llength $argv] == 3} {
-               set current_branch [lindex $argv 1]
-               show_blame $current_branch [lindex $argv 2]
-               return
-       } else {
+       if {[llength $argv] != 2} {
                puts stderr "usage: $argv0 blame commit path"
                exit 1
        }
+       set current_branch [lindex $argv 0]
+       show_blame $current_branch [lindex $argv 1]
+       return
+}
+citool -
+gui {
+       if {[llength $argv] != 0} {
+               puts -nonewline stderr "usage: $argv0"
+               if {$subcommand ne {gui} && [appname] ne "git-$subcommand"} {
+                       puts -nonewline stderr " $subcommand"
+               }
+               puts stderr {}
+               exit 1
+       }
+       # fall through to setup UI for commits
 }
-{} {}
 default {
-       puts stderr "usage: $argv0 \[{blame}\]"
+       puts stderr "usage: $argv0 \[{blame|citool}\]"
        exit 1
 }
 }
@@ -5401,7 +5423,7 @@ pack .vpane.lower.commarea.buttons.rescan -side top -fill x
 lappend disable_on_lock \
        {.vpane.lower.commarea.buttons.rescan conf -state}
 
-button .vpane.lower.commarea.buttons.incall -text {Add All} \
+button .vpane.lower.commarea.buttons.incall -text {Add Existing} \
        -command do_add_all \
        -font font_ui
 pack .vpane.lower.commarea.buttons.incall -side top -fill x