File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -138,11 +138,12 @@ export function activateCoverage(context: ExtensionContext) {
138
138
) ?. uri . path ;
139
139
140
140
const gitConfig = Uri . file ( `${ pathToWorkspace } /.git/config` ) ;
141
- // Try https remote auth first
142
- let remote = await workspace . fs
141
+ const configLines = workspace . fs
143
142
. readFile ( gitConfig )
144
143
. then ( ( buf ) => buf . toString ( ) )
145
- . then ( ( string ) => string . split ( "\n" ) )
144
+ . then ( ( string ) => string . split ( "\n" ) ) ;
145
+ // Try https remote auth first
146
+ let remote = await configLines
146
147
. then ( ( lines ) =>
147
148
lines . find ( ( line ) => line . match ( / h t t p s : \/ \/ .* \/ .* \/ .* .g i t $ / ) )
148
149
)
@@ -154,10 +155,7 @@ export function activateCoverage(context: ExtensionContext) {
154
155
) ;
155
156
if ( ! remote ) {
156
157
// if that doesn't work try looking for remotes using ssh auth
157
- remote = await workspace . fs
158
- . readFile ( gitConfig )
159
- . then ( ( buf ) => buf . toString ( ) )
160
- . then ( ( string ) => string . split ( "\n" ) )
158
+ remote = await configLines
161
159
. then ( ( lines ) => lines . find ( ( line ) => line . match ( / g i t @ .* : .* \/ .* .g i t $ / ) ) )
162
160
. then ( ( line ) =>
163
161
line ?. replace ( / .* : / , "" ) . replace ( ".git" , "" ) . split ( "/" )
You can’t perform that action at this time.
0 commit comments