@@ -8,6 +8,7 @@ import { getWantedCommitsWithBranchBoundariesOurCustomImpl } from "./git-stacked
88import { createExecSyncInRepo } from "./util/execSyncInRepo" ;
99import { Termination } from "./util/error" ;
1010import { assertNever } from "./util/assertNever" ;
11+ import { sequentialResolve } from "./util/sequentialResolve" ;
1112
1213import { parseNewGoodCommands } from "./parse-todo-of-stacked-rebase/parseNewGoodCommands" ;
1314import { GoodCommand , GoodCommandStacked } from "./parse-todo-of-stacked-rebase/validator" ;
@@ -25,7 +26,7 @@ export type GetBranchesCtx = BranchRefs & {
2526} ;
2627export type SimpleBranchAndCommit = {
2728 commitSHA : string | null ;
28- branchEndFullName : string ;
29+ branchEndFullName : string [ ] ;
2930 // branchExistsYet: boolean; // TODO
3031} ;
3132export type GetBoundariesInclInitial = (
@@ -107,7 +108,7 @@ const getBoundariesInclInitialByParsingNotYetAppliedState: GetBoundariesInclInit
107108 . map (
108109 ( cmd ) : SimpleBranchAndCommit => ( {
109110 commitSHA : cmd . commitSHAThatBranchPointsTo ,
110- branchEndFullName : cmd . targets ! [ 0 ] ,
111+ branchEndFullName : [ cmd . targets ! [ 0 ] ] ,
111112 } )
112113 ) ;
113114} ;
@@ -122,7 +123,7 @@ const getBoundariesInclInitialWithSipleBranchTraversal: GetBoundariesInclInitial
122123 . filter ( ( b ) => ! ! b . branchEnd )
123124 . map (
124125 ( boundary ) : SimpleBranchAndCommit => ( {
125- branchEndFullName : boundary . branchEnd ! . name ( ) , // TS ok because of the filter
126+ branchEndFullName : boundary . branchEnd ! . map ( ( x ) => x . name ( ) ) , // TS ok because of the filter
126127 commitSHA : boundary . commit . sha ( ) ,
127128 } )
128129 )
@@ -277,7 +278,7 @@ export const branchSequencer: BranchSequencer = async ({
277278 currentBranch,
278279 } )
279280 ) . map ( ( boundary ) => {
280- boundary . branchEndFullName = boundary . branchEndFullName . replace ( "refs/heads/" , "" ) ;
281+ boundary . branchEndFullName = boundary . branchEndFullName . map ( ( x ) => x . replace ( "refs/heads/" , "" ) ) ;
281282 assert ( boundary . branchEndFullName ) ;
282283
283284 /**
@@ -289,7 +290,7 @@ export const branchSequencer: BranchSequencer = async ({
289290 // if (!Git.Branch.lookup(repo, targetBranch, Git.Branch.BRANCH.LOCAL)) {
290291 // execSyncInRepo();
291292 // }
292- if ( boundary . branchEndFullName . startsWith ( "refs/remotes/" ) ) {
293+ if ( boundary . branchEndFullName . some ( ( x ) => x . startsWith ( "refs/remotes/" ) ) ) {
293294 /**
294295 * TODO - probably should handle this "checkout remote branch locally" logic
295296 * in a better place than here,
@@ -327,7 +328,7 @@ export const branchSequencer: BranchSequencer = async ({
327328 * before doing the checkouts.
328329 *
329330 */
330- boundary . branchEndFullName = boundary . branchEndFullName . replace ( / r e f s \/ r e m o t e s \/ [ ^ / ] + \/ / , "" ) ;
331+ boundary . branchEndFullName = boundary . branchEndFullName . map ( ( x ) => x . replace ( / r e f s \/ r e m o t e s \/ [ ^ / ] + \/ / , "" ) ) ;
331332 }
332333
333334 // console.log({ targetCommitSHA, target: targetBranch });
@@ -390,13 +391,17 @@ export const branchSequencer: BranchSequencer = async ({
390391 // await Git.Checkout.tree(repo, targetBranch as any); // TODO TS FIXME
391392 execSyncInRepo ( `${ gitCmd } checkout ${ targetBranch } ` ) ; // f this
392393
393- await actionInsideEachCheckedOutBranch ( {
394- repo, //
395- targetBranch,
396- targetCommitSHA,
397- isLatestBranch,
398- execSyncInRepo,
399- } ) ;
394+ await sequentialResolve (
395+ targetBranch . map ( ( x ) => async ( ) =>
396+ await actionInsideEachCheckedOutBranch ( {
397+ repo, //
398+ targetBranch : x ,
399+ targetCommitSHA,
400+ isLatestBranch,
401+ execSyncInRepo,
402+ } )
403+ )
404+ ) ;
400405
401406 return goNext ( ) ;
402407 }
0 commit comments