@@ -14,6 +14,7 @@ const localize = nls.loadMessageBundle();
14
14
interface ActionButtonState {
15
15
readonly HEAD : Branch | undefined ;
16
16
readonly isCommitInProgress : boolean ;
17
+ readonly isMergeInProgress : boolean ;
17
18
readonly isSyncInProgress : boolean ;
18
19
readonly repositoryHasChanges : boolean ;
19
20
}
@@ -34,7 +35,13 @@ export class ActionButtonCommand {
34
35
private disposables : Disposable [ ] = [ ] ;
35
36
36
37
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
+ } ;
38
45
39
46
repository . onDidRunGitStatus ( this . onDidRunGitStatus , this , this . disposables ) ;
40
47
repository . onDidChangeOperations ( this . onDidChangeOperations , this , this . disposables ) ;
@@ -123,16 +130,16 @@ export class ActionButtonCommand {
123
130
} ,
124
131
]
125
132
] ,
126
- enabled : this . state . repositoryHasChanges && ! this . state . isCommitInProgress
133
+ enabled : this . state . repositoryHasChanges && ! this . state . isCommitInProgress && ! this . state . isMergeInProgress
127
134
} ;
128
135
}
129
136
130
137
private getPublishBranchActionButton ( ) : SourceControlActionButton | undefined {
131
138
const config = workspace . getConfiguration ( 'git' , Uri . file ( this . repository . root ) ) ;
132
139
const showActionButton = config . get < { publish : boolean } > ( 'showActionButton' , { publish : true } ) ;
133
140
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 ; }
136
143
137
144
return {
138
145
command : {
@@ -151,8 +158,8 @@ export class ActionButtonCommand {
151
158
const config = workspace . getConfiguration ( 'git' , Uri . file ( this . repository . root ) ) ;
152
159
const showActionButton = config . get < { sync : boolean } > ( 'showActionButton' , { sync : true } ) ;
153
160
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 ; }
156
163
157
164
const ahead = this . state . HEAD . ahead ? ` ${ this . state . HEAD . ahead } $(arrow-up)` : '' ;
158
165
const behind = this . state . HEAD . behind ? ` ${ this . state . HEAD . behind } $(arrow-down)` : '' ;
@@ -190,9 +197,10 @@ export class ActionButtonCommand {
190
197
this . state = {
191
198
...this . state ,
192
199
HEAD : this . repository . HEAD ,
200
+ isMergeInProgress :
201
+ this . repository . mergeGroup . resourceStates . length !== 0 ,
193
202
repositoryHasChanges :
194
203
this . repository . indexGroup . resourceStates . length !== 0 ||
195
- this . repository . mergeGroup . resourceStates . length !== 0 ||
196
204
this . repository . untrackedGroup . resourceStates . length !== 0 ||
197
205
this . repository . workingTreeGroup . resourceStates . length !== 0
198
206
} ;
0 commit comments