@@ -14,6 +14,7 @@ const localize = nls.loadMessageBundle();
1414interface ActionButtonState {
1515 readonly HEAD : Branch | undefined ;
1616 readonly isCommitInProgress : boolean ;
17+ readonly isMergeInProgress : boolean ;
1718 readonly isSyncInProgress : boolean ;
1819 readonly repositoryHasChanges : boolean ;
1920}
@@ -34,7 +35,13 @@ export class ActionButtonCommand {
3435 private disposables : Disposable [ ] = [ ] ;
3536
3637 constructor ( readonly repository : Repository ) {
37- this . _state = { HEAD : undefined , isCommitInProgress : false , isSyncInProgress : false , repositoryHasChanges : false } ;
38+ this . _state = {
39+ HEAD : undefined ,
40+ isCommitInProgress : false ,
41+ isMergeInProgress : false ,
42+ isSyncInProgress : false ,
43+ repositoryHasChanges : false
44+ } ;
3845
3946 repository . onDidRunGitStatus ( this . onDidRunGitStatus , this , this . disposables ) ;
4047 repository . onDidChangeOperations ( this . onDidChangeOperations , this , this . disposables ) ;
@@ -123,16 +130,16 @@ export class ActionButtonCommand {
123130 } ,
124131 ]
125132 ] ,
126- enabled : this . state . repositoryHasChanges && ! this . state . isCommitInProgress
133+ enabled : this . state . repositoryHasChanges && ! this . state . isCommitInProgress && ! this . state . isMergeInProgress
127134 } ;
128135 }
129136
130137 private getPublishBranchActionButton ( ) : SourceControlActionButton | undefined {
131138 const config = workspace . getConfiguration ( 'git' , Uri . file ( this . repository . root ) ) ;
132139 const showActionButton = config . get < { publish : boolean } > ( 'showActionButton' , { publish : true } ) ;
133140
134- // Branch does have an upstream, commit is in progress, or the button is disabled
135- if ( this . state . HEAD ?. upstream || this . state . isCommitInProgress || ! showActionButton . publish ) { return undefined ; }
141+ // Branch does have an upstream, commit/merge is in progress, or the button is disabled
142+ if ( this . state . HEAD ?. upstream || this . state . isCommitInProgress || this . state . isMergeInProgress || ! showActionButton . publish ) { return undefined ; }
136143
137144 return {
138145 command : {
@@ -151,8 +158,8 @@ export class ActionButtonCommand {
151158 const config = workspace . getConfiguration ( 'git' , Uri . file ( this . repository . root ) ) ;
152159 const showActionButton = config . get < { sync : boolean } > ( 'showActionButton' , { sync : true } ) ;
153160
154- // Branch does not have an upstream, commit is in progress, or the button is disabled
155- if ( ! this . state . HEAD ?. upstream || this . state . isCommitInProgress || ! showActionButton . sync ) { return undefined ; }
161+ // Branch does not have an upstream, commit/merge is in progress, or the button is disabled
162+ if ( ! this . state . HEAD ?. upstream || this . state . isCommitInProgress || this . state . isMergeInProgress || ! showActionButton . sync ) { return undefined ; }
156163
157164 const ahead = this . state . HEAD . ahead ? ` ${ this . state . HEAD . ahead } $(arrow-up)` : '' ;
158165 const behind = this . state . HEAD . behind ? ` ${ this . state . HEAD . behind } $(arrow-down)` : '' ;
@@ -190,9 +197,10 @@ export class ActionButtonCommand {
190197 this . state = {
191198 ...this . state ,
192199 HEAD : this . repository . HEAD ,
200+ isMergeInProgress :
201+ this . repository . mergeGroup . resourceStates . length !== 0 ,
193202 repositoryHasChanges :
194203 this . repository . indexGroup . resourceStates . length !== 0 ||
195- this . repository . mergeGroup . resourceStates . length !== 0 ||
196204 this . repository . untrackedGroup . resourceStates . length !== 0 ||
197205 this . repository . workingTreeGroup . resourceStates . length !== 0
198206 } ;
0 commit comments