File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22import * as paths from 'path' ;
3+ import * as fs from 'fs' ;
34import { Uri } from 'vscode' ;
45import { UriComparer } from '../comparers' ;
56import { DocumentSchemes } from '../constants' ;
@@ -259,6 +260,15 @@ export class GitUri extends ((Uri as any) as UriEx) {
259260 static async fromUri ( uri : Uri ) : Promise < GitUri > {
260261 if ( GitUri . is ( uri ) ) return uri ;
261262
263+ const uriPath = uri . fsPath ;
264+ const realPath = fs . realpathSync ( uriPath ) ;
265+ if ( uriPath !== realPath ) {
266+ // If we got here, it means the original URI is to a symbolic link, so we create a new one using the real location.
267+ const newUri = Uri . file ( realPath ) ;
268+
269+ return this . fromUri ( newUri ) ;
270+ }
271+
262272 if ( ! Container . git . isTrackable ( uri ) ) return new GitUri ( uri ) ;
263273
264274 if ( uri . scheme === DocumentSchemes . GitLens ) return new GitUri ( uri ) ;
You can’t perform that action at this time.
0 commit comments