git-gui: Hide non-commit related commands when invoked as git-citool.
If the user is invoking us as git-citool then they want to perform a single commit and exit quickly. Since we are about to be a very short lived process we should do what we can to avoid spending CPU time setting up menus which the user will never use, like the fetch/push/pull menus. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
42
git-gui
42
git-gui
@ -169,6 +169,7 @@ if {$cdup != ""} {
|
|||||||
}
|
}
|
||||||
unset cdup
|
unset cdup
|
||||||
|
|
||||||
|
set single_commit 0
|
||||||
if {$appname == {git-citool}} {
|
if {$appname == {git-citool}} {
|
||||||
set single_commit 1
|
set single_commit 1
|
||||||
}
|
}
|
||||||
@ -177,7 +178,6 @@ if {$appname == {git-citool}} {
|
|||||||
##
|
##
|
||||||
## task management
|
## task management
|
||||||
|
|
||||||
set single_commit 0
|
|
||||||
set status_active 0
|
set status_active 0
|
||||||
set diff_active 0
|
set diff_active 0
|
||||||
set commit_active 0
|
set commit_active 0
|
||||||
@ -1931,9 +1931,11 @@ menu .mbar -tearoff 0
|
|||||||
.mbar add cascade -label Project -menu .mbar.project
|
.mbar add cascade -label Project -menu .mbar.project
|
||||||
.mbar add cascade -label Edit -menu .mbar.edit
|
.mbar add cascade -label Edit -menu .mbar.edit
|
||||||
.mbar add cascade -label Commit -menu .mbar.commit
|
.mbar add cascade -label Commit -menu .mbar.commit
|
||||||
.mbar add cascade -label Fetch -menu .mbar.fetch
|
if {!$single_commit} {
|
||||||
.mbar add cascade -label Pull -menu .mbar.pull
|
.mbar add cascade -label Fetch -menu .mbar.fetch
|
||||||
.mbar add cascade -label Push -menu .mbar.push
|
.mbar add cascade -label Pull -menu .mbar.pull
|
||||||
|
.mbar add cascade -label Push -menu .mbar.push
|
||||||
|
}
|
||||||
. configure -menu .mbar
|
. configure -menu .mbar
|
||||||
|
|
||||||
# -- Project Menu
|
# -- Project Menu
|
||||||
@ -1941,9 +1943,11 @@ menu .mbar.project
|
|||||||
.mbar.project add command -label Visualize \
|
.mbar.project add command -label Visualize \
|
||||||
-command do_gitk \
|
-command do_gitk \
|
||||||
-font font_ui
|
-font font_ui
|
||||||
.mbar.project add command -label {Repack Database} \
|
if {!$single_commit} {
|
||||||
-command do_repack \
|
.mbar.project add command -label {Repack Database} \
|
||||||
-font font_ui
|
-command do_repack \
|
||||||
|
-font font_ui
|
||||||
|
}
|
||||||
.mbar.project add command -label Quit \
|
.mbar.project add command -label Quit \
|
||||||
-command do_quit \
|
-command do_quit \
|
||||||
-accelerator $M1T-Q \
|
-accelerator $M1T-Q \
|
||||||
@ -2017,14 +2021,16 @@ lappend disable_on_lock \
|
|||||||
lappend disable_on_lock \
|
lappend disable_on_lock \
|
||||||
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
||||||
|
|
||||||
# -- Fetch Menu
|
if {!$single_commit} {
|
||||||
menu .mbar.fetch
|
# -- Fetch Menu
|
||||||
|
menu .mbar.fetch
|
||||||
|
|
||||||
# -- Pull Menu
|
# -- Pull Menu
|
||||||
menu .mbar.pull
|
menu .mbar.pull
|
||||||
|
|
||||||
# -- Push Menu
|
# -- Push Menu
|
||||||
menu .mbar.push
|
menu .mbar.push
|
||||||
|
}
|
||||||
|
|
||||||
# -- Main Window Layout
|
# -- Main Window Layout
|
||||||
panedwindow .vpane -orient vertical
|
panedwindow .vpane -orient vertical
|
||||||
@ -2335,8 +2341,10 @@ set file_lists($ui_other) [list]
|
|||||||
|
|
||||||
wm title . "$appname ([file normalize [file dirname $gitdir]])"
|
wm title . "$appname ([file normalize [file dirname $gitdir]])"
|
||||||
focus -force $ui_comm
|
focus -force $ui_comm
|
||||||
load_all_remotes
|
if {!$single_commit} {
|
||||||
populate_remote_menu .mbar.fetch From fetch_from
|
load_all_remotes
|
||||||
populate_remote_menu .mbar.push To push_to
|
populate_remote_menu .mbar.fetch From fetch_from
|
||||||
populate_pull_menu .mbar.pull
|
populate_remote_menu .mbar.push To push_to
|
||||||
|
populate_pull_menu .mbar.pull
|
||||||
|
}
|
||||||
after 1 update_status
|
after 1 update_status
|
||||||
|
Reference in New Issue
Block a user