Browse Source

Enables Repositories view for remote repositories

Adds HEAD status for remote repositories
main
Eric Amodio 1 year ago
parent
commit
5dbeb35501
3 changed files with 24 additions and 6 deletions
  1. +1
    -1
      package.json
  2. +22
    -4
      src/plus/github/githubGitProvider.ts
  3. +1
    -1
      src/views/nodes/repositoryNode.ts

+ 1
- 1
package.json View File

@ -13266,7 +13266,7 @@
{
"id": "gitlens.views.repositories",
"name": "Repositories",
"when": "!gitlens:disabled && !gitlens:hasVirtualFolders",
"when": "!gitlens:disabled",
"contextualTitle": "GitLens",
"icon": "$(gitlens-repositories-view)",
"visibility": "hidden"

+ 22
- 4
src/plus/github/githubGitProvider.ts View File

@ -65,7 +65,8 @@ import { getRemoteIconUri, getVisibilityCacheKey, GitRemote, GitRemoteType } fro
import type { RepositoryChangeEvent } from '../../git/models/repository';
import { Repository } from '../../git/models/repository';
import type { GitStash } from '../../git/models/stash';
import type { GitStatus, GitStatusFile } from '../../git/models/status';
import type { GitStatusFile } from '../../git/models/status';
import { GitStatus } from '../../git/models/status';
import type { TagSortOptions } from '../../git/models/tag';
import { getTagId, GitTag, sortTags } from '../../git/models/tag';
import type { GitTreeEntry } from '../../git/models/tree';
@ -90,7 +91,7 @@ import type { CachedBlame, CachedLog } from '../../trackers/gitDocumentTracker';
import { GitDocumentState } from '../../trackers/gitDocumentTracker';
import type { TrackedDocument } from '../../trackers/trackedDocument';
import type { GitHubAuthorityMetadata, Metadata, RemoteHubApi } from '../remotehub';
import { getRemoteHubApi } from '../remotehub';
import { getRemoteHubApi, HeadType } from '../remotehub';
import type {
GraphBranchContextValue,
GraphItemContext,
@ -2494,8 +2495,25 @@ export class GitHubGitProvider implements GitProvider, Disposable {
}
@log()
async getStatusForRepo(_repoPath: string | undefined): Promise<GitStatus | undefined> {
return undefined;
async getStatusForRepo(repoPath: string | undefined): Promise<GitStatus | undefined> {
if (repoPath == null) return undefined;
const context = await this.ensureRepositoryContext(repoPath);
if (context == null) return undefined;
const revision = await context.metadata.getRevision();
if (revision == null) return undefined;
return new GitStatus(
repoPath,
revision.name,
revision.revision,
[],
{ ahead: 0, behind: 0 },
revision.type === HeadType.Branch || revision.type === HeadType.RemoteBranch
? `origin/${revision.name}`
: undefined,
);
}
@log({ args: { 1: false } })

+ 1
- 1
src/views/nodes/repositoryNode.ts View File

@ -165,7 +165,7 @@ export class RepositoryNode extends SubscribeableViewNode {
children.push(new ContributorsNode(this.uri, this.view, this, this.repo));
}
if (this.view.config.showIncomingActivity) {
if (this.view.config.showIncomingActivity && !this.repo.provider.virtual) {
children.push(new ReflogNode(this.uri, this.view, this, this.repo));
}

Loading…
Cancel
Save