@@ -7,7 +7,7 @@ import TelemetryReporter from '@vscode/extension-telemetry';
7
7
import * as fs from 'fs' ;
8
8
import * as path from 'path' ;
9
9
import picomatch from 'picomatch' ;
10
- import { CancellationError , CancellationToken , CancellationTokenSource , Command , commands , Disposable , Event , EventEmitter , FileDecoration , l10n , LogLevel , LogOutputChannel , Memento , ProgressLocation , ProgressOptions , QuickDiffProvider , RelativePattern , scm , SourceControl , SourceControlInputBox , SourceControlInputBoxValidation , SourceControlInputBoxValidationType , SourceControlResourceDecorations , SourceControlResourceGroup , SourceControlResourceState , TabInputNotebookDiff , TabInputTextDiff , TabInputTextMultiDiff , ThemeColor , Uri , window , workspace , WorkspaceEdit } from 'vscode' ;
10
+ import { CancellationError , CancellationToken , CancellationTokenSource , Command , commands , Disposable , Event , EventEmitter , FileDecoration , FileType , l10n , LogLevel , LogOutputChannel , Memento , ProgressLocation , ProgressOptions , QuickDiffProvider , RelativePattern , scm , SourceControl , SourceControlInputBox , SourceControlInputBoxValidation , SourceControlInputBoxValidationType , SourceControlResourceDecorations , SourceControlResourceGroup , SourceControlResourceState , TabInputNotebookDiff , TabInputTextDiff , TabInputTextMultiDiff , ThemeColor , Uri , window , workspace , WorkspaceEdit } from 'vscode' ;
11
11
import { ActionButton } from './actionButton' ;
12
12
import { ApiRepository } from './api/api1' ;
13
13
import { Branch , BranchQuery , Change , CommitOptions , FetchOptions , ForcePushMode , GitErrorCodes , LogOptions , Ref , RefType , Remote , Status } from './api/git' ;
@@ -1024,11 +1024,19 @@ export class Repository implements Disposable {
1024
1024
return l10n . t ( 'Git Local Changes (Working Tree)' ) ;
1025
1025
}
1026
1026
1027
- provideOriginalResource ( uri : Uri ) : Uri | undefined {
1027
+ async provideOriginalResource ( uri : Uri ) : Promise < Uri | undefined > {
1028
1028
this . logger . trace ( `[Repository][provideOriginalResource] Resource: ${ uri . toString ( ) } ` ) ;
1029
1029
1030
1030
if ( uri . scheme !== 'file' ) {
1031
- return ;
1031
+ this . logger . trace ( `[Repository][provideOriginalResource] Resource is not a file: ${ uri . scheme } ` ) ;
1032
+ return undefined ;
1033
+ }
1034
+
1035
+ // Ignore symbolic links
1036
+ const stat = await workspace . fs . stat ( uri ) ;
1037
+ if ( ( stat . type & FileType . SymbolicLink ) !== 0 ) {
1038
+ this . logger . trace ( `[Repository][provideOriginalResource] Resource is a symbolic link: ${ uri . toString ( ) } ` ) ;
1039
+ return undefined ;
1032
1040
}
1033
1041
1034
1042
// Ignore path that is not inside the current repository
@@ -2836,9 +2844,21 @@ export class StagedResourceQuickDiffProvider implements QuickDiffProvider {
2836
2844
private readonly logger : LogOutputChannel
2837
2845
) { }
2838
2846
2839
- provideOriginalResource ( uri : Uri ) : Uri | undefined {
2847
+ async provideOriginalResource ( uri : Uri ) : Promise < Uri | undefined > {
2840
2848
this . logger . trace ( `[StagedResourceQuickDiffProvider][provideOriginalResource] Resource: ${ uri . toString ( ) } ` ) ;
2841
2849
2850
+ if ( uri . scheme !== 'file' ) {
2851
+ this . logger . trace ( `[StagedResourceQuickDiffProvider][provideOriginalResource] Resource is not a file: ${ uri . scheme } ` ) ;
2852
+ return undefined ;
2853
+ }
2854
+
2855
+ // Ignore symbolic links
2856
+ const stat = await workspace . fs . stat ( uri ) ;
2857
+ if ( ( stat . type & FileType . SymbolicLink ) !== 0 ) {
2858
+ this . logger . trace ( `[StagedResourceQuickDiffProvider][provideOriginalResource] Resource is a symbolic link: ${ uri . toString ( ) } ` ) ;
2859
+ return undefined ;
2860
+ }
2861
+
2842
2862
// Ignore resources that are not in the index group
2843
2863
if ( ! this . _repository . indexGroup . resourceStates . some ( r => pathEquals ( r . resourceUri . fsPath , uri . fsPath ) ) ) {
2844
2864
this . logger . trace ( `[StagedResourceQuickDiffProvider][provideOriginalResource] Resource is not part of a index group: ${ uri . toString ( ) } ` ) ;
0 commit comments