Skip to content

Commit 7288513

Browse files
eamodiosergeibbb
authored andcommitted
Changes from code review
(#1328, #4754)
1 parent 6375500 commit 7288513

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- Adds an experimental 'gitlens.advanced.resolveSymlinks' setting to resolve symbolic links when determining file paths for Git operations ([#1328](https://github.com/gitkraken/vscode-gitlens/issues/1328))
12+
913
### Changed
1014

1115
- Changes _rebase_, _merge_, _revert_, and _branch delete_ commands no longer use/open a terminal ([#3527](https://github.com/gitkraken/vscode-gitlens/issues/3527), [#3530](https://github.com/gitkraken/vscode-gitlens/issues/3530), [#3532](https://github.com/gitkraken/vscode-gitlens/issues/3532), [#3534](https://github.com/gitkraken/vscode-gitlens/issues/3534))

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5445,12 +5445,15 @@
54455445
"scope": "window",
54465446
"order": 110
54475447
},
5448-
"gitlens.advanced.realpath": {
5448+
"gitlens.advanced.resolveSymlinks": {
54495449
"type": "boolean",
54505450
"default": false,
5451-
"markdownDescription": "[Experimental] Specifies whether to resolve symbolic links when determining file paths for Git operations",
5451+
"markdownDescription": "Specifies whether to resolve symbolic links when determining file paths for Git operations",
54525452
"scope": "window",
5453-
"order": 115
5453+
"order": 115,
5454+
"tags": [
5455+
"experimental"
5456+
]
54545457
},
54555458
"gitlens.advanced.commits.delayLoadingFileDetails": {
54565459
"type": "boolean",

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export interface AdvancedConfig {
208208
readonly quickPick: {
209209
readonly closeOnFocusOut: boolean;
210210
};
211-
readonly realpath: boolean;
211+
readonly resolveSymlinks: boolean;
212212
readonly repositorySearchDepth: number | null;
213213
readonly similarityThreshold: number | null;
214214
}

src/env/browser/fs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function realpath(path: string): Promise<string> {
2+
return Promise.resolve(path);
3+
}

src/env/browser/realpath.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/env/node/fs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { realpath as _realpath } from 'fs/promises';
2+
3+
export function realpath(path: string): Promise<string> {
4+
return _realpath(path);
5+
}

src/env/node/realpath.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/git/gitUri.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Uri } from 'vscode';
2-
import { isWeb } from '@env/platform';
3-
import { realpath } from '@env/realpath';
2+
import { realpath } from '@env/fs';
43
import { getQueryDataFromScmGitUri } from '../@types/vscode.git.uri';
54
import { Schemes } from '../constants';
65
import { Container } from '../container';
@@ -252,13 +251,12 @@ export class GitUri extends (Uri as any as UriEx) {
252251
static async fromUri(uri: Uri): Promise<GitUri> {
253252
if (isGitUri(uri)) return uri;
254253

255-
// Check for symbolic links (Node.js only)
256-
if (configuration.get('advanced.realpath') && !isWeb && uri.scheme === 'file') {
254+
// Check for symbolic links
255+
if (uri.scheme === Schemes.File && configuration.get('advanced.resolveSymlinks')) {
257256
try {
258257
const realPath = await realpath(uri.fsPath);
259258
if (uri.fsPath !== realPath) {
260-
const newUri = Uri.file(realPath);
261-
return await this.fromUri(newUri);
259+
uri = Uri.file(realPath);
262260
}
263261
} catch {
264262
// Ignore errors (e.g., if path doesn't exist)

0 commit comments

Comments
 (0)