File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ export async function findWorktree(cwd: string): Promise<string> {
46
46
"--show-superproject-working-tree" ,
47
47
] ) ;
48
48
} catch ( e ) {
49
- result = e as Error ;
49
+ if ( e instanceof Error ) {
50
+ result = e ;
51
+ } else {
52
+ throw e ;
53
+ }
50
54
}
51
55
cacheWorktree . set ( path , result ) ;
52
56
return result ;
@@ -70,7 +74,11 @@ export async function findGitdir(cwd: string): Promise<string> {
70
74
try {
71
75
result = await revParse ( path , [ "--git-dir" ] ) ;
72
76
} catch ( e ) {
73
- result = e as Error ;
77
+ if ( e instanceof Error ) {
78
+ result = e ;
79
+ } else {
80
+ throw e ;
81
+ }
74
82
}
75
83
cacheGitdir . set ( path , result ) ;
76
84
return result ;
@@ -99,5 +107,5 @@ async function isWorktreeRoot(currentPath: string): Promise<boolean> {
99
107
async function revParse ( cwd : string , args : string [ ] ) : Promise < string > {
100
108
const stdout = await execute ( [ "rev-parse" , ...args ] , { cwd } ) ;
101
109
const output = decodeUtf8 ( stdout ) ;
102
- return resolve ( output . split ( / \n / , 2 ) [ 0 ] ) ;
110
+ return resolve ( cwd , output . split ( / \n / , 2 ) [ 0 ] ) ;
103
111
}
You can’t perform that action at this time.
0 commit comments