Pārlūkot izejas kodu

Fixes #1742 restores proper tracking status

main
Eric Amodio pirms 2 gadiem
vecāks
revīzija
5726343df0
7 mainītis faili ar 48 papildinājumiem un 17 dzēšanām
  1. +1
    -0
      CHANGELOG.md
  2. +10
    -4
      src/codelens/codeLensProvider.ts
  3. +21
    -11
      src/env/node/git/localGitProvider.ts
  4. +1
    -0
      src/git/gitProvider.ts
  5. +7
    -0
      src/git/gitProviderService.ts
  6. +4
    -0
      src/premium/github/githubGitProvider.ts
  7. +4
    -2
      src/trackers/trackedDocument.ts

+ 1
- 0
CHANGELOG.md Parādīt failu

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#1742](https://github.com/gitkraken/vscode-gitlens/issues/1742) - New file lines keep jumping down
- Fixes [#1846](https://github.com/gitkraken/vscode-gitlens/issues/1846) - Restoring (checkout) a deleted file from a commit doesn't work
- Fixes [#1844](https://github.com/gitkraken/vscode-gitlens/issues/1844) - Autolinked issues aren't properly paged when there are too many commits
- Fixes [#1843](https://github.com/gitkraken/vscode-gitlens/issues/1843) - Compare references doesn't work if you have multiple repos open

+ 10
- 4
src/codelens/codeLensProvider.ts Parādīt failu

@ -165,10 +165,16 @@ export class GitCodeLensProvider implements CodeLensProvider {
if (blame == null || blame?.lines.length === 0) return lenses;
} else if (languageScope.scopes.length !== 1 || !languageScope.scopes.includes(CodeLensScopes.Document)) {
symbols = await executeCoreCommand<[Uri], SymbolInformation[]>(
CoreCommands.ExecuteDocumentSymbolProvider,
document.uri,
);
let tracked;
[tracked, symbols] = await Promise.all([
this.container.git.isTracked(gitUri),
executeCoreCommand<[Uri], SymbolInformation[]>(
CoreCommands.ExecuteDocumentSymbolProvider,
document.uri,
),
]);
if (!tracked) return lenses;
}
if (token.isCancellationRequested) return lenses;

+ 21
- 11
src/env/node/git/localGitProvider.ts Parādīt failu

@ -1064,7 +1064,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
key: string,
cc: LogCorrelationContext | undefined,
): Promise<GitBlame | undefined> {
const paths = await this.isTracked(uri);
const paths = await this.isTrackedPrivate(uri);
if (paths == null) {
Logger.log(cc, `Skipping blame; '${uri.fsPath}' is not tracked`);
return emptyPromise as Promise<GitBlame>;
@ -1144,7 +1144,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
key: string,
cc: LogCorrelationContext | undefined,
): Promise<GitBlame | undefined> {
const paths = await this.isTracked(uri);
const paths = await this.isTrackedPrivate(uri);
if (paths == null) {
Logger.log(cc, `Skipping blame; '${uri.fsPath}' is not tracked`);
return emptyPromise as Promise<GitBlame>;
@ -2528,7 +2528,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
key: string,
cc: LogCorrelationContext | undefined,
): Promise<GitLog | undefined> {
const paths = await this.isTracked(path, repoPath, ref);
const paths = await this.isTrackedPrivate(path, repoPath, ref);
if (paths == null) {
Logger.log(cc, `Skipping blame; '${path}' is not tracked`);
return emptyPromise as Promise<GitLog>;
@ -3403,11 +3403,19 @@ export class LocalGitProvider implements GitProvider, Disposable {
return this.supportedSchemes.has(uri.scheme);
}
private async isTracked(uri: GitUri): Promise<[string, string] | undefined>;
private async isTracked(path: string, repoPath?: string, ref?: string): Promise<[string, string] | undefined>;
@log<LocalGitProvider['isTracked']>({ exit: tracked => `returned ${Boolean(tracked)}` })
private async isTracked(
pathOrUri: string | GitUri,
async isTracked(uri: Uri): Promise<boolean> {
return (await this.isTrackedPrivate(uri)) != null;
}
private async isTrackedPrivate(uri: Uri | GitUri): Promise<[string, string] | undefined>;
private async isTrackedPrivate(
path: string,
repoPath?: string,
ref?: string,
): Promise<[string, string] | undefined>;
@log<LocalGitProvider['isTrackedPrivate']>({ exit: tracked => `returned ${Boolean(tracked)}` })
private async isTrackedPrivate(
pathOrUri: string | Uri | GitUri,
repoPath?: string,
ref?: string,
): Promise<[string, string] | undefined> {
@ -3424,9 +3432,11 @@ export class LocalGitProvider implements GitProvider, Disposable {
} else {
if (!this.isTrackable(pathOrUri)) return undefined;
// Always use the ref of the GitUri
ref = pathOrUri.sha;
if (ref === GitRevision.deletedOrMissing) return undefined;
if (pathOrUri instanceof GitUri) {
// Always use the ref of the GitUri
ref = pathOrUri.sha;
if (ref === GitRevision.deletedOrMissing) return undefined;
}
repository = this.container.git.getRepository(pathOrUri);
repoPath = repoPath || repository?.path;

+ 1
- 0
src/git/gitProvider.ts Parādīt failu

@ -388,6 +388,7 @@ export interface GitProvider extends Disposable {
hasCommitBeenPushed(repoPath: string, ref: string): Promise<boolean>;
isTrackable(uri: Uri): boolean;
isTracked(uri: Uri): Promise<boolean>;
getDiffTool(repoPath?: string): Promise<string | undefined>;
openDiffTool(

+ 7
- 0
src/git/gitProviderService.ts Parādīt failu

@ -2032,6 +2032,13 @@ export class GitProviderService implements Disposable {
return provider.isTrackable(uri);
}
async isTracked(uri: Uri): Promise<boolean> {
if (!this.supportedSchemes.has(uri.scheme)) return false;
const { provider } = this.getProvider(uri);
return provider.isTracked(uri);
}
@log()
async getDiffTool(repoPath?: string | Uri): Promise<string | undefined> {
if (repoPath == null) return undefined;

+ 4
- 0
src/premium/github/githubGitProvider.ts Parādīt failu

@ -2398,6 +2398,10 @@ export class GitHubGitProvider implements GitProvider, Disposable {
return this.supportedSchemes.has(uri.scheme);
}
isTracked(uri: Uri): Promise<boolean> {
return Promise.resolve(this.isTrackable(uri) && this.container.git.getRepository(uri) != null);
}
@log()
async getDiffTool(_repoPath?: string): Promise<string | undefined> {
return undefined;

+ 4
- 2
src/trackers/trackedDocument.ts Parādīt failu

@ -179,8 +179,10 @@ export class TrackedDocument implements Disposable {
this._isTracked = false;
this._hasRemotes = false;
} else {
this._isTracked = true;
this._hasRemotes = await repo.hasRemotes();
[this._isTracked, this._hasRemotes] = await Promise.all([
this.container.git.isTracked(this._uri),
repo.hasRemotes(),
]);
}
if (active != null) {

Notiek ielāde…
Atcelt
Saglabāt