File tree 1 file changed +14
-1
lines changed 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1399,7 +1399,20 @@ export class Repository implements Disposable {
1399
1399
if ( discardUntrackedChangesToTrash ) {
1400
1400
const limiter = new Limiter < void > ( 5 ) ;
1401
1401
await Promise . all ( toClean . map ( fsPath => limiter . queue (
1402
- async ( ) => await workspace . fs . delete ( Uri . file ( fsPath ) , { useTrash : true } ) ) ) ) ;
1402
+ async ( ) => {
1403
+ // Use fs path from the rootRealPath if it exists (for handling subst drive paths)
1404
+ const realPath = this . rootRealPath && fsPath . startsWith ( this . root )
1405
+ ? path . join ( this . rootRealPath , fsPath . substring ( this . root . length ) )
1406
+ : fsPath ;
1407
+
1408
+ try {
1409
+ await workspace . fs . delete ( Uri . file ( realPath ) , { useTrash : true } ) ;
1410
+ } catch ( err ) {
1411
+ this . logger . warn ( `[Repository][clean] Failed to delete file '${ fsPath } ' using realPath '${ realPath } ': ${ err . message } ` ) ;
1412
+ // Fall back to direct Git clean if file system delete fails
1413
+ await this . repository . clean ( [ fsPath ] ) ;
1414
+ }
1415
+ } ) ) ) ;
1403
1416
} else {
1404
1417
await this . repository . clean ( toClean ) ;
1405
1418
}
You can’t perform that action at this time.
0 commit comments