summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 42b922f)
raw | patch | inline | side by side (parent: 42b922f)
author | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 8 Feb 2007 23:03:41 +0000 (18:03 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 8 Feb 2007 23:03:41 +0000 (18:03 -0500) |
This is a minor code cleanup to make working with what used to be the
$single_commit flag easier. Its also to better handle various UI
configurations, depending on command line parameters given by the
user, or perhaps user preferences.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
$single_commit flag easier. Its also to better handle various UI
configurations, depending on command line parameters given by the
user, or perhaps user preferences.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 1d225644aab9e32c6d8d0340c406d048dd16a582..8305720d532fbed05a70787980911938c79a2c67 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
return $_iscygwin
}
+proc is_enabled {option} {
+ global enabled_options
+ if {[catch {set on $enabled_options($option)}]} {return 0}
+ return $on
+}
+
+proc enable_option {option} {
+ global enabled_options
+ set enabled_options($option) 1
+}
+
+proc disable_option {option} {
+ global enabled_options
+ set enabled_options($option) 0
+}
+
######################################################################
##
## config
[file normalize [file dirname $_gitdir]]] \
end]
-set single_commit 0
+enable_option multicommit
if {[appname] eq {git-citool}} {
- set single_commit 1
+ disable_option multicommit
}
######################################################################
global HEAD PARENT MERGE_HEAD commit_type
global ui_index ui_workdir ui_status_value ui_comm
global rescan_active file_states
- global repo_config single_commit
+ global repo_config
if {$rescan_active > 0 || ![lock_index read]} return
$ui_comm edit modified false
}
- if {!$single_commit} {
+ if {[is_enabled multicommit]} {
load_all_heads
populate_branch_menu
}
proc commit_committree {fd_wt curHEAD msg} {
global HEAD PARENT MERGE_HEAD commit_type
- global single_commit all_heads current_branch
+ global all_heads current_branch
global ui_status_value ui_comm selected_commit_type
global file_states selected_paths rescan_active
global repo_config
$ui_comm edit reset
$ui_comm edit modified false
- if {$single_commit} do_quit
+ if {![is_enabled multicommit]} do_quit
# -- Update in memory status
#
menu .mbar -tearoff 0
.mbar add cascade -label Repository -menu .mbar.repository
.mbar add cascade -label Edit -menu .mbar.edit
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
.mbar add cascade -label Branch -menu .mbar.branch
}
.mbar add cascade -label Commit -menu .mbar.commit
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
.mbar add cascade -label Merge -menu .mbar.merge
.mbar add cascade -label Fetch -menu .mbar.fetch
.mbar add cascade -label Push -menu .mbar.push
-font font_ui
.mbar.repository add separator
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
.mbar.repository add command -label {Database Statistics} \
-command do_stats \
-font font_ui
# -- Branch Menu
#
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
menu .mbar.branch
.mbar.branch add command -label {Create...} \
pack .branch.cb -side left -fill x
pack .branch -side top -fill x
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
menu .mbar.merge
.mbar.merge add command -label {Local Merge...} \
-command do_local_merge \
bind $ui_diff <Key-Right> {catch {%W xview scroll 1 units};break}
bind $ui_diff <Button-1> {focus %W}
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
bind . <$M1B-Key-n> do_create_branch
bind . <$M1B-Key-N> do_create_branch
}
# -- Only initialize complex UI if we are going to stay running.
#
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
load_all_remotes
load_all_heads
# -- Only suggest a gc run if we are going to stay running.
#
-if {!$single_commit} {
+if {[is_enabled multicommit]} {
set object_limit 2000
if {[is_Windows]} {set object_limit 200}
regexp {^([0-9]+) objects,} [exec git count-objects] _junk objects_current