File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -97,22 +97,7 @@ async function isWorktreeRoot(currentPath: string): Promise<boolean> {
97
97
}
98
98
99
99
async function revParse ( cwd : string , args : string [ ] ) : Promise < string > {
100
- // First, try to execute git rev-parse from the current directory
101
- // This will work correctly even if we're in a worktree inside .git
102
- try {
103
- const stdout = await execute ( [ "rev-parse" , ...args ] , { cwd } ) ;
104
- const output = decodeUtf8 ( stdout ) ;
105
- return resolve ( output . split ( / \n / , 2 ) [ 0 ] ) ;
106
- } catch ( e ) {
107
- // If it fails and we're in a .git directory, try from parent
108
- const terms = cwd . split ( SEPARATOR ) ;
109
- if ( terms . includes ( ".git" ) ) {
110
- const index = terms . indexOf ( ".git" ) ;
111
- const parentCwd = terms . slice ( 0 , index ) . join ( SEPARATOR ) ;
112
- const stdout = await execute ( [ "rev-parse" , ...args ] , { cwd : parentCwd } ) ;
113
- const output = decodeUtf8 ( stdout ) ;
114
- return resolve ( output . split ( / \n / , 2 ) [ 0 ] ) ;
115
- }
116
- throw e ;
117
- }
100
+ const stdout = await execute ( [ "rev-parse" , ...args ] , { cwd } ) ;
101
+ const output = decodeUtf8 ( stdout ) ;
102
+ return resolve ( output . split ( / \n / , 2 ) [ 0 ] ) ;
118
103
}
You can’t perform that action at this time.
0 commit comments