@@ -39,11 +39,13 @@ interface Context {
3939}
4040
4141type Flags = '--interactive' ;
42+ type RebaseOptions = { interactive ?: boolean } ;
4243
4344interface State {
4445 repo : string | Repository ;
4546 destination : GitReference ;
4647 flags : Flags [ ] ;
48+ options : RebaseOptions ;
4749}
4850
4951export interface RebaseGitCommandArgs {
@@ -82,13 +84,13 @@ export class RebaseGitCommand extends QuickCommand<State> {
8284
8385 async execute ( state : RebaseStepState ) {
8486 const configs : { sequenceEditor ?: string } = { } ;
85- if ( state . flags . includes ( '-- interactive' ) ) {
87+ if ( state . options ?. interactive ) {
8688 await this . container . rebaseEditor . enableForNextUse ( ) ;
8789 configs . sequenceEditor = getEditorCommand ( ) ;
8890 }
8991
9092 try {
91- await state . repo . git . rebase ( state . destination . ref , configs , state . flags ) ;
93+ await state . repo . git . rebase ( state . destination . ref , configs , state . options ) ;
9294 } catch ( ex ) {
9395 Logger . error ( ex , this . title ) ;
9496 void showGenericErrorMessage ( ex ) ;
@@ -108,8 +110,8 @@ export class RebaseGitCommand extends QuickCommand<State> {
108110 title : this . title ,
109111 } ;
110112
111- if ( state . flags == null ) {
112- state . flags = [ ] ;
113+ if ( state . options == null ) {
114+ state . options = { } ;
113115 }
114116
115117 let skippedStepOne = false ;
@@ -212,7 +214,7 @@ export class RebaseGitCommand extends QuickCommand<State> {
212214 const result = yield * this . confirmStep ( state as RebaseStepState , context ) ;
213215 if ( result === StepResultBreak ) continue ;
214216
215- state . flags = result ;
217+ state . options = Object . assign ( state . options ?? { } , ... result ) ;
216218
217219 endSteps ( state ) ;
218220 void this . execute ( state as RebaseStepState ) ;
@@ -221,7 +223,7 @@ export class RebaseGitCommand extends QuickCommand<State> {
221223 return state . counter < 0 ? StepResultBreak : undefined ;
222224 }
223225
224- private async * confirmStep ( state : RebaseStepState , context : Context ) : AsyncStepResultGenerator < Flags [ ] > {
226+ private async * confirmStep ( state : RebaseStepState , context : Context ) : AsyncStepResultGenerator < RebaseOptions [ ] > {
225227 const counts = await this . container . git . getLeftRightCommitCount (
226228 state . repo . path ,
227229 createRevisionRange ( state . destination . ref , context . branch . ref , '...' ) ,
@@ -253,8 +255,9 @@ export class RebaseGitCommand extends QuickCommand<State> {
253255 return StepResultBreak ;
254256 }
255257
258+ const optionsArr : RebaseOptions [ ] = [ ] ;
256259 const rebaseItems = [
257- createFlagsQuickPickItem < Flags > ( state . flags , [ '-- interactive' ] , {
260+ createFlagsQuickPickItem < RebaseOptions > ( optionsArr , [ { interactive : true } ] , {
258261 label : `Interactive ${ this . title } ` ,
259262 description : '--interactive' ,
260263 detail : `Will interactively update ${ getReferenceLabel ( context . branch , {
@@ -267,7 +270,7 @@ export class RebaseGitCommand extends QuickCommand<State> {
267270
268271 if ( behind > 0 ) {
269272 rebaseItems . unshift (
270- createFlagsQuickPickItem < Flags > ( state . flags , [ ] , {
273+ createFlagsQuickPickItem < RebaseOptions > ( optionsArr , [ { } ] , {
271274 label : this . title ,
272275 detail : `Will update ${ getReferenceLabel ( context . branch , {
273276 label : false ,
@@ -278,10 +281,12 @@ export class RebaseGitCommand extends QuickCommand<State> {
278281 ) ;
279282 }
280283
281- const step : QuickPickStep < FlagsQuickPickItem < Flags > > = this . createConfirmStep (
284+ const step : QuickPickStep < FlagsQuickPickItem < RebaseOptions > > = this . createConfirmStep (
282285 appendReposToTitle ( `Confirm ${ title } ` , state , context ) ,
283286 rebaseItems ,
284287 ) ;
288+
289+ state . options = Object . assign ( state . options , ...optionsArr ) ;
285290 const selection : StepSelection < typeof step > = yield step ;
286291 return canPickStepContinue ( step , state , selection ) ? selection [ 0 ] . item : StepResultBreak ;
287292 }
0 commit comments