git-gui: Remove the commit_active global variable.
We were originally trying to use $commit_active to tell us if there was a commit currently in progress, just so we didn't attempt to start a second (parallel) one by mistake. But really the index lock handles this for us as it won't let us lock the index if it is already locked for update. So this can't happen. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 12, 2006 at 18:03 UTC
333b0c74b33fe54f0489813950345edbeb62c0b5
1 file changed
+9
-18
git-gui
+9
-18
@@ -183,7 +183,6 @@ if {$appname == {git-citool}} {
183
184
set status_active 0
185
set diff_active 0
186
-set commit_active 0
186
187
set disable_on_lock [list]
188
set index_lock_type none
@@ -664,10 +663,10 @@ proc load_last_commit {} {
663
664
proc commit_tree {} {
665
global tcl_platform HEAD gitdir commit_type file_states
667
- global commit_active pch_error
666
+ global pch_error
667
global ui_status_value ui_comm
668
670
- if {$commit_active || ![lock_index update]} return
669
+ if {![lock_index update]} return
670
671
# -- Our in memory state should match the repository.
672
#
@@ -739,8 +738,6 @@ A good commit message has the following format:
738
return
739
}
740
742
- set commit_active 1
743
-
741
# -- Ask the pre-commit hook for the go-ahead.
742
#
743
set pchook [file join $gitdir hooks pre-commit]
@@ -767,7 +764,7 @@ A good commit message has the following format:
764
}
765
766
proc commit_stage1 {fd_ph curHEAD msg} {
770
- global commit_active pch_error ui_status_value
767
+ global pch_error ui_status_value
768
769
append pch_error [read $fd_ph]
770
fconfigure $fd_ph -blocking 1
@@ -776,14 +773,13 @@ proc commit_stage1 {fd_ph curHEAD msg} {
773
set ui_status_value {Commit declined by pre-commit hook.}
774
hook_failed_popup pre-commit $pch_error
775
unlock_index
779
- set commit_active 0
780
- set pch_error {}
781
- return
776
+ } else {
777
+ commit_stage2 $curHEAD $msg
778
}
783
- commit_stage2 $curHEAD $msg
784
- return
779
+ set pch_error {}
780
+ } else {
781
+ fconfigure $fd_ph -blocking 0
782
}
786
- fconfigure $fd_ph -blocking 0
783
}
784
785
proc commit_stage2 {curHEAD msg} {
@@ -798,13 +794,12 @@ proc commit_stage2 {curHEAD msg} {
794
795
proc commit_stage3 {fd_wt curHEAD msg} {
796
global single_commit gitdir HEAD PARENT commit_type
801
- global commit_active ui_status_value ui_comm
797
+ global ui_status_value ui_comm
798
global file_states
799
800
gets $fd_wt tree_id
801
if {$tree_id == {} || [catch {close $fd_wt} err]} {
802
error_popup "write-tree failed:\n\n$err"
807
- set commit_active 0
803
set ui_status_value {Commit failed.}
804
unlock_index
805
return
@@ -825,7 +820,6 @@ proc commit_stage3 {fd_wt curHEAD msg} {
820
close $fd_mh
821
} err]} {
822
error_popup "Loading MERGE_HEAD failed:\n\n$err"
828
- set commit_active 0
823
set ui_status_value {Commit failed.}
824
unlock_index
825
return
@@ -838,7 +832,6 @@ proc commit_stage3 {fd_wt curHEAD msg} {
832
lappend cmd << $msg
833
if {[catch {set cmt_id [eval exec $cmd]} err]} {
834
error_popup "commit-tree failed:\n\n$err"
841
- set commit_active 0
835
set ui_status_value {Commit failed.}
836
unlock_index
837
return
@@ -859,7 +852,6 @@ proc commit_stage3 {fd_wt curHEAD msg} {
852
set cmd [list git update-ref -m $reflogm HEAD $cmt_id $curHEAD]
853
if {[catch {eval exec $cmd} err]} {
854
error_popup "update-ref failed:\n\n$err"
862
- set commit_active 0
855
set ui_status_value {Commit failed.}
856
unlock_index
857
return
@@ -886,7 +878,6 @@ proc commit_stage3 {fd_wt curHEAD msg} {
878
879
# -- Update status without invoking any git commands.
880
#
889
- set commit_active 0
881
set commit_type normal
882
set HEAD $cmt_id
883
set PARENT $cmt_id