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>
Shawn O. Pearce committed
Nov 12, 2006 at 16:20 UTC
4ccdab028263dfdeb0adf9764466bb3a43265395
1 file changed
+25
-17
git-gui
+25
-17
@@ -169,6 +169,7 @@ if {$cdup != ""} {
169
}
170
unset cdup
171
172
+set single_commit 0
173
if {$appname == {git-citool}} {
174
set single_commit 1
175
}
@@ -177,7 +178,6 @@ if {$appname == {git-citool}} {
178
##
179
## task management
180
180
-set single_commit 0
181
set status_active 0
182
set diff_active 0
183
set commit_active 0
@@ -1931,9 +1931,11 @@ menu .mbar -tearoff 0
1931
.mbar add cascade -label Project -menu .mbar.project
1932
.mbar add cascade -label Edit -menu .mbar.edit
1933
.mbar add cascade -label Commit -menu .mbar.commit
1934
-.mbar add cascade -label Fetch -menu .mbar.fetch
1935
-.mbar add cascade -label Pull -menu .mbar.pull
1936
-.mbar add cascade -label Push -menu .mbar.push
1934
+if {!$single_commit} {
1935
+ .mbar add cascade -label Fetch -menu .mbar.fetch
1936
+ .mbar add cascade -label Pull -menu .mbar.pull
1937
+ .mbar add cascade -label Push -menu .mbar.push
1938
+}
1939
. configure -menu .mbar
1940
1941
# -- Project Menu
@@ -1941,9 +1943,11 @@ menu .mbar.project
1943
.mbar.project add command -label Visualize \
1944
-command do_gitk \
1945
-font font_ui
1944
-.mbar.project add command -label {Repack Database} \
1945
- -command do_repack \
1946
- -font font_ui
1946
+if {!$single_commit} {
1947
+ .mbar.project add command -label {Repack Database} \
1948
+ -command do_repack \
1949
+ -font font_ui
1950
+}
1951
.mbar.project add command -label Quit \
1952
-command do_quit \
1953
-accelerator $M1T-Q \
@@ -2017,14 +2021,16 @@ lappend disable_on_lock \
2021
lappend disable_on_lock \
2022
[list .mbar.commit entryconf [.mbar.commit index last] -state]
2023
2020
-# -- Fetch Menu
2021
-menu .mbar.fetch
2024
+if {!$single_commit} {
2025
+ # -- Fetch Menu
2026
+ menu .mbar.fetch
2027
2023
-# -- Pull Menu
2024
-menu .mbar.pull
2028
+ # -- Pull Menu
2029
+ menu .mbar.pull
2030
2026
-# -- Push Menu
2027
-menu .mbar.push
2031
+ # -- Push Menu
2032
+ menu .mbar.push
2033
+}
2034
2035
# -- Main Window Layout
2036
panedwindow .vpane -orient vertical
@@ -2335,8 +2341,10 @@ set file_lists($ui_other) [list]
2341
2342
wm title . "$appname ([file normalize [file dirname $gitdir]])"
2343
focus -force $ui_comm
2338
-load_all_remotes
2339
-populate_remote_menu .mbar.fetch From fetch_from
2340
-populate_remote_menu .mbar.push To push_to
2341
-populate_pull_menu .mbar.pull
2344
+if {!$single_commit} {
2345
+ load_all_remotes
2346
+ populate_remote_menu .mbar.fetch From fetch_from
2347
+ populate_remote_menu .mbar.push To push_to
2348
+ populate_pull_menu .mbar.pull
2349
+}
2350
after 1 update_status