@@ -37,12 +37,24 @@ describe("git-utils", () => {
3737 } ) ;
3838
3939 it ( `should resolve the correct working tree path in a working tree created by git worktree` , async ( ) => {
40- await tempy . directory . task ( async worktreePath => {
41- runCommandSync ( "git" , [ "worktree" , "add" , "-B" , "worktree" , worktreePath ] ) ;
42- const subdirPath = `${ worktreePath } ${ sep } subdir` ;
43- await mkdirp ( subdirPath ) ;
44- expect ( resolveGitWorkingTreePath ( subdirPath ) ) . toEqual ( worktreePath ) ;
45- runCommandSync ( "git" , [ "worktree" , "remove" , worktreePath ] ) ;
40+ await tempy . directory . task ( async repositoryPath => {
41+ runCommandSync ( "git" , [ "init" ] , repositoryPath ) ;
42+ runCommandSync (
43+ "git" ,
44+ [ "commit" , "--allow-empty" , "-m" , "initial commit" ] ,
45+ repositoryPath
46+ ) ;
47+ await tempy . directory . task ( async worktreePath => {
48+ runCommandSync (
49+ "git" ,
50+ [ "worktree" , "add" , "-B" , "worktree" , worktreePath ] ,
51+ repositoryPath
52+ ) ;
53+ const subdirPath = `${ worktreePath } ${ sep } subdir` ;
54+ await mkdirp ( subdirPath ) ;
55+ expect ( resolveGitWorkingTreePath ( subdirPath ) ) . toEqual ( worktreePath ) ;
56+ runCommandSync ( "git" , [ "worktree" , "remove" , worktreePath ] , repositoryPath ) ;
57+ } ) ;
4658 } ) ;
4759 } ) ;
4860 } ) ;
0 commit comments