@@ -2480,14 +2480,7 @@ it.effect("refuses a new worktree whose explicit branch already exists", () =>
24802480 Effect . as ( true ) ,
24812481 Effect . orElseSucceed ( ( ) => false ) ,
24822482 ) ,
2483- git : {
2484- hasRefNamed : ( { refName } ) =>
2485- command ( [ "for-each-ref" , "--count=1" , "--format=%(refname)" , `refs/**/${ refName } ` ] ) . pipe (
2486- Effect . map ( ( result ) => result . stdout . trim ( ) . length > 0 ) ,
2487- ) ,
2488- listLocalBranchNames : ( ) => git . listLocalBranchNames ( cwd ) ,
2489- resolveWorktreeBaseRemote : ( input ) => git . resolveWorktreeBaseRemote ( { ...input , cwd } ) ,
2490- } ,
2483+ git : { listLocalBranchNames : ( ) => git . listLocalBranchNames ( cwd ) } ,
24912484 } ) ;
24922485 yield * Effect . gen ( function * ( ) {
24932486 const launches = yield * ThreadLaunch . ThreadLaunchService ;
@@ -2499,43 +2492,28 @@ it.effect("refuses a new worktree whose explicit branch already exists", () =>
24992492 } )
25002493 . pipe (
25012494 Effect . match ( {
2502- onSuccess : ( ) => ( { branch, outcome : "accepted" } ) ,
2503- onFailure : ( error ) => ( {
2504- branch,
2505- outcome : error . _tag ,
2506- errorBranch : ( error as { readonly branch ?: string } ) . branch ,
2507- namesBranch : error . message . includes ( `"${ branch } "` ) ,
2508- } ) ,
2495+ onSuccess : ( ) => [ branch , "accepted" ] ,
2496+ onFailure : ( error ) => [ branch , error . _tag ] ,
25092497 } ) ,
25102498 ) ;
2511- const refused = ( branch : string ) => ( {
2512- branch,
2513- outcome : "ThreadLaunchBranchExistsError" ,
2514- errorBranch : branch ,
2515- namesBranch : true ,
2516- } ) ;
25172499 assert . deepEqual (
25182500 yield * Effect . forEach (
2519- [
2520- "feature/idle" ,
2521- "feature/taken" ,
2522- "main" ,
2523- "feature/fresh" ,
2524- temporaryBranch ,
2525- "feature/tagged" ,
2526- ] ,
2501+ [ "feature/idle" , "feature/taken" , temporaryBranch , "feature/fresh" , "feature/tagged" ] ,
25272502 ( branch ) => check ( branch ) ,
25282503 ) ,
25292504 [
2530- refused ( "feature/idle" ) ,
2531- refused ( "feature/taken" ) ,
2532- refused ( "main" ) ,
2533- { branch : "feature/fresh" , outcome : "accepted" } ,
2534- refused ( temporaryBranch ) ,
2535- { branch : "feature/tagged" , outcome : "accepted" } ,
2505+ [ "feature/idle" , "ThreadLaunchBranchExistsError" ] ,
2506+ [ "feature/taken" , "ThreadLaunchBranchExistsError" ] ,
2507+ [ temporaryBranch , "ThreadLaunchBranchExistsError" ] ,
2508+ [ "feature/fresh" , "accepted" ] ,
2509+ [ "feature/tagged" , "accepted" ] ,
25362510 ] ,
25372511 ) ;
2538- assert . deepEqual ( yield * check ( "feature/taken" , ":/initial" ) , refused ( "feature/taken" ) ) ;
2512+ // A `:/text` base skips the base check but not the branch check.
2513+ assert . deepEqual ( yield * check ( "feature/taken" , ":/initial" ) , [
2514+ "feature/taken" ,
2515+ "ThreadLaunchBranchExistsError" ,
2516+ ] ) ;
25392517 } ) . pipe ( Effect . provide ( harness . layer ) ) ;
25402518 } ) . pipe (
25412519 Effect . provide (
0 commit comments