@@ -1686,6 +1686,44 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
16861686 } ) ,
16871687 ) ;
16881688
1689+ it . effect ( "still creates the worktree when the base-ref config is locked" , ( ) =>
1690+ Effect . gen ( function * ( ) {
1691+ const cwd = yield * makeTmpDir ( ) ;
1692+ const { initialBranch } = yield * initRepoWithCommit ( cwd ) ;
1693+ const pathService = yield * Path . Path ;
1694+ const fileSystem = yield * FileSystem . FileSystem ;
1695+ const worktreePath = pathService . join ( yield * makeTmpDir ( "git-worktrees-" ) , "locked-config" ) ;
1696+ yield * writeTextFile ( cwd , ".git/config.lock" , "" ) ;
1697+ const driver = yield * GitVcsDriver . GitVcsDriver ;
1698+
1699+ const created = yield * driver . createWorktree ( {
1700+ cwd,
1701+ path : worktreePath ,
1702+ refName : initialBranch ,
1703+ newRefName : "feature/locked-config" ,
1704+ baseRefName : initialBranch ,
1705+ } ) ;
1706+
1707+ assert . deepEqual ( created . worktree , {
1708+ path : worktreePath ,
1709+ refName : "feature/locked-config" ,
1710+ } ) ;
1711+ assert . equal (
1712+ yield * git ( worktreePath , [ "branch" , "--show-current" ] ) ,
1713+ "feature/locked-config" ,
1714+ ) ;
1715+ assert . equal (
1716+ yield * fileSystem . readFileString ( pathService . join ( worktreePath , "README.md" ) ) ,
1717+ "# test\n" ,
1718+ ) ;
1719+ assert . equal (
1720+ yield * driver . readConfigValue ( worktreePath , "branch.feature/locked-config.gh-merge-base" ) ,
1721+ null ,
1722+ ) ;
1723+ assert . equal ( yield * fileSystem . exists ( pathService . join ( cwd , ".git/config.lock" ) ) , true ) ;
1724+ } ) ,
1725+ ) ;
1726+
16891727 it . effect ( "reports checkout progress while creating a worktree" , ( ) =>
16901728 Effect . gen ( function * ( ) {
16911729 const cwd = yield * makeTmpDir ( ) ;
0 commit comments