git-gui: Select subcommands like git does.
If we are invoked as `git-foo`, then we should run the `foo` subcommand, as the user has made some sort of link from `git-foo` to our actual program code. So we should honor their request. If we are invoked as `git-gui foo`, the user has not made a link (or did, but is not using it right now) so we should execute the `foo` subcommand. We now can start the single commit UI mode via `git-citool` and also through `git gui citool`. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
2ebba528dc
commit
258871d305
48
git-gui.sh
48
git-gui.sh
@ -4917,20 +4917,32 @@ apply_config
|
|||||||
##
|
##
|
||||||
## feature option selection
|
## 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 multicommit
|
||||||
enable_option branch
|
enable_option branch
|
||||||
enable_option transport
|
enable_option transport
|
||||||
|
|
||||||
if {[appname] eq {git-citool}} {
|
switch -- $subcommand {
|
||||||
enable_option singlecommit
|
blame {
|
||||||
|
|
||||||
disable_option multicommit
|
disable_option multicommit
|
||||||
disable_option branch
|
disable_option branch
|
||||||
disable_option transport
|
disable_option transport
|
||||||
}
|
}
|
||||||
|
citool {
|
||||||
|
enable_option singlecommit
|
||||||
|
|
||||||
switch -- [lindex $argv 0] {
|
|
||||||
blame {
|
|
||||||
disable_option multicommit
|
disable_option multicommit
|
||||||
disable_option branch
|
disable_option branch
|
||||||
disable_option transport
|
disable_option transport
|
||||||
@ -5257,20 +5269,30 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
|
|||||||
|
|
||||||
# -- Not a normal commit type invocation? Do that instead!
|
# -- Not a normal commit type invocation? Do that instead!
|
||||||
#
|
#
|
||||||
switch -- [lindex $argv 0] {
|
switch -- $subcommand {
|
||||||
blame {
|
blame {
|
||||||
if {[llength $argv] == 3} {
|
if {[llength $argv] != 2} {
|
||||||
set current_branch [lindex $argv 1]
|
|
||||||
show_blame $current_branch [lindex $argv 2]
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
puts stderr "usage: $argv0 blame commit path"
|
puts stderr "usage: $argv0 blame commit path"
|
||||||
exit 1
|
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 {
|
default {
|
||||||
puts stderr "usage: $argv0 \[{blame}\]"
|
puts stderr "usage: $argv0 \[{blame|citool}\]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user