@gitkraken/core-gitlens 0.7.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -1
- package/dist/git/cache.d.ts +29 -5
- package/dist/git/cache.js +52 -11
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +6 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/errors.d.ts +28 -1
- package/dist/git/errors.js +45 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +1 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/reflog.d.ts +6 -0
- package/dist/git/models/reflog.js.map +1 -1
- package/dist/git/models/revision.d.ts +0 -1
- package/dist/git/models/revision.js +1 -2
- package/dist/git/models/revision.js.map +1 -1
- package/dist/git/providers/branches.d.ts +5 -1
- package/dist/git/providers/commits.d.ts +44 -2
- package/dist/git/providers/config.d.ts +7 -1
- package/dist/git/providers/operations.d.ts +19 -0
- package/dist/git/providers/provider.d.ts +29 -2
- package/dist/git/providers/refs.d.ts +48 -3
- package/dist/git/providers/revision.d.ts +7 -1
- package/dist/git/providers/staging.d.ts +13 -0
- package/dist/git/providers/stash.d.ts +3 -2
- package/dist/git/providers/status.d.ts +4 -0
- package/dist/git/providers/worktrees.d.ts +23 -3
- package/dist/git/run.types.d.ts +22 -0
- package/dist/git-cli/cliGitProvider.d.ts +39 -2
- package/dist/git-cli/cliGitProvider.js +109 -11
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +31 -0
- package/dist/git-cli/exec/commandClassifier.js +391 -0
- package/dist/git-cli/exec/commandClassifier.js.map +1 -0
- package/dist/git-cli/exec/git.d.ts +36 -5
- package/dist/git-cli/exec/git.js +163 -28
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +4 -1
- package/dist/git-cli/exec/gitQueue.js +1 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/parsers/reflogParser.d.ts +7 -0
- package/dist/git-cli/parsers/reflogParser.js +11 -1
- package/dist/git-cli/parsers/reflogParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +10 -1
- package/dist/git-cli/providers/branches.js +31 -22
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +27 -3
- package/dist/git-cli/providers/commits.js +112 -12
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -1
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/diff.js +4 -4
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +13 -0
- package/dist/git-cli/providers/operations.js +64 -5
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.js +21 -45
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +20 -3
- package/dist/git-cli/providers/refs.js +140 -10
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.js +3 -2
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +5 -1
- package/dist/git-cli/providers/revision.js +20 -5
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts +9 -0
- package/dist/git-cli/providers/staging.js +63 -6
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts +3 -2
- package/dist/git-cli/providers/stash.js +34 -22
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +2 -0
- package/dist/git-cli/providers/status.js +27 -9
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +31 -2
- package/dist/git-cli/providers/worktrees.js +75 -7
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +64 -3
- package/dist/plus/git-github/api/github.js +237 -24
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/providers/github/branches.d.ts +3 -1
- package/dist/plus/git-github/providers/github/branches.js +2 -1
- package/dist/plus/git-github/providers/github/branches.js.map +1 -1
- package/dist/plus/git-github/providers/github/commits.d.ts +4 -2
- package/dist/plus/git-github/providers/github/commits.js +3 -1
- package/dist/plus/git-github/providers/github/commits.js.map +1 -1
- package/dist/plus/git-github/providers/github/refs.d.ts +10 -3
- package/dist/plus/git-github/providers/github/refs.js +4 -4
- package/dist/plus/git-github/providers/github/refs.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts +4 -1
- package/dist/plus/git-github/providers/github/revision.js +6 -1
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +5 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +35 -9
- package/dist/plus/integrations/integrationService.js +16 -3
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +107 -37
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +128 -13
- package/dist/plus/integrations/models/gitHostIntegration.js +130 -17
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +51 -3
- package/dist/plus/integrations/models/integration.js +125 -18
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.d.ts +18 -5
- package/dist/plus/integrations/models/issuesIntegration.js +40 -10
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +13 -17
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +29 -0
- package/dist/plus/integrations/providers/azure/models.js +112 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +54 -2
- package/dist/plus/integrations/providers/azureDevOps.js +80 -2
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js +2 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +61 -0
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +165 -23
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +6 -1
- package/dist/plus/integrations/providers/bitbucket/models.js +4 -3
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +38 -1
- package/dist/plus/integrations/providers/bitbucket-server.js +33 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +36 -1
- package/dist/plus/integrations/providers/bitbucket.js +29 -1
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +48 -4
- package/dist/plus/integrations/providers/github.js +101 -6
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +35 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js +132 -15
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
- package/dist/plus/integrations/providers/gitlab/models.js +1 -1
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +48 -1
- package/dist/plus/integrations/providers/gitlab.js +79 -3
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/jira-server.d.ts +3 -3
- package/dist/plus/integrations/providers/jira-server.js +3 -3
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +12 -1
- package/dist/plus/integrations/providers/models.js +11 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providerErrors.d.ts +9 -1
- package/dist/plus/integrations/providers/providerErrors.js +10 -1
- package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +59 -0
- package/dist/plus/integrations/providers/providersApi.js +136 -1
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +42 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +58 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +35 -0
- package/dist/plus/integrations/reads/currentAccount.js +46 -0
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -0
- package/dist/plus/integrations/reads/drains.d.ts +4 -1
- package/dist/plus/integrations/reads/drains.js +7 -3
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +72 -12
- package/dist/plus/integrations/reads/issueBatch.js +193 -48
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +57 -0
- package/dist/plus/integrations/reads/pullRequestBatch.js +80 -0
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +58 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +111 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.js +3 -3
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.js +3 -3
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +5 -2
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/utils/env/node/exec.js +1 -1
- package/dist/utils/env/node/exec.js.map +1 -1
- package/docs/integrations.md +90 -36
- package/docs/kepler-git-write-api-parity.md +365 -0
- package/docs/kepler-read-api-parity.md +75 -28
- package/package.json +1 -1
- package/dist/plus/integrations/reads/trackerIssue.d.ts +0 -33
- package/dist/plus/integrations/reads/trackerIssue.js +0 -60
- package/dist/plus/integrations/reads/trackerIssue.js.map +0 -1
|
@@ -10,7 +10,9 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
10
10
|
private readonly cache;
|
|
11
11
|
private readonly provider;
|
|
12
12
|
constructor(cache: Cache, provider: GitHubGitProviderInternal);
|
|
13
|
-
getBranch(repoPath: string, name?: string,
|
|
13
|
+
getBranch(repoPath: string, name?: string, options?: {
|
|
14
|
+
force?: boolean;
|
|
15
|
+
}, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
|
|
14
16
|
getBranches(repoPath: string | undefined, options?: {
|
|
15
17
|
filter?: (b: GitBranch) => boolean;
|
|
16
18
|
ordering?: 'date' | 'author-date' | 'topo' | null;
|
|
@@ -16,8 +16,9 @@ var BranchesGitSubProvider = class {
|
|
|
16
16
|
this.cache = cache;
|
|
17
17
|
this.provider = provider;
|
|
18
18
|
}
|
|
19
|
-
async getBranch(repoPath, name, cancellation) {
|
|
19
|
+
async getBranch(repoPath, name, options, cancellation) {
|
|
20
20
|
const scope = getScopedLogger();
|
|
21
|
+
if (options?.force) this.cache.evictCaches(repoPath, "branches");
|
|
21
22
|
if (name != null) {
|
|
22
23
|
const { values: [branch] } = await this.getBranches(repoPath, { filter: (b) => b.name === name }, cancellation);
|
|
23
24
|
return branch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branches.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/branches.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { BranchContributionsOverview, GitBranchesSubProvider } from '@gitlens/git/providers/branches.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createRevisionRange, stripOrigin } from '@gitlens/git/utils/revision.utils.js';\nimport type { BranchSortOptions } from '@gitlens/git/utils/sorting.js';\nimport { sortBranches, sortContributors } from '@gitlens/git/utils/sorting.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { PagedResult, PagingOptions } from '@gitlens/utils/paging.js';\nimport { emptyPagedResult } from '@gitlens/utils/paging.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport type { CacheController } from '@gitlens/utils/promiseCache.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport { HeadType } from '../../context.js';\nimport type { GitHubBranch } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class BranchesGitSubProvider implements GitBranchesSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tasync getBranch(repoPath: string, name?: string, cancellation?: AbortSignal): Promise<GitBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (name != null) {\n\t\t\tconst {\n\t\t\t\tvalues: [branch],\n\t\t\t} = await this.getBranches(repoPath, { filter: b => b.name === name }, cancellation);\n\t\t\treturn branch;\n\t\t}\n\n\t\treturn this.cache.branch.getOrCreate(\n\t\t\trepoPath,\n\t\t\tasync (_cacheable, signal): Promise<GitBranch | undefined> => {\n\t\t\t\t// Prefer the cache-provided aggregate signal (only fires when every joined\n\t\t\t\t// caller aborts); fall back to this caller's cancellation for the first-caller path.\n\t\t\t\tsignal ??= cancellation;\n\t\t\t\tconst {\n\t\t\t\t\tvalues: [branch],\n\t\t\t\t} = await this.getBranches(repoPath, { filter: b => b.current }, signal);\n\t\t\t\tif (branch != null) return branch;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst { metadata } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\t\tswitch (revision.type) {\n\t\t\t\t\t\tcase HeadType.Tag:\n\t\t\t\t\t\tcase HeadType.Commit:\n\t\t\t\t\t\t\treturn new GitBranch(\n\t\t\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\t\t\t`refs/heads/${revision.name}`,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\trevision.revision,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ args: repoPath => ({ repoPath: repoPath }) })\n\tasync getBranches(\n\t\trepoPath: string | undefined,\n\t\toptions?: {\n\t\t\tfilter?: (b: GitBranch) => boolean;\n\t\t\tordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t\tpaging?: PagingOptions;\n\t\t\tsort?: boolean | BranchSortOptions;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PagedResult<GitBranch>> {\n\t\tif (repoPath == null) return emptyPagedResult;\n\n\t\tconst path = repoPath;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst load = async (cacheable?: CacheController): Promise<PagedResult<GitBranch>> => {\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(path);\n\n\t\t\t\tconst branches: GitBranch[] = [];\n\n\t\t\t\tconst commitOrdering = options?.ordering;\n\n\t\t\t\tfunction addBranches(branch: GitHubBranch, current: boolean) {\n\t\t\t\t\tconst date = new Date(\n\t\t\t\t\t\tcommitOrdering === 'author-date' ? branch.target.authoredDate : branch.target.committedDate,\n\t\t\t\t\t);\n\t\t\t\t\tconst ref = branch.target.oid;\n\n\t\t\t\t\tbranches.push(\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/heads/${branch.name}`,\n\t\t\t\t\t\t\tcurrent,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: `origin/${branch.name}`,\n\t\t\t\t\t\t\t\tmissing: false,\n\t\t\t\t\t\t\t\tstate: { ahead: 0, behind: 0 },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/remotes/origin/${branch.name}`,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet currentBranch: string | undefined;\n\n\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\tswitch (revision.type) {\n\t\t\t\t\tcase HeadType.Branch:\n\t\t\t\t\t\tcurrentBranch = revision.name;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase HeadType.RemoteBranch: {\n\t\t\t\t\t\tconst index = revision.name.indexOf(':');\n\t\t\t\t\t\tcurrentBranch = index === -1 ? revision.name : revision.name.substring(index + 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet cursor = options?.paging?.cursor;\n\t\t\t\tconst loadAll = cursor == null;\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst result = await github.getBranches(\n\t\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\t\t{ cursor: cursor },\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const branch of result.values) {\n\t\t\t\t\t\taddBranches(branch, branch.name === currentBranch);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!result.paging?.more || !loadAll) return { ...result, values: branches };\n\n\t\t\t\t\tcursor = result.paging.cursor;\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\n\t\t\t\t// Mark the cache entry invalidated so the empty fallback self-evicts on settle\n\t\t\t\t// rather than getting stuck serving stale emptiness to subsequent callers.\n\t\t\t\tcacheable?.invalidate();\n\t\t\t\treturn emptyPagedResult;\n\t\t\t}\n\t\t};\n\n\t\t// Compose cache key with cursor so re-loads of the same page hit the cache;\n\t\t// `repoPath` (no suffix) is reserved for the full \"all branches\" entry.\n\t\t// TODO: `cache.branches` is `PromiseMap<RepoPath, ...>` keyed exactly by repoPath, so\n\t\t// `clearCaches('branches')` / `unregisterRepoPath` will not invalidate composite-key entries.\n\t\t// Acceptable today because branches don't change during a virtual-repo session, but the entries\n\t\t// leak in memory until provider GC. Long-term: switch to RepoPromiseCacheMap or add prefix-invalidate.\n\t\tconst cacheKey = options?.paging?.cursor != null ? `${path}#${options.paging.cursor}` : path;\n\t\tconst branchesPromise = this.cache.branches.getOrCreate(cacheKey, cacheable => load(cacheable), cancellation);\n\n\t\tlet result = await branchesPromise;\n\t\tif (options?.filter != null) {\n\t\t\tresult = {\n\t\t\t\t...result,\n\t\t\t\tvalues: result.values.filter(options.filter),\n\t\t\t};\n\t\t}\n\n\t\tif (options?.sort != null) {\n\t\t\tsortBranches(result.values, typeof options.sort === 'boolean' ? undefined : options.sort);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync getBranchContributionsOverview(\n\t\trepoPath: string,\n\t\tref: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command\n\t\t// queue, so the priority signal has no effect here. Accepted for interface compatibility.\n\t\toptions?: {\n\t\t\tassociatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined>;\n\t\t\tpriority?: GitCommandPriority;\n\t\t},\n\t\t_cancellation?: AbortSignal,\n\t): Promise<BranchContributionsOverview | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\t// Expensive body — runs only on cache miss. Closes over `mergeTarget` so the cache key\n\t\t// (`${ref}|${mergeTarget}`) fully captures every input that affects the result.\n\t\tconst fetchBody = async (mergeTarget: string): Promise<BranchContributionsOverview | undefined> => {\n\t\t\tconst mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget);\n\t\t\tif (mergeBase == null) return undefined;\n\n\t\t\t// Fetch the merge-base commit's committer date in parallel with contributors so consumers\n\t\t\t// that just need the date for the scope window don't pay a separate round-trip.\n\t\t\t// `allSettled` so a transient failure in one side doesn't drop the overview entirely.\n\t\t\tconst [contributorsSettled, mergeBaseCommitSettled] = await Promise.allSettled([\n\t\t\t\tthis.provider.contributors.getContributors(repoPath, createRevisionRange(mergeBase, ref, '..'), {\n\t\t\t\t\tstats: true,\n\t\t\t\t}),\n\t\t\t\tthis.provider.commits.getCommit(repoPath, mergeBase),\n\t\t\t]);\n\n\t\t\tconst result = getSettledValue(contributorsSettled) ?? { contributors: [] };\n\t\t\tconst mergeBaseCommit = getSettledValue(mergeBaseCommitSettled);\n\n\t\t\tsortContributors(result.contributors, { orderBy: 'score:desc' });\n\n\t\t\tlet totalCommits = 0;\n\t\t\tlet totalFiles = 0;\n\t\t\tlet totalAdditions = 0;\n\t\t\tlet totalDeletions = 0;\n\t\t\tlet firstCommitTimestamp;\n\t\t\tlet latestCommitTimestamp;\n\n\t\t\tfor (const c of result.contributors) {\n\t\t\t\ttotalCommits += c.contributionCount;\n\t\t\t\ttotalFiles += c.stats?.files ?? 0;\n\t\t\t\ttotalAdditions += c.stats?.additions ?? 0;\n\t\t\t\ttotalDeletions += c.stats?.deletions ?? 0;\n\n\t\t\t\tconst firstTimestamp = c.firstCommitDate?.getTime();\n\t\t\t\tconst latestTimestamp = c.latestCommitDate?.getTime();\n\n\t\t\t\tif (firstTimestamp != null || latestTimestamp != null) {\n\t\t\t\t\tfirstCommitTimestamp =\n\t\t\t\t\t\tfirstCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.min(firstCommitTimestamp, firstTimestamp ?? Infinity, latestTimestamp ?? Infinity)\n\t\t\t\t\t\t\t: (firstTimestamp ?? latestTimestamp);\n\n\t\t\t\t\tlatestCommitTimestamp =\n\t\t\t\t\t\tlatestCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.max(latestCommitTimestamp, firstTimestamp ?? -Infinity, latestTimestamp ?? -Infinity)\n\t\t\t\t\t\t\t: (latestTimestamp ?? firstTimestamp);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tbranch: ref,\n\t\t\t\tmergeTarget: mergeTarget,\n\t\t\t\tmergeBase: mergeBase,\n\t\t\t\tmergeBaseDate: mergeBaseCommit?.committer?.date ?? mergeBaseCommit?.author?.date,\n\n\t\t\t\tcommits: totalCommits,\n\t\t\t\tfiles: totalFiles,\n\t\t\t\tadditions: totalAdditions,\n\t\t\t\tdeletions: totalDeletions,\n\n\t\t\t\tlatestCommitDate: latestCommitTimestamp != null ? new Date(latestCommitTimestamp) : undefined,\n\t\t\t\tfirstCommitDate: firstCommitTimestamp != null ? new Date(firstCommitTimestamp) : undefined,\n\n\t\t\t\tcontributors: result.contributors,\n\t\t\t};\n\t\t};\n\n\t\ttry {\n\t\t\t// Resolve `mergeTarget` (PR base or default branch). Only the expensive body below is\n\t\t\t// cached — keyed on `${ref}|${mergeTarget}` so callers that resolve to the same target\n\t\t\t// share the result, while differing targets get independent slots.\n\t\t\tlet mergeTarget: string | undefined;\n\n\t\t\tif (options?.associatedPullRequest != null) {\n\t\t\t\tconst pr = await options.associatedPullRequest;\n\t\t\t\tif (pr?.refs?.base != null) {\n\t\t\t\t\tmergeTarget = pr.refs.base.branch;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmergeTarget ??= await this.getDefaultBranchName(repoPath);\n\t\t\tif (mergeTarget == null) return undefined;\n\n\t\t\t// Safe to cache despite PR retargeting: the cache key includes the resolved `mergeTarget`,\n\t\t\t// so a retargeted PR resolves to a fresh slot and the old entry is stale-but-unused (and\n\t\t\t// TTL-evicts). The prior \"no outer cache here\" rationale assumed a `ref`-only key.\n\t\t\tconst resolvedTarget = mergeTarget;\n\t\t\treturn await this.cache.getBranchOverview(repoPath, `${ref}|${resolvedTarget}`, () =>\n\t\t\t\tfetchBody(resolvedTarget),\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getBranchesWithCommits(\n\t\trepoPath: string,\n\t\tshas: string[],\n\t\tbranch?: string | undefined,\n\t\toptions?:\n\t\t\t| { all?: boolean; commitDate?: Date; mode?: 'contains' | 'pointsAt' }\n\t\t\t| { commitDate?: Date; mode?: 'contains' | 'pointsAt'; remotes?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tif (repoPath == null || options?.commitDate == null) return [];\n\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\tlet branches;\n\n\t\t\tif (branch) {\n\t\t\t\tbranches = await github.getBranchWithCommit(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tbranch,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbranches = await github.getBranchesWithCommits(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn branches;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@debug()\n\tasync getDefaultBranchName(\n\t\trepoPath: string | undefined,\n\t\tremote?: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command queue, so the\n\t\t// priority signal has no effect here. `local` asks for a network-free resolution (the graph's hot\n\t\t// path): a remote repo has no local symref to read, so honor that contract by returning undefined\n\t\t// rather than making the API round-trip the caller explicitly asked to avoid.\n\t\toptions?: { priority?: GitCommandPriority; local?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return undefined;\n\t\tif (options?.local) return undefined;\n\n\t\tremote ??= 'origin';\n\n\t\tconst scope = getScopedLogger();\n\n\t\t// Throw inside the factory so RepoPromiseCacheMap's default `expireOnError` evicts the\n\t\t// entry — a transient API failure shouldn't poison the cache for the rest of the session.\n\t\t// The outer try/catch preserves the existing `undefined`-on-error contract for callers.\n\t\ttry {\n\t\t\treturn await this.cache.getDefaultBranchName(repoPath, remote, async () => {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\t\treturn github.getDefaultBranchName(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\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A"}
|
|
1
|
+
{"version":3,"file":"branches.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/branches.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { BranchContributionsOverview, GitBranchesSubProvider } from '@gitlens/git/providers/branches.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createRevisionRange, stripOrigin } from '@gitlens/git/utils/revision.utils.js';\nimport type { BranchSortOptions } from '@gitlens/git/utils/sorting.js';\nimport { sortBranches, sortContributors } from '@gitlens/git/utils/sorting.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { PagedResult, PagingOptions } from '@gitlens/utils/paging.js';\nimport { emptyPagedResult } from '@gitlens/utils/paging.js';\nimport { getSettledValue } from '@gitlens/utils/promise.js';\nimport type { CacheController } from '@gitlens/utils/promiseCache.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport { HeadType } from '../../context.js';\nimport type { GitHubBranch } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class BranchesGitSubProvider implements GitBranchesSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tasync getBranch(\n\t\trepoPath: string,\n\t\tname?: string,\n\t\toptions?: { force?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (options?.force) {\n\t\t\tthis.cache.evictCaches(repoPath, 'branches');\n\t\t}\n\n\t\tif (name != null) {\n\t\t\tconst {\n\t\t\t\tvalues: [branch],\n\t\t\t} = await this.getBranches(repoPath, { filter: b => b.name === name }, cancellation);\n\t\t\treturn branch;\n\t\t}\n\n\t\treturn this.cache.branch.getOrCreate(\n\t\t\trepoPath,\n\t\t\tasync (_cacheable, signal): Promise<GitBranch | undefined> => {\n\t\t\t\t// Prefer the cache-provided aggregate signal (only fires when every joined\n\t\t\t\t// caller aborts); fall back to this caller's cancellation for the first-caller path.\n\t\t\t\tsignal ??= cancellation;\n\t\t\t\tconst {\n\t\t\t\t\tvalues: [branch],\n\t\t\t\t} = await this.getBranches(repoPath, { filter: b => b.current }, signal);\n\t\t\t\tif (branch != null) return branch;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst { metadata } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\t\tswitch (revision.type) {\n\t\t\t\t\t\tcase HeadType.Tag:\n\t\t\t\t\t\tcase HeadType.Commit:\n\t\t\t\t\t\t\treturn new GitBranch(\n\t\t\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\t\t\t`refs/heads/${revision.name}`,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\trevision.revision,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tdebugger;\n\t\t\t\t\tscope?.error(ex);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@debug({ args: repoPath => ({ repoPath: repoPath }) })\n\tasync getBranches(\n\t\trepoPath: string | undefined,\n\t\toptions?: {\n\t\t\tfilter?: (b: GitBranch) => boolean;\n\t\t\tordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t\tpaging?: PagingOptions;\n\t\t\tsort?: boolean | BranchSortOptions;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PagedResult<GitBranch>> {\n\t\tif (repoPath == null) return emptyPagedResult;\n\n\t\tconst path = repoPath;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst load = async (cacheable?: CacheController): Promise<PagedResult<GitBranch>> => {\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(path);\n\n\t\t\t\tconst branches: GitBranch[] = [];\n\n\t\t\t\tconst commitOrdering = options?.ordering;\n\n\t\t\t\tfunction addBranches(branch: GitHubBranch, current: boolean) {\n\t\t\t\t\tconst date = new Date(\n\t\t\t\t\t\tcommitOrdering === 'author-date' ? branch.target.authoredDate : branch.target.committedDate,\n\t\t\t\t\t);\n\t\t\t\t\tconst ref = branch.target.oid;\n\n\t\t\t\t\tbranches.push(\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/heads/${branch.name}`,\n\t\t\t\t\t\t\tcurrent,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: `origin/${branch.name}`,\n\t\t\t\t\t\t\t\tmissing: false,\n\t\t\t\t\t\t\t\tstate: { ahead: 0, behind: 0 },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitBranch(\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t`refs/remotes/origin/${branch.name}`,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlet currentBranch: string | undefined;\n\n\t\t\t\tconst revision = await metadata.getRevision();\n\t\t\t\tswitch (revision.type) {\n\t\t\t\t\tcase HeadType.Branch:\n\t\t\t\t\t\tcurrentBranch = revision.name;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase HeadType.RemoteBranch: {\n\t\t\t\t\t\tconst index = revision.name.indexOf(':');\n\t\t\t\t\t\tcurrentBranch = index === -1 ? revision.name : revision.name.substring(index + 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet cursor = options?.paging?.cursor;\n\t\t\t\tconst loadAll = cursor == null;\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst result = await github.getBranches(\n\t\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\t\t{ cursor: cursor },\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const branch of result.values) {\n\t\t\t\t\t\taddBranches(branch, branch.name === currentBranch);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!result.paging?.more || !loadAll) return { ...result, values: branches };\n\n\t\t\t\t\tcursor = result.paging.cursor;\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\n\t\t\t\t// Mark the cache entry invalidated so the empty fallback self-evicts on settle\n\t\t\t\t// rather than getting stuck serving stale emptiness to subsequent callers.\n\t\t\t\tcacheable?.invalidate();\n\t\t\t\treturn emptyPagedResult;\n\t\t\t}\n\t\t};\n\n\t\t// Compose cache key with cursor so re-loads of the same page hit the cache;\n\t\t// `repoPath` (no suffix) is reserved for the full \"all branches\" entry.\n\t\t// TODO: `cache.branches` is `PromiseMap<RepoPath, ...>` keyed exactly by repoPath, so\n\t\t// `clearCaches('branches')` / `unregisterRepoPath` will not invalidate composite-key entries.\n\t\t// Acceptable today because branches don't change during a virtual-repo session, but the entries\n\t\t// leak in memory until provider GC. Long-term: switch to RepoPromiseCacheMap or add prefix-invalidate.\n\t\tconst cacheKey = options?.paging?.cursor != null ? `${path}#${options.paging.cursor}` : path;\n\t\tconst branchesPromise = this.cache.branches.getOrCreate(cacheKey, cacheable => load(cacheable), cancellation);\n\n\t\tlet result = await branchesPromise;\n\t\tif (options?.filter != null) {\n\t\t\tresult = {\n\t\t\t\t...result,\n\t\t\t\tvalues: result.values.filter(options.filter),\n\t\t\t};\n\t\t}\n\n\t\tif (options?.sort != null) {\n\t\t\tsortBranches(result.values, typeof options.sort === 'boolean' ? undefined : options.sort);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync getBranchContributionsOverview(\n\t\trepoPath: string,\n\t\tref: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command\n\t\t// queue, so the priority signal has no effect here. Accepted for interface compatibility.\n\t\toptions?: {\n\t\t\tassociatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined>;\n\t\t\tpriority?: GitCommandPriority;\n\t\t},\n\t\t_cancellation?: AbortSignal,\n\t): Promise<BranchContributionsOverview | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\t// Expensive body — runs only on cache miss. Closes over `mergeTarget` so the cache key\n\t\t// (`${ref}|${mergeTarget}`) fully captures every input that affects the result.\n\t\tconst fetchBody = async (mergeTarget: string): Promise<BranchContributionsOverview | undefined> => {\n\t\t\tconst mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget);\n\t\t\tif (mergeBase == null) return undefined;\n\n\t\t\t// Fetch the merge-base commit's committer date in parallel with contributors so consumers\n\t\t\t// that just need the date for the scope window don't pay a separate round-trip.\n\t\t\t// `allSettled` so a transient failure in one side doesn't drop the overview entirely.\n\t\t\tconst [contributorsSettled, mergeBaseCommitSettled] = await Promise.allSettled([\n\t\t\t\tthis.provider.contributors.getContributors(repoPath, createRevisionRange(mergeBase, ref, '..'), {\n\t\t\t\t\tstats: true,\n\t\t\t\t}),\n\t\t\t\tthis.provider.commits.getCommit(repoPath, mergeBase),\n\t\t\t]);\n\n\t\t\tconst result = getSettledValue(contributorsSettled) ?? { contributors: [] };\n\t\t\tconst mergeBaseCommit = getSettledValue(mergeBaseCommitSettled);\n\n\t\t\tsortContributors(result.contributors, { orderBy: 'score:desc' });\n\n\t\t\tlet totalCommits = 0;\n\t\t\tlet totalFiles = 0;\n\t\t\tlet totalAdditions = 0;\n\t\t\tlet totalDeletions = 0;\n\t\t\tlet firstCommitTimestamp;\n\t\t\tlet latestCommitTimestamp;\n\n\t\t\tfor (const c of result.contributors) {\n\t\t\t\ttotalCommits += c.contributionCount;\n\t\t\t\ttotalFiles += c.stats?.files ?? 0;\n\t\t\t\ttotalAdditions += c.stats?.additions ?? 0;\n\t\t\t\ttotalDeletions += c.stats?.deletions ?? 0;\n\n\t\t\t\tconst firstTimestamp = c.firstCommitDate?.getTime();\n\t\t\t\tconst latestTimestamp = c.latestCommitDate?.getTime();\n\n\t\t\t\tif (firstTimestamp != null || latestTimestamp != null) {\n\t\t\t\t\tfirstCommitTimestamp =\n\t\t\t\t\t\tfirstCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.min(firstCommitTimestamp, firstTimestamp ?? Infinity, latestTimestamp ?? Infinity)\n\t\t\t\t\t\t\t: (firstTimestamp ?? latestTimestamp);\n\n\t\t\t\t\tlatestCommitTimestamp =\n\t\t\t\t\t\tlatestCommitTimestamp != null\n\t\t\t\t\t\t\t? Math.max(latestCommitTimestamp, firstTimestamp ?? -Infinity, latestTimestamp ?? -Infinity)\n\t\t\t\t\t\t\t: (latestTimestamp ?? firstTimestamp);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tbranch: ref,\n\t\t\t\tmergeTarget: mergeTarget,\n\t\t\t\tmergeBase: mergeBase,\n\t\t\t\tmergeBaseDate: mergeBaseCommit?.committer?.date ?? mergeBaseCommit?.author?.date,\n\n\t\t\t\tcommits: totalCommits,\n\t\t\t\tfiles: totalFiles,\n\t\t\t\tadditions: totalAdditions,\n\t\t\t\tdeletions: totalDeletions,\n\n\t\t\t\tlatestCommitDate: latestCommitTimestamp != null ? new Date(latestCommitTimestamp) : undefined,\n\t\t\t\tfirstCommitDate: firstCommitTimestamp != null ? new Date(firstCommitTimestamp) : undefined,\n\n\t\t\t\tcontributors: result.contributors,\n\t\t\t};\n\t\t};\n\n\t\ttry {\n\t\t\t// Resolve `mergeTarget` (PR base or default branch). Only the expensive body below is\n\t\t\t// cached — keyed on `${ref}|${mergeTarget}` so callers that resolve to the same target\n\t\t\t// share the result, while differing targets get independent slots.\n\t\t\tlet mergeTarget: string | undefined;\n\n\t\t\tif (options?.associatedPullRequest != null) {\n\t\t\t\tconst pr = await options.associatedPullRequest;\n\t\t\t\tif (pr?.refs?.base != null) {\n\t\t\t\t\tmergeTarget = pr.refs.base.branch;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmergeTarget ??= await this.getDefaultBranchName(repoPath);\n\t\t\tif (mergeTarget == null) return undefined;\n\n\t\t\t// Safe to cache despite PR retargeting: the cache key includes the resolved `mergeTarget`,\n\t\t\t// so a retargeted PR resolves to a fresh slot and the old entry is stale-but-unused (and\n\t\t\t// TTL-evicts). The prior \"no outer cache here\" rationale assumed a `ref`-only key.\n\t\t\tconst resolvedTarget = mergeTarget;\n\t\t\treturn await this.cache.getBranchOverview(repoPath, `${ref}|${resolvedTarget}`, () =>\n\t\t\t\tfetchBody(resolvedTarget),\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@debug()\n\tasync getBranchesWithCommits(\n\t\trepoPath: string,\n\t\tshas: string[],\n\t\tbranch?: string | undefined,\n\t\toptions?:\n\t\t\t| { all?: boolean; commitDate?: Date; mode?: 'contains' | 'pointsAt' }\n\t\t\t| { commitDate?: Date; mode?: 'contains' | 'pointsAt'; remotes?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tif (repoPath == null || options?.commitDate == null) return [];\n\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\tlet branches;\n\n\t\t\tif (branch) {\n\t\t\t\tbranches = await github.getBranchWithCommit(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tbranch,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbranches = await github.getBranchesWithCommits(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tshas.map(stripOrigin),\n\t\t\t\t\toptions?.mode ?? 'contains',\n\t\t\t\t\toptions?.commitDate,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn branches;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@debug()\n\tasync getDefaultBranchName(\n\t\trepoPath: string | undefined,\n\t\tremote?: string,\n\t\t// `priority` is unused — the GitHub provider doesn't go through the local git command queue, so the\n\t\t// priority signal has no effect here. `local` asks for a network-free resolution (the graph's hot\n\t\t// path): a remote repo has no local symref to read, so honor that contract by returning undefined\n\t\t// rather than making the API round-trip the caller explicitly asked to avoid.\n\t\toptions?: { priority?: GitCommandPriority; local?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return undefined;\n\t\tif (options?.local) return undefined;\n\n\t\tremote ??= 'origin';\n\n\t\tconst scope = getScopedLogger();\n\n\t\t// Throw inside the factory so RepoPromiseCacheMap's default `expireOnError` evicts the\n\t\t// entry — a transient API failure shouldn't poison the cache for the rest of the session.\n\t\t// The outer try/catch preserves the existing `undefined`-on-error contract for callers.\n\t\ttry {\n\t\t\treturn await this.cache.getDefaultBranchName(repoPath, remote, async () => {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\t\treturn github.getDefaultBranchName(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,yBAAb,MAAsE;CAEnD;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,MACM,UACL,UACA,MACA,SACA,cACiC;EACjC,MAAM,QAAQ,gBAAgB;EAE9B,IAAI,SAAS,OACZ,KAAK,MAAM,YAAY,UAAU,UAAU;EAG5C,IAAI,QAAQ,MAAM;GACjB,MAAM,EACL,QAAQ,CAAC,YACN,MAAM,KAAK,YAAY,UAAU,EAAE,SAAQ,MAAK,EAAE,SAAS,KAAK,GAAG,YAAY;GACnF,OAAO;EACR;EAEA,OAAO,KAAK,MAAM,OAAO,YACxB,UACA,OAAO,YAAY,WAA2C;GAG7D,WAAW;GACX,MAAM,EACL,QAAQ,CAAC,YACN,MAAM,KAAK,YAAY,UAAU,EAAE,SAAQ,MAAK,EAAE,QAAQ,GAAG,MAAM;GACvE,IAAI,UAAU,MAAM,OAAO;GAE3B,IAAI;IACH,MAAM,EAAE,aAAa,MAAM,KAAK,SAAS,wBAAwB,QAAQ;IAEzE,MAAM,WAAW,MAAM,SAAS,YAAY;IAC5C,QAAQ,SAAS,MAAjB;KACC,KAAK,SAAS;KACd,KAAK,SAAS,QACb,OAAO,IAAI,UACV,UACA,cAAc,SAAS,QACvB,MACA,KAAA,GACA,KAAA,GACA,SAAS,UACT,KAAA,GACA,OACA,IACD;IACF;IAEA;GACD,SAAS,IAAI;IACZ;IACA,OAAO,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AG,CAAC,CAAA,GAAA,uBAAA,WAAA,eAAA,IAAA;AA+HpD,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,kCAAA,IAAA;AAgHN,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,0BAAA,IAAA;AAgDN,WAAA,CAAA,MAAM,CAAA,GAAA,uBAAA,WAAA,wBAAA,IAAA"}
|
|
@@ -5,7 +5,7 @@ import { GitCommit } from "../../../../git/models/commit.js";
|
|
|
5
5
|
import { SearchQuery } from "../../../../git/models/search.js";
|
|
6
6
|
import { GitLog } from "../../../../git/models/log.js";
|
|
7
7
|
import { GitUser } from "../../../../git/models/user.js";
|
|
8
|
-
import { GitCommitsSubProvider, GitLogForPathOptions, GitLogOptions, GitLogShasOptions, GitSearchCommitsOptions, LeftRightCommitCountResult, SearchCommitsResult } from "../../../../git/providers/commits.js";
|
|
8
|
+
import { GitCommitsSubProvider, GitLogForPathOptions, GitLogOptions, GitLogShasOptions, GitRefExclusions, GitSearchCommitsOptions, LeftRightCommitCountResult, SearchCommitsResult } from "../../../../git/providers/commits.js";
|
|
9
9
|
import { Cache } from "../../../../git/cache.js";
|
|
10
10
|
import { GitHubGitProviderInternal } from "../githubProvider.js";
|
|
11
11
|
//#region ../plus/git-github/src/providers/github/commits.d.ts
|
|
@@ -14,7 +14,9 @@ export declare class CommitsGitSubProvider implements GitCommitsSubProvider {
|
|
|
14
14
|
private readonly provider;
|
|
15
15
|
constructor(cache: Cache, provider: GitHubGitProviderInternal);
|
|
16
16
|
getCommit(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<GitCommit | undefined>;
|
|
17
|
-
getCommitCount(repoPath: string, rev: string,
|
|
17
|
+
getCommitCount(repoPath: string, rev: string, options?: {
|
|
18
|
+
excluding?: GitRefExclusions;
|
|
19
|
+
}, _cancellation?: AbortSignal): Promise<number | undefined>;
|
|
18
20
|
getCommitFiles(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<GitFileChange[]>;
|
|
19
21
|
getCommitForFile(repoPath: string, pathOrUri: string | Uri, rev?: string | undefined, _options?: {
|
|
20
22
|
firstIfNotFound?: boolean;
|
|
@@ -49,8 +49,9 @@ var CommitsGitSubProvider = class {
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
getCommitCount(repoPath, rev, _cancellation) {
|
|
52
|
+
getCommitCount(repoPath, rev, options, _cancellation) {
|
|
53
53
|
if (repoPath == null) return Promise.resolve(void 0);
|
|
54
|
+
if (options?.excluding != null) return Promise.resolve(void 0);
|
|
54
55
|
return this.cache.commitCount.getOrCreate(repoPath, stripOrigin(rev), async () => {
|
|
55
56
|
const scope = getScopedLogger();
|
|
56
57
|
try {
|
|
@@ -316,6 +317,7 @@ var CommitsGitSubProvider = class {
|
|
|
316
317
|
}
|
|
317
318
|
async getLogShas(repoPath, rev, options, cancellation) {
|
|
318
319
|
if (repoPath == null) return [];
|
|
320
|
+
if (options?.excluding != null) return [];
|
|
319
321
|
const scope = getScopedLogger();
|
|
320
322
|
if (options?.authors?.length || options?.all) {
|
|
321
323
|
let log;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commits.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/commits.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport { GitCommit, GitCommitIdentity } from '@gitlens/git/models/commit.js';\nimport { GitFileChange } from '@gitlens/git/models/fileChange.js';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { GitLog } from '@gitlens/git/models/log.js';\nimport type { GitRevisionRange } from '@gitlens/git/models/revision.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { SearchQuery } from '@gitlens/git/models/search.js';\nimport type { GitUser } from '@gitlens/git/models/user.js';\nimport type {\n\tGitCommitsSubProvider,\n\tGitLogForPathOptions,\n\tGitLogOptions,\n\tGitLogShasOptions,\n\tGitSearchCommitsOptions,\n\tLeftRightCommitCountResult,\n\tSearchCommitsResult,\n} from '@gitlens/git/providers/commits.js';\nimport { createUncommittedChangesCommit } from '@gitlens/git/utils/commit.utils.js';\nimport { createRevisionRange, isUncommitted, stripOrigin } from '@gitlens/git/utils/revision.utils.js';\nimport { parseSearchQueryGitHubCommand } from '@gitlens/git/utils/search.utils.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { first, last, map, some } from '@gitlens/utils/iterable.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { isFolderGlob, normalizePath, stripFolderGlob } from '@gitlens/utils/path.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { coerceUri, joinUriPath } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubCommit } from '../../models.js';\nimport { fromCommitFileStatus } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nfunction isViewer(name: string, viewer: string | undefined): boolean | undefined {\n\treturn (viewer != null && name === viewer) || undefined;\n}\n\nexport class CommitsGitSubProvider implements GitCommitsSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tgetCommit(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<GitCommit | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\t// Don't cache uncommitted-changes synthesis — it's date-sensitive\n\t\tif (isUncommitted(rev, true)) {\n\t\t\treturn (async () => {\n\t\t\t\treturn createUncommittedChangesCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\trev,\n\t\t\t\t\tnew Date(),\n\t\t\t\t\tawait this.provider.config.getCurrentUser(repoPath),\n\t\t\t\t);\n\t\t\t})();\n\t\t}\n\n\t\t// TODO: resolve symbolic refs (HEAD, branch names) to SHA before caching to avoid\n\t\t// short staleness windows. For now we cascade-clear on 'branch'/'branches'.\n\t\treturn this.cache.commit.getOrCreate(repoPath, stripOrigin(rev), async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\tconst commit = await github.getCommit(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(rev),\n\t\t\t\t);\n\t\t\t\tif (commit == null) return undefined;\n\n\t\t\t\tconst repoUri = coerceUri(repoPath);\n\n\t\t\t\tconst { viewer = session.account.label } = commit;\n\n\t\t\t\treturn new GitCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tcommit.oid,\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\tcommit.message,\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.files?.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t},\n\t\t\t\t\t[],\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tgetCommitCount(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<number | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\treturn this.cache.commitCount.getOrCreate(repoPath, stripOrigin(rev), async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\tconst count = await github.getCommitCount(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(rev),\n\t\t\t\t);\n\n\t\t\t\treturn count;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getCommitFiles(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<GitFileChange[]> {\n\t\tif (rev === deletedOrMissing || isUncommitted(rev)) return [];\n\n\t\tconst commit = await this.getCommit(repoPath, rev);\n\t\treturn [...(commit?.fileset?.files ?? [])];\n\t}\n\n\t@debug()\n\tasync getCommitForFile(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev?: string | undefined,\n\t\t_options?: { firstIfNotFound?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitCommit | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\tconst rootUri = this.provider.getProviderRootUri(this.provider.getAbsoluteUri(pathOrUri, repoPath));\n\t\tconst file = this.provider.getRelativePath(this.provider.getAbsoluteUri(pathOrUri, repoPath), rootUri);\n\n\t\t// Resolve HEAD/empty rev to the metadata revision so the cache key is stable across callers\n\t\tconst resolvedRev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\t\t// Path-scoped variant lives in the same slot as `getCommit` but with a `|file` suffix to\n\t\t// keep it distinct from the unscoped commit entry.\n\t\tconst cacheKey = `${stripOrigin(resolvedRev)}|${file}`;\n\n\t\treturn this.cache.commit.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\ttry {\n\t\t\t\tconst commit = await github.getCommitForFile(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(resolvedRev),\n\t\t\t\t\tfile,\n\t\t\t\t);\n\t\t\t\tif (commit == null) return undefined;\n\n\t\t\t\tconst repoUri = coerceUri(repoPath);\n\t\t\t\tconst { viewer = session.account.label } = commit;\n\n\t\t\t\treturn new GitCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tcommit.oid,\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\tcommit.message,\n\t\t\t\t\tcommit.files != null\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tfiles: undefined,\n\t\t\t\t\t\t\t\tfiltered: {\n\t\t\t\t\t\t\t\t\tfiles: commit.files?.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t\t\t\t\tpathspec: file,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t},\n\t\t\t\t\t[],\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tgetLeftRightCommitCount(\n\t\trepoPath: string,\n\t\trange: GitRevisionRange,\n\t\t_options?: { authors?: GitUser[]; excludeMerges?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<LeftRightCommitCountResult | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\treturn this.cache.leftRightCommitCount.getOrCreate(repoPath, stripOrigin(range), async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\ttry {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(range),\n\t\t\t\t);\n\n\t\t\t\tif (result == null) return undefined;\n\n\t\t\t\treturn {\n\t\t\t\t\tleft: result.behind_by,\n\t\t\t\t\tright: result.ahead_by,\n\t\t\t\t};\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getLog(\n\t\trepoPath: string,\n\t\trev?: string | undefined,\n\t\toptions?: GitLogOptions,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitLog | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst limit = this.provider.getPagingLimit(options?.limit);\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\trev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\t\t\tconst result = await github.getCommits(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\tstripOrigin(rev),\n\t\t\t\t{\n\t\t\t\t\tall: options?.all,\n\t\t\t\t\tauthors: options?.authors,\n\t\t\t\t\tafter: options?.cursor,\n\t\t\t\t\tlimit: limit,\n\t\t\t\t\tsince: options?.since ? new Date(options.since) : undefined,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst commits = new Map<string, GitCommit>();\n\t\t\tconst repoUri = coerceUri(repoPath);\n\n\t\t\tconst { viewer = session.account.label } = result;\n\t\t\tfor (const commit of result.values) {\n\t\t\t\tlet c = commits.get(commit.oid);\n\t\t\t\tif (c == null) {\n\t\t\t\t\tc = new GitCommit(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tcommit.oid,\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\t\tcommit.message,\n\t\t\t\t\t\tcommit.files != null\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfiles: commit.files.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[],\n\t\t\t\t\t);\n\t\t\t\t\tcommits.set(commit.oid, c);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst log: GitLog = {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: rev,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: limit,\n\t\t\t\thasMore: result.paging?.more ?? false,\n\t\t\t\tendingCursor: result.paging?.cursor,\n\t\t\t\tquery: (limit: number | undefined) => this.getLog(repoPath, rev, { ...options, limit: limit }),\n\t\t\t};\n\n\t\t\tif (log.hasMore) {\n\t\t\t\tlog.more = this.getLogMoreFn(log, rev, options);\n\t\t\t}\n\n\t\t\treturn log;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate getLogMoreFn(\n\t\tlog: GitLog,\n\t\trev: string | undefined,\n\t\toptions?: GitLogOptions,\n\t): (limit: number | { until: string } | undefined) => Promise<GitLog> {\n\t\treturn async (limit: number | { until: string } | undefined) => {\n\t\t\tconst moreUntil = limit != null && typeof limit === 'object' ? limit.until : undefined;\n\t\t\tlet moreLimit = typeof limit === 'number' ? limit : undefined;\n\n\t\t\tif (moreUntil && some(log.commits.values(), c => c.ref === moreUntil)) {\n\t\t\t\treturn log;\n\t\t\t}\n\n\t\t\tmoreLimit = this.provider.getPagingLimit(moreLimit);\n\n\t\t\tconst moreLog = await this.getLog(log.repoPath, rev, {\n\t\t\t\t...options,\n\t\t\t\tlimit: moreLimit,\n\t\t\t\tcursor: log.endingCursor,\n\t\t\t});\n\t\t\t// If we can't find any more, assume we have everything\n\t\t\tif (moreLog == null) return { ...log, hasMore: false, more: undefined };\n\n\t\t\tconst commits = new Map([...log.commits, ...moreLog.commits]);\n\n\t\t\tconst mergedLog: GitLog = {\n\t\t\t\trepoPath: log.repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: log.sha,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: moreUntil == null ? (log.limit ?? 0) + moreLimit : undefined,\n\t\t\t\thasMore: moreUntil == null ? moreLog.hasMore : true,\n\t\t\t\t// The oldest commit SHA of the previous page — the graph webview compares this\n\t\t\t\t// against its last displayed row to determine the merge point for appending new rows\n\t\t\t\tstartingCursor: last(log.commits)?.[0],\n\t\t\t\tendingCursor: moreLog.endingCursor,\n\t\t\t\tpagedCommits: () => {\n\t\t\t\t\t// Remove any duplicates\n\t\t\t\t\tfor (const sha of log.commits.keys()) {\n\t\t\t\t\t\tmoreLog.commits.delete(sha);\n\t\t\t\t\t}\n\t\t\t\t\treturn moreLog.commits;\n\t\t\t\t},\n\t\t\t\tquery: log.query,\n\t\t\t};\n\t\t\tif (mergedLog.hasMore) {\n\t\t\t\tmergedLog.more = this.getLogMoreFn(mergedLog, rev, options);\n\t\t\t}\n\n\t\t\treturn mergedLog;\n\t\t};\n\t}\n\n\t@debug()\n\tasync getLogForPath(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev?: string | undefined,\n\t\toptions?: GitLogForPathOptions,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitLog | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tlet relativePath = this.provider.getRelativePath(pathOrUri, repoPath);\n\n\t\tif (repoPath != null && repoPath === relativePath) {\n\t\t\tthrow new Error(`Path cannot match the repository path; path=${relativePath}`);\n\t\t}\n\n\t\toptions = {\n\t\t\t...options,\n\t\t\tall: false /* not supported */,\n\t\t\tlimit: this.provider.getPagingLimit(options?.limit),\n\t\t\trenames: false /* not supported */,\n\t\t};\n\n\t\tif (isFolderGlob(relativePath)) {\n\t\t\trelativePath = stripFolderGlob(relativePath);\n\t\t\toptions.isFolder = true;\n\t\t} else if (options.isFolder == null) {\n\t\t\tconst tree = await this.provider.revision.getTreeEntryForRevision(repoPath, relativePath, rev || 'HEAD');\n\t\t\toptions.isFolder = tree?.type === 'tree';\n\t\t}\n\n\t\t// Note: document caching (TrackedGitDocument) is handled by the extension wrapper.\n\t\t// The library implementation always fetches fresh data.\n\t\treturn this.getLogForPathCore(repoPath, relativePath, rev, options);\n\t}\n\n\tprivate async getLogForPathCore(\n\t\trepoPath: string,\n\t\tpath: string,\n\t\trev: string | undefined,\n\t\toptions: GitLogForPathOptions,\n\t): Promise<GitLog | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst limit = this.provider.getPagingLimit(options.limit);\n\n\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\tif (context == null) return undefined;\n\n\t\tconst { metadata, github, session } = context;\n\n\t\tconst uri = this.provider.getAbsoluteUri(path, repoPath);\n\t\tconst relativePath = this.provider.getRelativePath(uri, this.provider.getProviderRootUri(uri));\n\n\t\trev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\t\tconst result = await github.getCommits(\n\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\tmetadata.repo.owner,\n\t\t\tmetadata.repo.name,\n\t\t\tstripOrigin(rev),\n\t\t\t{\n\t\t\t\tall: options.all,\n\t\t\t\tafter: options.cursor,\n\t\t\t\tpath: relativePath,\n\t\t\t\tlimit: limit,\n\t\t\t\tsince: options.since ? new Date(options.since) : undefined,\n\t\t\t},\n\t\t);\n\n\t\tconst repoUri = coerceUri(repoPath);\n\t\tconst commits = new Map<string, GitCommit>();\n\n\t\tconst { viewer = session.account.label } = result;\n\t\tfor (const commit of result.values) {\n\t\t\tlet c = commits.get(commit.oid);\n\t\t\tif (c == null) {\n\t\t\t\tconst files = commit.files?.map(f => toFileChange(repoUri, repoPath, f));\n\n\t\t\t\tif (files != null && !options.isFolder && commit.changedFiles === 1) {\n\t\t\t\t\tconst index = files.findIndex(f => f.path === relativePath);\n\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\tfiles.splice(\n\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\tnew GitFileChange(\n\t\t\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\t\t\trelativePath,\n\t\t\t\t\t\t\t\tGitFileIndexStatus.Modified,\n\t\t\t\t\t\t\t\tjoinUriPath(repoUri, normalizePath(relativePath)),\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tcommit.changedFiles === 1\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t\t\t\t\t\t\tchanges: 0,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tc = new GitCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tcommit.oid,\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\tcommit.message,\n\t\t\t\t\t{ files: undefined, filtered: { files: files, pathspec: relativePath } },\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t},\n\t\t\t\t\t[],\n\t\t\t\t);\n\t\t\t\tcommits.set(commit.oid, c);\n\t\t\t}\n\t\t}\n\n\t\tconst log: GitLog = {\n\t\t\trepoPath: repoPath,\n\t\t\tcommits: commits,\n\t\t\tsha: rev,\n\t\t\tcount: commits.size,\n\t\t\tlimit: limit,\n\t\t\thasMore: result.paging?.more ?? false,\n\t\t\tendingCursor: result.paging?.cursor,\n\t\t\tquery: (limit: number | undefined) => this.getLogForPath(repoPath, path, rev, { ...options, limit: limit }),\n\t\t};\n\t\tif (log.hasMore) {\n\t\t\tlog.more = this.getLogForPathMoreFn(log, path, rev, options);\n\t\t}\n\n\t\treturn log;\n\t}\n\n\tprivate getLogForPathMoreFn(\n\t\tlog: GitLog,\n\t\trelativePath: string,\n\t\trev: string | undefined,\n\t\toptions: GitLogForPathOptions,\n\t): (limit: number | { until: string } | undefined) => Promise<GitLog> {\n\t\treturn async (limit: number | { until: string } | undefined) => {\n\t\t\tconst moreUntil = limit != null && typeof limit === 'object' ? limit.until : undefined;\n\t\t\tlet moreLimit = typeof limit === 'number' ? limit : undefined;\n\n\t\t\tif (moreUntil && some(log.commits.values(), c => c.ref === moreUntil)) {\n\t\t\t\treturn log;\n\t\t\t}\n\n\t\t\tmoreLimit = this.provider.getPagingLimit(moreLimit);\n\n\t\t\tconst moreLog = await this.getLogForPath(log.repoPath, relativePath, rev, {\n\t\t\t\t...options,\n\t\t\t\tlimit: moreUntil == null ? moreLimit : 0,\n\t\t\t\tcursor: log.endingCursor,\n\t\t\t});\n\t\t\t// If we can't find any more, assume we have everything\n\t\t\tif (moreLog == null) return { ...log, hasMore: false, more: undefined };\n\n\t\t\tconst commits = new Map([...log.commits, ...moreLog.commits]);\n\n\t\t\tconst mergedLog: GitLog = {\n\t\t\t\trepoPath: log.repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: log.sha,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: moreUntil == null ? (log.limit ?? 0) + moreLimit : undefined,\n\t\t\t\thasMore: moreUntil == null ? moreLog.hasMore : true,\n\t\t\t\tendingCursor: moreLog.endingCursor,\n\t\t\t\tquery: log.query,\n\t\t\t};\n\n\t\t\tif (mergedLog.hasMore) {\n\t\t\t\tmergedLog.more = this.getLogForPathMoreFn(mergedLog, relativePath, rev, options);\n\t\t\t}\n\n\t\t\treturn mergedLog;\n\t\t};\n\t}\n\n\t@debug()\n\tasync getLogShas(\n\t\trepoPath: string,\n\t\trev?: string | undefined,\n\t\toptions?: GitLogShasOptions,\n\t\tcancellation?: AbortSignal,\n\t): Promise<Iterable<string>> {\n\t\tif (repoPath == null) return [];\n\n\t\tconst scope = getScopedLogger();\n\n\t\t// `authors` and `all` filters aren't supported by the lightweight SHA-only query;\n\t\t// fall back to the full log path when set.\n\t\tif (options?.authors?.length || options?.all) {\n\t\t\tlet log: GitLog | undefined;\n\t\t\tif (options?.pathOrUri != null) {\n\t\t\t\tlog = await this.getLogForPath(repoPath, options.pathOrUri, rev, options, cancellation);\n\t\t\t} else {\n\t\t\t\tlog = await this.getLog(repoPath, rev, options, cancellation);\n\t\t\t}\n\t\t\tif (log == null) return [];\n\n\t\t\tconst shas = map(log.commits.values(), c => c.ref);\n\t\t\t// Note: reversal only applies to the first page — subsequent pages loaded via pagination are not reversed\n\t\t\treturn options?.reverse ? [...shas].reverse() : shas;\n\t\t}\n\n\t\tconst limit = this.provider.getPagingLimit(options?.limit);\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\trev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\n\t\t\tlet path: string | undefined;\n\t\t\tif (options?.pathOrUri != null) {\n\t\t\t\tconst rootUri = this.provider.getProviderRootUri(\n\t\t\t\t\tthis.provider.getAbsoluteUri(options.pathOrUri, repoPath),\n\t\t\t\t);\n\t\t\t\tpath = this.provider.getRelativePath(\n\t\t\t\t\tthis.provider.getAbsoluteUri(options.pathOrUri, repoPath),\n\t\t\t\t\trootUri,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst strippedRev = stripOrigin(rev);\n\t\t\tconst sinceISO = options?.since ? new Date(options.since).toISOString() : '';\n\t\t\tconst cacheKey = `${strippedRev}|${path ?? ''}|${sinceISO}|${limit}|${options?.cursor ?? ''}`;\n\n\t\t\tconst shas = await this.cache.logShas.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\t\tconst result = await github.getCommitShas(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstrippedRev,\n\t\t\t\t\t{\n\t\t\t\t\t\tafter: options?.cursor,\n\t\t\t\t\t\tlimit: limit,\n\t\t\t\t\t\tpath: path,\n\t\t\t\t\t\tsince: options?.since ? new Date(options.since) : undefined,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\treturn result.values;\n\t\t\t});\n\n\t\t\t// Note: reversal only applies to the first page — subsequent pages loaded via pagination are not reversed\n\t\t\treturn options?.reverse ? shas.toReversed() : shas;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@debug()\n\tgetOldestUnpushedShaForPath(\n\t\t_repoPath: string,\n\t\t_pathOrUri: string | Uri,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\t// TODO@eamodio until we have access to the RemoteHub change store there isn't anything we can do here\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\t@debug()\n\thasCommitBeenPushed(_repoPath: string, _rev: string, _cancellation?: AbortSignal): Promise<boolean> {\n\t\t// In this env we can't have unpushed commits\n\t\treturn Promise.resolve(true);\n\t}\n\n\t@debug()\n\tasync isAncestorOf(repoPath: string, rev1: string, rev2: string, _cancellation?: AbortSignal): Promise<boolean> {\n\t\tif (repoPath == null) return false;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\ttry {\n\t\t\tconst result = await github.getComparison(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\tcreateRevisionRange(stripOrigin(rev1), stripOrigin(rev2), '...'),\n\t\t\t);\n\n\t\t\tswitch (result?.status) {\n\t\t\t\tcase 'ahead':\n\t\t\t\tcase 'diverged':\n\t\t\t\t\treturn false;\n\t\t\t\tcase 'identical':\n\t\t\t\tcase 'behind':\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t@debug({\n\t\targs: (repoPath, s) => ({\n\t\t\trepoPath: repoPath,\n\t\t\tsearch: `[${s.matchAll ? 'A' : ''}${s.matchCase ? 'C' : ''}${s.matchRegex ? 'R' : ''}${\n\t\t\t\ts.matchWholeWord ? 'W' : ''\n\t\t\t}]: ${s.query.length > 500 ? `${s.query.substring(0, 500)}...` : s.query}`,\n\t\t}),\n\t})\n\tasync searchCommits(\n\t\trepoPath: string,\n\t\tsearch: SearchQuery,\n\t\toptions?: GitSearchCommitsOptions,\n\t\tcancellation?: AbortSignal,\n\t): Promise<SearchCommitsResult> {\n\t\tif (repoPath == null) return { search: search, log: undefined };\n\n\t\tconst scope = getScopedLogger();\n\n\t\tsearch = { matchAll: false, matchCase: false, matchRegex: true, matchWholeWord: false, ...search };\n\t\t// Note: Natural language processing is handled by the extension wrapper.\n\n\t\tconst currentUser = search.query.includes('@me')\n\t\t\t? await this.provider.config.getCurrentUser(repoPath)\n\t\t\t: undefined;\n\t\tif (cancellation?.aborted) return { search: search, log: undefined };\n\n\t\tconst { args: queryArgs, operations } = parseSearchQueryGitHubCommand(search, currentUser);\n\n\t\tconst values = operations.get('commit:');\n\t\tif (values?.size) {\n\t\t\tconst commit = await this.getCommit(repoPath, first(values)!);\n\t\t\tif (commit == null) return { search: search, log: undefined };\n\n\t\t\treturn {\n\t\t\t\tsearch: search,\n\t\t\t\tlog: {\n\t\t\t\t\trepoPath: repoPath,\n\t\t\t\t\tcommits: new Map([[commit.sha, commit]]),\n\t\t\t\t\tsha: commit.sha,\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tlimit: 1,\n\t\t\t\t\thasMore: false,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (!queryArgs.length) return { search: search, log: undefined };\n\n\t\tconst limit = this.provider.getPagingLimit(options?.limit);\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\tconst query = `repo:${metadata.repo.owner}/${metadata.repo.name}+${queryArgs.join('+').trim()}`;\n\n\t\t\tconst result = await github.searchCommits(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tcursor: options?.cursor,\n\t\t\t\t\tlimit: limit,\n\t\t\t\t\tsort:\n\t\t\t\t\t\toptions?.ordering === 'date'\n\t\t\t\t\t\t\t? 'committer-date'\n\t\t\t\t\t\t\t: options?.ordering === 'author-date'\n\t\t\t\t\t\t\t\t? 'author-date'\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (result == null) return { search: search, log: undefined };\n\n\t\t\tconst commits = new Map<string, GitCommit>();\n\t\t\tconst repoUri = coerceUri(repoPath);\n\n\t\t\tconst viewer = session.account.label;\n\t\t\tfor (const commit of result.values) {\n\t\t\t\tlet c = commits.get(commit.oid);\n\t\t\t\tif (c == null) {\n\t\t\t\t\tc = new GitCommit(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tcommit.oid,\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\t\tcommit.message,\n\t\t\t\t\t\tcommit.files != null\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfiles: commit.files.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[],\n\t\t\t\t\t);\n\t\t\t\t\tcommits.set(commit.oid, c);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst log: GitLog = {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: undefined,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: limit,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tendingCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t\tquery: (limit: number | undefined) =>\n\t\t\t\t\tthis.searchCommits(repoPath, search, { ...options, limit: limit }).then(r => r.log!),\n\t\t\t};\n\n\t\t\tif (log.hasMore) {\n\t\t\t\tconst searchCommitsCore = (log: GitLog): ((limit: number | undefined) => Promise<GitLog>) => {\n\t\t\t\t\treturn async (limit: number | undefined) => {\n\t\t\t\t\t\tlimit = this.provider.getPagingLimit(limit);\n\n\t\t\t\t\t\tconst moreLog = (\n\t\t\t\t\t\t\tawait this.searchCommits(log.repoPath, search, {\n\t\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t\t\tlimit: limit,\n\t\t\t\t\t\t\t\tcursor: log.endingCursor,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t).log;\n\t\t\t\t\t\t// If we can't find any more, assume we have everything\n\t\t\t\t\t\tif (moreLog == null) return { ...log, hasMore: false, more: undefined };\n\n\t\t\t\t\t\tconst commits = new Map([...log.commits, ...moreLog.commits]);\n\n\t\t\t\t\t\tconst mergedLog: GitLog = {\n\t\t\t\t\t\t\trepoPath: log.repoPath,\n\t\t\t\t\t\t\tcommits: commits,\n\t\t\t\t\t\t\tsha: log.sha,\n\t\t\t\t\t\t\tcount: commits.size,\n\t\t\t\t\t\t\tlimit: (log.limit ?? 0) + limit,\n\t\t\t\t\t\t\thasMore: moreLog.hasMore,\n\t\t\t\t\t\t\tendingCursor: moreLog.endingCursor,\n\t\t\t\t\t\t\tquery: log.query,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (mergedLog.hasMore) {\n\t\t\t\t\t\t\tmergedLog.more = searchCommitsCore(mergedLog);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn mergedLog;\n\t\t\t\t\t};\n\t\t\t\t};\n\n\t\t\t\tlog.more = searchCommitsCore(log);\n\t\t\t}\n\n\t\t\treturn { search: search, log: log };\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn { search: search, log: undefined };\n\t\t}\n\t}\n}\n\n/** Converts a GitHub API file entry to a library GitFileChange */\nfunction toFileChange(repoUri: Uri, repoPath: string, f: NonNullable<GitHubCommit['files']>[0]): GitFileChange {\n\tconst path = f.filename ?? '';\n\treturn new GitFileChange(\n\t\trepoPath,\n\t\tpath,\n\t\tfromCommitFileStatus(f.status) ?? GitFileIndexStatus.Modified,\n\t\tjoinUriPath(repoUri, normalizePath(path)),\n\t\tf.previous_filename,\n\t\tf.previous_filename != null ? joinUriPath(repoUri, normalizePath(f.previous_filename)) : undefined,\n\t\tundefined,\n\t\t{\n\t\t\tadditions: f.additions ?? 0,\n\t\t\tdeletions: f.deletions ?? 0,\n\t\t\tchanges: f.changes ?? 0,\n\t\t},\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAS,SAAS,MAAc,QAAiD;CAChF,OAAQ,UAAU,QAAQ,SAAS,UAAW,KAAA;AAC/C;AAEA,IAAa,wBAAb,MAAoE;CAEjD;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,UACU,UAAkB,KAAa,eAA6D;EACrG,IAAI,YAAY,MAAM,OAAO,QAAQ,QAAQ,KAAA,CAAS;EAGtD,IAAI,cAAc,KAAK,IAAI,GAC1B,QAAQ,YAAY;GACnB,OAAO,+BACN,UACA,qBACA,IAAI,KAAK,GACT,MAAM,KAAK,SAAS,OAAO,eAAe,QAAQ,CACnD;EACD,EAAA,CAAG;EAKJ,OAAO,KAAK,MAAM,OAAO,YAAY,U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WAAW;CACvB,CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"commits.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/commits.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport { GitCommit, GitCommitIdentity } from '@gitlens/git/models/commit.js';\nimport { GitFileChange } from '@gitlens/git/models/fileChange.js';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { GitLog } from '@gitlens/git/models/log.js';\nimport type { GitRevisionRange } from '@gitlens/git/models/revision.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { SearchQuery } from '@gitlens/git/models/search.js';\nimport type { GitUser } from '@gitlens/git/models/user.js';\nimport type {\n\tGitCommitsSubProvider,\n\tGitLogForPathOptions,\n\tGitLogOptions,\n\tGitLogShasOptions,\n\tGitRefExclusions,\n\tGitSearchCommitsOptions,\n\tLeftRightCommitCountResult,\n\tSearchCommitsResult,\n} from '@gitlens/git/providers/commits.js';\nimport { createUncommittedChangesCommit } from '@gitlens/git/utils/commit.utils.js';\nimport { createRevisionRange, isUncommitted, stripOrigin } from '@gitlens/git/utils/revision.utils.js';\nimport { parseSearchQueryGitHubCommand } from '@gitlens/git/utils/search.utils.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { first, last, map, some } from '@gitlens/utils/iterable.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { isFolderGlob, normalizePath, stripFolderGlob } from '@gitlens/utils/path.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { coerceUri, joinUriPath } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubCommit } from '../../models.js';\nimport { fromCommitFileStatus } from '../../models.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nfunction isViewer(name: string, viewer: string | undefined): boolean | undefined {\n\treturn (viewer != null && name === viewer) || undefined;\n}\n\nexport class CommitsGitSubProvider implements GitCommitsSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tgetCommit(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<GitCommit | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\t// Don't cache uncommitted-changes synthesis — it's date-sensitive\n\t\tif (isUncommitted(rev, true)) {\n\t\t\treturn (async () => {\n\t\t\t\treturn createUncommittedChangesCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\trev,\n\t\t\t\t\tnew Date(),\n\t\t\t\t\tawait this.provider.config.getCurrentUser(repoPath),\n\t\t\t\t);\n\t\t\t})();\n\t\t}\n\n\t\t// TODO: resolve symbolic refs (HEAD, branch names) to SHA before caching to avoid\n\t\t// short staleness windows. For now we cascade-clear on 'branch'/'branches'.\n\t\treturn this.cache.commit.getOrCreate(repoPath, stripOrigin(rev), async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\tconst commit = await github.getCommit(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(rev),\n\t\t\t\t);\n\t\t\t\tif (commit == null) return undefined;\n\n\t\t\t\tconst repoUri = coerceUri(repoPath);\n\n\t\t\t\tconst { viewer = session.account.label } = commit;\n\n\t\t\t\treturn new GitCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tcommit.oid,\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\tcommit.message,\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.files?.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t},\n\t\t\t\t\t[],\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tgetCommitCount(\n\t\trepoPath: string,\n\t\trev: string,\n\t\toptions?: { excluding?: GitRefExclusions },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<number | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\t\t// GitHub can't count against other refs, and a plain count would be the wrong answer\n\t\tif (options?.excluding != null) return Promise.resolve(undefined);\n\n\t\treturn this.cache.commitCount.getOrCreate(repoPath, stripOrigin(rev), async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\ttry {\n\t\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\t\tconst count = await github.getCommitCount(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(rev),\n\t\t\t\t);\n\n\t\t\t\treturn count;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getCommitFiles(repoPath: string, rev: string, _cancellation?: AbortSignal): Promise<GitFileChange[]> {\n\t\tif (rev === deletedOrMissing || isUncommitted(rev)) return [];\n\n\t\tconst commit = await this.getCommit(repoPath, rev);\n\t\treturn [...(commit?.fileset?.files ?? [])];\n\t}\n\n\t@debug()\n\tasync getCommitForFile(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev?: string | undefined,\n\t\t_options?: { firstIfNotFound?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitCommit | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\tconst rootUri = this.provider.getProviderRootUri(this.provider.getAbsoluteUri(pathOrUri, repoPath));\n\t\tconst file = this.provider.getRelativePath(this.provider.getAbsoluteUri(pathOrUri, repoPath), rootUri);\n\n\t\t// Resolve HEAD/empty rev to the metadata revision so the cache key is stable across callers\n\t\tconst resolvedRev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\t\t// Path-scoped variant lives in the same slot as `getCommit` but with a `|file` suffix to\n\t\t// keep it distinct from the unscoped commit entry.\n\t\tconst cacheKey = `${stripOrigin(resolvedRev)}|${file}`;\n\n\t\treturn this.cache.commit.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\ttry {\n\t\t\t\tconst commit = await github.getCommitForFile(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(resolvedRev),\n\t\t\t\t\tfile,\n\t\t\t\t);\n\t\t\t\tif (commit == null) return undefined;\n\n\t\t\t\tconst repoUri = coerceUri(repoPath);\n\t\t\t\tconst { viewer = session.account.label } = commit;\n\n\t\t\t\treturn new GitCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tcommit.oid,\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\tcommit.message,\n\t\t\t\t\tcommit.files != null\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tfiles: undefined,\n\t\t\t\t\t\t\t\tfiltered: {\n\t\t\t\t\t\t\t\t\tfiles: commit.files?.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t\t\t\t\tpathspec: file,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t},\n\t\t\t\t\t[],\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tgetLeftRightCommitCount(\n\t\trepoPath: string,\n\t\trange: GitRevisionRange,\n\t\t_options?: { authors?: GitUser[]; excludeMerges?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<LeftRightCommitCountResult | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\treturn this.cache.leftRightCommitCount.getOrCreate(repoPath, stripOrigin(range), async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\ttry {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstripOrigin(range),\n\t\t\t\t);\n\n\t\t\t\tif (result == null) return undefined;\n\n\t\t\t\treturn {\n\t\t\t\t\tleft: result.behind_by,\n\t\t\t\t\tright: result.ahead_by,\n\t\t\t\t};\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getLog(\n\t\trepoPath: string,\n\t\trev?: string | undefined,\n\t\toptions?: GitLogOptions,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitLog | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst limit = this.provider.getPagingLimit(options?.limit);\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\trev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\t\t\tconst result = await github.getCommits(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\tstripOrigin(rev),\n\t\t\t\t{\n\t\t\t\t\tall: options?.all,\n\t\t\t\t\tauthors: options?.authors,\n\t\t\t\t\tafter: options?.cursor,\n\t\t\t\t\tlimit: limit,\n\t\t\t\t\tsince: options?.since ? new Date(options.since) : undefined,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst commits = new Map<string, GitCommit>();\n\t\t\tconst repoUri = coerceUri(repoPath);\n\n\t\t\tconst { viewer = session.account.label } = result;\n\t\t\tfor (const commit of result.values) {\n\t\t\t\tlet c = commits.get(commit.oid);\n\t\t\t\tif (c == null) {\n\t\t\t\t\tc = new GitCommit(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tcommit.oid,\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\t\tcommit.message,\n\t\t\t\t\t\tcommit.files != null\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfiles: commit.files.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[],\n\t\t\t\t\t);\n\t\t\t\t\tcommits.set(commit.oid, c);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst log: GitLog = {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: rev,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: limit,\n\t\t\t\thasMore: result.paging?.more ?? false,\n\t\t\t\tendingCursor: result.paging?.cursor,\n\t\t\t\tquery: (limit: number | undefined) => this.getLog(repoPath, rev, { ...options, limit: limit }),\n\t\t\t};\n\n\t\t\tif (log.hasMore) {\n\t\t\t\tlog.more = this.getLogMoreFn(log, rev, options);\n\t\t\t}\n\n\t\t\treturn log;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate getLogMoreFn(\n\t\tlog: GitLog,\n\t\trev: string | undefined,\n\t\toptions?: GitLogOptions,\n\t): (limit: number | { until: string } | undefined) => Promise<GitLog> {\n\t\treturn async (limit: number | { until: string } | undefined) => {\n\t\t\tconst moreUntil = limit != null && typeof limit === 'object' ? limit.until : undefined;\n\t\t\tlet moreLimit = typeof limit === 'number' ? limit : undefined;\n\n\t\t\tif (moreUntil && some(log.commits.values(), c => c.ref === moreUntil)) {\n\t\t\t\treturn log;\n\t\t\t}\n\n\t\t\tmoreLimit = this.provider.getPagingLimit(moreLimit);\n\n\t\t\tconst moreLog = await this.getLog(log.repoPath, rev, {\n\t\t\t\t...options,\n\t\t\t\tlimit: moreLimit,\n\t\t\t\tcursor: log.endingCursor,\n\t\t\t});\n\t\t\t// If we can't find any more, assume we have everything\n\t\t\tif (moreLog == null) return { ...log, hasMore: false, more: undefined };\n\n\t\t\tconst commits = new Map([...log.commits, ...moreLog.commits]);\n\n\t\t\tconst mergedLog: GitLog = {\n\t\t\t\trepoPath: log.repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: log.sha,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: moreUntil == null ? (log.limit ?? 0) + moreLimit : undefined,\n\t\t\t\thasMore: moreUntil == null ? moreLog.hasMore : true,\n\t\t\t\t// The oldest commit SHA of the previous page — the graph webview compares this\n\t\t\t\t// against its last displayed row to determine the merge point for appending new rows\n\t\t\t\tstartingCursor: last(log.commits)?.[0],\n\t\t\t\tendingCursor: moreLog.endingCursor,\n\t\t\t\tpagedCommits: () => {\n\t\t\t\t\t// Remove any duplicates\n\t\t\t\t\tfor (const sha of log.commits.keys()) {\n\t\t\t\t\t\tmoreLog.commits.delete(sha);\n\t\t\t\t\t}\n\t\t\t\t\treturn moreLog.commits;\n\t\t\t\t},\n\t\t\t\tquery: log.query,\n\t\t\t};\n\t\t\tif (mergedLog.hasMore) {\n\t\t\t\tmergedLog.more = this.getLogMoreFn(mergedLog, rev, options);\n\t\t\t}\n\n\t\t\treturn mergedLog;\n\t\t};\n\t}\n\n\t@debug()\n\tasync getLogForPath(\n\t\trepoPath: string,\n\t\tpathOrUri: string | Uri,\n\t\trev?: string | undefined,\n\t\toptions?: GitLogForPathOptions,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitLog | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tlet relativePath = this.provider.getRelativePath(pathOrUri, repoPath);\n\n\t\tif (repoPath != null && repoPath === relativePath) {\n\t\t\tthrow new Error(`Path cannot match the repository path; path=${relativePath}`);\n\t\t}\n\n\t\toptions = {\n\t\t\t...options,\n\t\t\tall: false /* not supported */,\n\t\t\tlimit: this.provider.getPagingLimit(options?.limit),\n\t\t\trenames: false /* not supported */,\n\t\t};\n\n\t\tif (isFolderGlob(relativePath)) {\n\t\t\trelativePath = stripFolderGlob(relativePath);\n\t\t\toptions.isFolder = true;\n\t\t} else if (options.isFolder == null) {\n\t\t\tconst tree = await this.provider.revision.getTreeEntryForRevision(repoPath, relativePath, rev || 'HEAD');\n\t\t\toptions.isFolder = tree?.type === 'tree';\n\t\t}\n\n\t\t// Note: document caching (TrackedGitDocument) is handled by the extension wrapper.\n\t\t// The library implementation always fetches fresh data.\n\t\treturn this.getLogForPathCore(repoPath, relativePath, rev, options);\n\t}\n\n\tprivate async getLogForPathCore(\n\t\trepoPath: string,\n\t\tpath: string,\n\t\trev: string | undefined,\n\t\toptions: GitLogForPathOptions,\n\t): Promise<GitLog | undefined> {\n\t\tif (repoPath == null) return undefined;\n\n\t\tconst limit = this.provider.getPagingLimit(options.limit);\n\n\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\tif (context == null) return undefined;\n\n\t\tconst { metadata, github, session } = context;\n\n\t\tconst uri = this.provider.getAbsoluteUri(path, repoPath);\n\t\tconst relativePath = this.provider.getRelativePath(uri, this.provider.getProviderRootUri(uri));\n\n\t\trev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\t\tconst result = await github.getCommits(\n\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\tmetadata.repo.owner,\n\t\t\tmetadata.repo.name,\n\t\t\tstripOrigin(rev),\n\t\t\t{\n\t\t\t\tall: options.all,\n\t\t\t\tafter: options.cursor,\n\t\t\t\tpath: relativePath,\n\t\t\t\tlimit: limit,\n\t\t\t\tsince: options.since ? new Date(options.since) : undefined,\n\t\t\t},\n\t\t);\n\n\t\tconst repoUri = coerceUri(repoPath);\n\t\tconst commits = new Map<string, GitCommit>();\n\n\t\tconst { viewer = session.account.label } = result;\n\t\tfor (const commit of result.values) {\n\t\t\tlet c = commits.get(commit.oid);\n\t\t\tif (c == null) {\n\t\t\t\tconst files = commit.files?.map(f => toFileChange(repoUri, repoPath, f));\n\n\t\t\t\tif (files != null && !options.isFolder && commit.changedFiles === 1) {\n\t\t\t\t\tconst index = files.findIndex(f => f.path === relativePath);\n\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\tfiles.splice(\n\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\tnew GitFileChange(\n\t\t\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\t\t\trelativePath,\n\t\t\t\t\t\t\t\tGitFileIndexStatus.Modified,\n\t\t\t\t\t\t\t\tjoinUriPath(repoUri, normalizePath(relativePath)),\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\tcommit.changedFiles === 1\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t\t\t\t\t\t\tchanges: 0,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tc = new GitCommit(\n\t\t\t\t\trepoPath,\n\t\t\t\t\tcommit.oid,\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t),\n\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\tcommit.message,\n\t\t\t\t\t{ files: undefined, filtered: { files: files, pathspec: relativePath } },\n\t\t\t\t\t{\n\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t},\n\t\t\t\t\t[],\n\t\t\t\t);\n\t\t\t\tcommits.set(commit.oid, c);\n\t\t\t}\n\t\t}\n\n\t\tconst log: GitLog = {\n\t\t\trepoPath: repoPath,\n\t\t\tcommits: commits,\n\t\t\tsha: rev,\n\t\t\tcount: commits.size,\n\t\t\tlimit: limit,\n\t\t\thasMore: result.paging?.more ?? false,\n\t\t\tendingCursor: result.paging?.cursor,\n\t\t\tquery: (limit: number | undefined) => this.getLogForPath(repoPath, path, rev, { ...options, limit: limit }),\n\t\t};\n\t\tif (log.hasMore) {\n\t\t\tlog.more = this.getLogForPathMoreFn(log, path, rev, options);\n\t\t}\n\n\t\treturn log;\n\t}\n\n\tprivate getLogForPathMoreFn(\n\t\tlog: GitLog,\n\t\trelativePath: string,\n\t\trev: string | undefined,\n\t\toptions: GitLogForPathOptions,\n\t): (limit: number | { until: string } | undefined) => Promise<GitLog> {\n\t\treturn async (limit: number | { until: string } | undefined) => {\n\t\t\tconst moreUntil = limit != null && typeof limit === 'object' ? limit.until : undefined;\n\t\t\tlet moreLimit = typeof limit === 'number' ? limit : undefined;\n\n\t\t\tif (moreUntil && some(log.commits.values(), c => c.ref === moreUntil)) {\n\t\t\t\treturn log;\n\t\t\t}\n\n\t\t\tmoreLimit = this.provider.getPagingLimit(moreLimit);\n\n\t\t\tconst moreLog = await this.getLogForPath(log.repoPath, relativePath, rev, {\n\t\t\t\t...options,\n\t\t\t\tlimit: moreUntil == null ? moreLimit : 0,\n\t\t\t\tcursor: log.endingCursor,\n\t\t\t});\n\t\t\t// If we can't find any more, assume we have everything\n\t\t\tif (moreLog == null) return { ...log, hasMore: false, more: undefined };\n\n\t\t\tconst commits = new Map([...log.commits, ...moreLog.commits]);\n\n\t\t\tconst mergedLog: GitLog = {\n\t\t\t\trepoPath: log.repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: log.sha,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: moreUntil == null ? (log.limit ?? 0) + moreLimit : undefined,\n\t\t\t\thasMore: moreUntil == null ? moreLog.hasMore : true,\n\t\t\t\tendingCursor: moreLog.endingCursor,\n\t\t\t\tquery: log.query,\n\t\t\t};\n\n\t\t\tif (mergedLog.hasMore) {\n\t\t\t\tmergedLog.more = this.getLogForPathMoreFn(mergedLog, relativePath, rev, options);\n\t\t\t}\n\n\t\t\treturn mergedLog;\n\t\t};\n\t}\n\n\t@debug()\n\tasync getLogShas(\n\t\trepoPath: string,\n\t\trev?: string | undefined,\n\t\toptions?: GitLogShasOptions,\n\t\tcancellation?: AbortSignal,\n\t): Promise<Iterable<string>> {\n\t\tif (repoPath == null) return [];\n\t\t// GitHub can't evaluate `--not`, and an unfiltered list would be the wrong answer\n\t\tif (options?.excluding != null) return [];\n\n\t\tconst scope = getScopedLogger();\n\n\t\t// `authors` and `all` filters aren't supported by the lightweight SHA-only query;\n\t\t// fall back to the full log path when set.\n\t\tif (options?.authors?.length || options?.all) {\n\t\t\tlet log: GitLog | undefined;\n\t\t\tif (options?.pathOrUri != null) {\n\t\t\t\tlog = await this.getLogForPath(repoPath, options.pathOrUri, rev, options, cancellation);\n\t\t\t} else {\n\t\t\t\tlog = await this.getLog(repoPath, rev, options, cancellation);\n\t\t\t}\n\t\t\tif (log == null) return [];\n\n\t\t\tconst shas = map(log.commits.values(), c => c.ref);\n\t\t\t// Note: reversal only applies to the first page — subsequent pages loaded via pagination are not reversed\n\t\t\treturn options?.reverse ? [...shas].reverse() : shas;\n\t\t}\n\n\t\tconst limit = this.provider.getPagingLimit(options?.limit);\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\trev = !rev || rev === 'HEAD' ? (await metadata.getRevision()).revision : rev;\n\n\t\t\tlet path: string | undefined;\n\t\t\tif (options?.pathOrUri != null) {\n\t\t\t\tconst rootUri = this.provider.getProviderRootUri(\n\t\t\t\t\tthis.provider.getAbsoluteUri(options.pathOrUri, repoPath),\n\t\t\t\t);\n\t\t\t\tpath = this.provider.getRelativePath(\n\t\t\t\t\tthis.provider.getAbsoluteUri(options.pathOrUri, repoPath),\n\t\t\t\t\trootUri,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst strippedRev = stripOrigin(rev);\n\t\t\tconst sinceISO = options?.since ? new Date(options.since).toISOString() : '';\n\t\t\tconst cacheKey = `${strippedRev}|${path ?? ''}|${sinceISO}|${limit}|${options?.cursor ?? ''}`;\n\n\t\t\tconst shas = await this.cache.logShas.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\t\tconst result = await github.getCommitShas(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tstrippedRev,\n\t\t\t\t\t{\n\t\t\t\t\t\tafter: options?.cursor,\n\t\t\t\t\t\tlimit: limit,\n\t\t\t\t\t\tpath: path,\n\t\t\t\t\t\tsince: options?.since ? new Date(options.since) : undefined,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\treturn result.values;\n\t\t\t});\n\n\t\t\t// Note: reversal only applies to the first page — subsequent pages loaded via pagination are not reversed\n\t\t\treturn options?.reverse ? shas.toReversed() : shas;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t@debug()\n\tgetOldestUnpushedShaForPath(\n\t\t_repoPath: string,\n\t\t_pathOrUri: string | Uri,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\t// TODO@eamodio until we have access to the RemoteHub change store there isn't anything we can do here\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\t@debug()\n\thasCommitBeenPushed(_repoPath: string, _rev: string, _cancellation?: AbortSignal): Promise<boolean> {\n\t\t// In this env we can't have unpushed commits\n\t\treturn Promise.resolve(true);\n\t}\n\n\t@debug()\n\tasync isAncestorOf(repoPath: string, rev1: string, rev2: string, _cancellation?: AbortSignal): Promise<boolean> {\n\t\tif (repoPath == null) return false;\n\n\t\tconst scope = getScopedLogger();\n\n\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\ttry {\n\t\t\tconst result = await github.getComparison(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tmetadata.repo.owner,\n\t\t\t\tmetadata.repo.name,\n\t\t\t\tcreateRevisionRange(stripOrigin(rev1), stripOrigin(rev2), '...'),\n\t\t\t);\n\n\t\t\tswitch (result?.status) {\n\t\t\t\tcase 'ahead':\n\t\t\t\tcase 'diverged':\n\t\t\t\t\treturn false;\n\t\t\t\tcase 'identical':\n\t\t\t\tcase 'behind':\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t@debug({\n\t\targs: (repoPath, s) => ({\n\t\t\trepoPath: repoPath,\n\t\t\tsearch: `[${s.matchAll ? 'A' : ''}${s.matchCase ? 'C' : ''}${s.matchRegex ? 'R' : ''}${\n\t\t\t\ts.matchWholeWord ? 'W' : ''\n\t\t\t}]: ${s.query.length > 500 ? `${s.query.substring(0, 500)}...` : s.query}`,\n\t\t}),\n\t})\n\tasync searchCommits(\n\t\trepoPath: string,\n\t\tsearch: SearchQuery,\n\t\toptions?: GitSearchCommitsOptions,\n\t\tcancellation?: AbortSignal,\n\t): Promise<SearchCommitsResult> {\n\t\tif (repoPath == null) return { search: search, log: undefined };\n\n\t\tconst scope = getScopedLogger();\n\n\t\tsearch = { matchAll: false, matchCase: false, matchRegex: true, matchWholeWord: false, ...search };\n\t\t// Note: Natural language processing is handled by the extension wrapper.\n\n\t\tconst currentUser = search.query.includes('@me')\n\t\t\t? await this.provider.config.getCurrentUser(repoPath)\n\t\t\t: undefined;\n\t\tif (cancellation?.aborted) return { search: search, log: undefined };\n\n\t\tconst { args: queryArgs, operations } = parseSearchQueryGitHubCommand(search, currentUser);\n\n\t\tconst values = operations.get('commit:');\n\t\tif (values?.size) {\n\t\t\tconst commit = await this.getCommit(repoPath, first(values)!);\n\t\t\tif (commit == null) return { search: search, log: undefined };\n\n\t\t\treturn {\n\t\t\t\tsearch: search,\n\t\t\t\tlog: {\n\t\t\t\t\trepoPath: repoPath,\n\t\t\t\t\tcommits: new Map([[commit.sha, commit]]),\n\t\t\t\t\tsha: commit.sha,\n\t\t\t\t\tcount: 1,\n\t\t\t\t\tlimit: 1,\n\t\t\t\t\thasMore: false,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (!queryArgs.length) return { search: search, log: undefined };\n\n\t\tconst limit = this.provider.getPagingLimit(options?.limit);\n\n\t\ttry {\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\tconst query = `repo:${metadata.repo.owner}/${metadata.repo.name}+${queryArgs.join('+').trim()}`;\n\n\t\t\tconst result = await github.searchCommits(\n\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\tquery,\n\t\t\t\t{\n\t\t\t\t\tcursor: options?.cursor,\n\t\t\t\t\tlimit: limit,\n\t\t\t\t\tsort:\n\t\t\t\t\t\toptions?.ordering === 'date'\n\t\t\t\t\t\t\t? 'committer-date'\n\t\t\t\t\t\t\t: options?.ordering === 'author-date'\n\t\t\t\t\t\t\t\t? 'author-date'\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (result == null) return { search: search, log: undefined };\n\n\t\t\tconst commits = new Map<string, GitCommit>();\n\t\t\tconst repoUri = coerceUri(repoPath);\n\n\t\t\tconst viewer = session.account.label;\n\t\t\tfor (const commit of result.values) {\n\t\t\t\tlet c = commits.get(commit.oid);\n\t\t\t\tif (c == null) {\n\t\t\t\t\tc = new GitCommit(\n\t\t\t\t\t\trepoPath,\n\t\t\t\t\t\tcommit.oid,\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.author.name,\n\t\t\t\t\t\t\tcommit.author.email,\n\t\t\t\t\t\t\tnew Date(commit.author.date),\n\t\t\t\t\t\t\tcommit.author.avatarUrl,\n\t\t\t\t\t\t\tisViewer(commit.author.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnew GitCommitIdentity(\n\t\t\t\t\t\t\tcommit.committer.name,\n\t\t\t\t\t\t\tcommit.committer.email,\n\t\t\t\t\t\t\tnew Date(commit.committer.date),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tisViewer(commit.committer.name, viewer),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcommit.message.split('\\n', 1)[0],\n\t\t\t\t\t\tcommit.parents.nodes.map(p => p.oid),\n\t\t\t\t\t\tcommit.message,\n\t\t\t\t\t\tcommit.files != null\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfiles: commit.files.map(f => toFileChange(repoUri, repoPath, f)),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfiles: commit.changedFiles ?? 0,\n\t\t\t\t\t\t\tadditions: commit.additions ?? 0,\n\t\t\t\t\t\t\tdeletions: commit.deletions ?? 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[],\n\t\t\t\t\t);\n\t\t\t\t\tcommits.set(commit.oid, c);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst log: GitLog = {\n\t\t\t\trepoPath: repoPath,\n\t\t\t\tcommits: commits,\n\t\t\t\tsha: undefined,\n\t\t\t\tcount: commits.size,\n\t\t\t\tlimit: limit,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tendingCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t\tquery: (limit: number | undefined) =>\n\t\t\t\t\tthis.searchCommits(repoPath, search, { ...options, limit: limit }).then(r => r.log!),\n\t\t\t};\n\n\t\t\tif (log.hasMore) {\n\t\t\t\tconst searchCommitsCore = (log: GitLog): ((limit: number | undefined) => Promise<GitLog>) => {\n\t\t\t\t\treturn async (limit: number | undefined) => {\n\t\t\t\t\t\tlimit = this.provider.getPagingLimit(limit);\n\n\t\t\t\t\t\tconst moreLog = (\n\t\t\t\t\t\t\tawait this.searchCommits(log.repoPath, search, {\n\t\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t\t\tlimit: limit,\n\t\t\t\t\t\t\t\tcursor: log.endingCursor,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t).log;\n\t\t\t\t\t\t// If we can't find any more, assume we have everything\n\t\t\t\t\t\tif (moreLog == null) return { ...log, hasMore: false, more: undefined };\n\n\t\t\t\t\t\tconst commits = new Map([...log.commits, ...moreLog.commits]);\n\n\t\t\t\t\t\tconst mergedLog: GitLog = {\n\t\t\t\t\t\t\trepoPath: log.repoPath,\n\t\t\t\t\t\t\tcommits: commits,\n\t\t\t\t\t\t\tsha: log.sha,\n\t\t\t\t\t\t\tcount: commits.size,\n\t\t\t\t\t\t\tlimit: (log.limit ?? 0) + limit,\n\t\t\t\t\t\t\thasMore: moreLog.hasMore,\n\t\t\t\t\t\t\tendingCursor: moreLog.endingCursor,\n\t\t\t\t\t\t\tquery: log.query,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (mergedLog.hasMore) {\n\t\t\t\t\t\t\tmergedLog.more = searchCommitsCore(mergedLog);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn mergedLog;\n\t\t\t\t\t};\n\t\t\t\t};\n\n\t\t\t\tlog.more = searchCommitsCore(log);\n\t\t\t}\n\n\t\t\treturn { search: search, log: log };\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\tdebugger;\n\t\t\treturn { search: search, log: undefined };\n\t\t}\n\t}\n}\n\n/** Converts a GitHub API file entry to a library GitFileChange */\nfunction toFileChange(repoUri: Uri, repoPath: string, f: NonNullable<GitHubCommit['files']>[0]): GitFileChange {\n\tconst path = f.filename ?? '';\n\treturn new GitFileChange(\n\t\trepoPath,\n\t\tpath,\n\t\tfromCommitFileStatus(f.status) ?? GitFileIndexStatus.Modified,\n\t\tjoinUriPath(repoUri, normalizePath(path)),\n\t\tf.previous_filename,\n\t\tf.previous_filename != null ? joinUriPath(repoUri, normalizePath(f.previous_filename)) : undefined,\n\t\tundefined,\n\t\t{\n\t\t\tadditions: f.additions ?? 0,\n\t\t\tdeletions: f.deletions ?? 0,\n\t\t\tchanges: f.changes ?? 0,\n\t\t},\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAAS,SAAS,MAAc,QAAiD;CAChF,OAAQ,UAAU,QAAQ,SAAS,UAAW,KAAA;AAC/C;AAEA,IAAa,wBAAb,MAAoE;CAEjD;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,UACU,UAAkB,KAAa,eAA6D;EACrG,IAAI,YAAY,MAAM,OAAO,QAAQ,QAAQ,KAAA,CAAS;EAGtD,IAAI,cAAc,KAAK,IAAI,GAC1B,QAAQ,YAAY;GACnB,OAAO,+BACN,UACA,qBACA,IAAI,KAAK,GACT,MAAM,KAAK,SAAS,OAAO,eAAe,QAAQ,CACnD;EACD,EAAA,CAAG;EAKJ,OAAO,KAAK,MAAM,OAAO,YAAY,UAAU,YAAY,GAAG,GAAG,YAAY;GAC5E,MAAM,QAAQ,gBAAgB;GAE9B,IAAI;IACH,MAAM,EAAE,UAAU,QAAQ,YAAY,MAAM,KAAK,SAAS,wBAAwB,QAAQ;IAE1F,MAAM,SAAS,MAAM,OAAO,UAC3B,YAAY,KAAK,SAAS,0BAA0B,OAAO,GAC3D,SAAS,KAAK,OACd,SAAS,KAAK,MACd,YAAY,GAAG,CAChB;IACA,IAAI,UAAU,MAAM,OAAO,KAAA;IAE3B,MAAM,UAAU,UAAU,QAAQ;IAElC,MAAM,EAAE,SAAS,QAAQ,QAAQ,UAAU;IAE3C,OAAO,IAAI,UACV,UACA,OAAO,KACP,IAAI,kBACH,OAAO,OAAO,MACd,OAAO,OAAO,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AA,sBAAA,WAAA,cAAA,IAAA;AA4EN,WAAA,CAAA,MAAM,CAAA,GAAA,sBAAA,WAAA,+BAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,sBAAA,WAAA,uBAAA,IAAA;AAMN,WAAA,CAAA,MAAM,CAAA,GAAA,sBAAA,WAAA,gBAAA,IAAA;AAiCN,WAAA,CAAA,MAAM,EACN,OAAO,UAAU,OAAO;CACb;CACV,QAAQ,IAAI,EAAE,WAAW,MAAM,KAAK,EAAE,YAAY,MAAM,KAAK,EAAE,aAAa,MAAM,KACjF,EAAE,iBAAiB,MAAM,GACzB,KAAK,EAAE,MAAM,SAAS,MAAM,GAAG,EAAE,MAAM,UAAU,GAAG,GAAG,EAAE,OAAO,EAAE;AACpE,GACD,CAAC,CAAA,GAAA,sBAAA,WAAA,iBAAA,IAAA;;AAuKF,SAAS,aAAa,SAAc,UAAkB,GAAyD;CAC9G,MAAM,OAAO,EAAE,YAAY;CAC3B,OAAO,IAAI,cACV,UACA,MACA,qBAAqB,EAAE,MAAM,KAAK,mBAAmB,UACrD,YAAY,SAAS,cAAc,IAAI,CAAC,GACxC,EAAE,mBACF,EAAE,qBAAqB,OAAO,YAAY,SAAS,cAAc,EAAE,iBAAiB,CAAC,IAAI,KAAA,GACzF,KAAA,GACA;EACC,WAAW,EAAE,aAAa;EAC1B,WAAW,EAAE,aAAa;EAC1B,SAAS,EAAE,WAAW;CACvB,CACD;AACD"}
|
|
@@ -15,7 +15,9 @@ export declare class RefsGitSubProvider implements GitRefsSubProvider {
|
|
|
15
15
|
forkPoint?: boolean;
|
|
16
16
|
priority?: GitCommandPriority;
|
|
17
17
|
}, _cancellation?: AbortSignal): Promise<string | undefined>;
|
|
18
|
-
getReference(repoPath: string, ref: string,
|
|
18
|
+
getReference(repoPath: string, ref: string, options?: {
|
|
19
|
+
force?: boolean;
|
|
20
|
+
}, _cancellation?: AbortSignal): Promise<GitReference | undefined>;
|
|
19
21
|
getRefTips(_repoPath: string, _options?: {
|
|
20
22
|
include?: ReadonlyArray<'heads' | 'remotes' | 'tags'>;
|
|
21
23
|
}, _cancellation?: AbortSignal): Promise<GitRefTip[]>;
|
|
@@ -29,8 +31,13 @@ export declare class RefsGitSubProvider implements GitRefsSubProvider {
|
|
|
29
31
|
};
|
|
30
32
|
}, cancellation?: AbortSignal): Promise<boolean>;
|
|
31
33
|
isValidReference(_repoPath: string, _ref: string, _pathOrUri?: string, _cancellation?: AbortSignal): Promise<boolean>;
|
|
32
|
-
validateReference(_repoPath: string, ref: string,
|
|
33
|
-
|
|
34
|
+
validateReference(_repoPath: string, ref: string, _options?: {
|
|
35
|
+
relativePath?: string;
|
|
36
|
+
force?: boolean;
|
|
37
|
+
}, _cancellation?: AbortSignal): Promise<string | undefined>;
|
|
38
|
+
updateReference(_repoPath: string, _ref: string, _sha: string, _options?: {
|
|
39
|
+
expected?: string | 'absent';
|
|
40
|
+
}, _cancellation?: AbortSignal): Promise<void>;
|
|
34
41
|
}
|
|
35
42
|
//#endregion
|
|
36
43
|
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -36,11 +36,11 @@ var RefsGitSubProvider = class {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
async getReference(repoPath, ref, _cancellation) {
|
|
39
|
+
async getReference(repoPath, ref, options, _cancellation) {
|
|
40
40
|
if (!ref || ref === "0000000000000000000000000000000000000000-") return void 0;
|
|
41
41
|
if (!await this.isValidReference(repoPath, ref)) return void 0;
|
|
42
42
|
if (ref !== "HEAD" && !isShaWithOptionalRevisionSuffix(ref)) {
|
|
43
|
-
const branch = await this.provider.branches.getBranch(repoPath, ref);
|
|
43
|
+
const branch = await this.provider.branches.getBranch(repoPath, ref, options?.force ? { force: true } : void 0);
|
|
44
44
|
if (branch != null) return createReference(branch.ref, repoPath, {
|
|
45
45
|
id: branch.id,
|
|
46
46
|
refType: "branch",
|
|
@@ -77,10 +77,10 @@ var RefsGitSubProvider = class {
|
|
|
77
77
|
isValidReference(_repoPath, _ref, _pathOrUri, _cancellation) {
|
|
78
78
|
return Promise.resolve(true);
|
|
79
79
|
}
|
|
80
|
-
validateReference(_repoPath, ref,
|
|
80
|
+
validateReference(_repoPath, ref, _options, _cancellation) {
|
|
81
81
|
return Promise.resolve(ref);
|
|
82
82
|
}
|
|
83
|
-
updateReference(_repoPath, _ref,
|
|
83
|
+
updateReference(_repoPath, _ref, _sha, _options, _cancellation) {
|
|
84
84
|
return Promise.resolve();
|
|
85
85
|
}
|
|
86
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/refs.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { GitReference, GitRefTip } from '@gitlens/git/models/reference.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTag } from '@gitlens/git/models/tag.js';\nimport type { GitRefsSubProvider } from '@gitlens/git/providers/refs.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createReference } from '@gitlens/git/utils/reference.utils.js';\nimport {\n\tcreateRevisionRange,\n\tisShaWithOptionalRevisionSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\n// Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(?<!\\.lock)` to ensure the branch name doesn't end with `.lock`\n// oxlint-disable-next-line no-control-regex\nconst validBranchOrTagRegex = /^[^/](?!.*\\/\\.)(?!.*\\.\\.)(?!.*\\/\\/)(?!.*@\\{)[^\\x00-\\x1F\\x7F ~^:?*[\\\\]+[^./]$/;\n\nexport class RefsGitSubProvider implements GitRefsSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tcheckIfCouldBeValidBranchOrTagName(_repoPath: string, ref: string): Promise<boolean> {\n\t\treturn Promise.resolve(validBranchOrTagRegex.test(ref));\n\t}\n\n\t@debug()\n\tgetMergeBase(\n\t\trepoPath: string,\n\t\tref1: string,\n\t\tref2: string,\n\t\t_options?: { forkPoint?: boolean; priority?: GitCommandPriority },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\tconst a = stripOrigin(ref1);\n\t\tconst b = stripOrigin(ref2);\n\t\t// `merge-base` is symmetric, so normalize ref order in the cache key to coalesce\n\t\t// `(A, B)` and `(B, A)` lookups onto a single entry.\n\t\tconst [left, right] = a < b ? [a, b] : [b, a];\n\t\tconst cacheKey = `${left}...${right}`;\n\t\tconst queryRange = createRevisionRange(a, b, '...');\n\n\t\treturn this.cache.mergeBase.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\ttry {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tqueryRange,\n\t\t\t\t);\n\t\t\t\treturn result?.merge_base_commit?.sha;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getReference(
|
|
1
|
+
{"version":3,"file":"refs.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/refs.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitBranch } from '@gitlens/git/models/branch.js';\nimport type { GitReference, GitRefTip } from '@gitlens/git/models/reference.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTag } from '@gitlens/git/models/tag.js';\nimport type { GitRefsSubProvider } from '@gitlens/git/providers/refs.js';\nimport type { GitCommandPriority } from '@gitlens/git/run.types.js';\nimport { createReference } from '@gitlens/git/utils/reference.utils.js';\nimport {\n\tcreateRevisionRange,\n\tisShaWithOptionalRevisionSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\n// Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(?<!\\.lock)` to ensure the branch name doesn't end with `.lock`\n// oxlint-disable-next-line no-control-regex\nconst validBranchOrTagRegex = /^[^/](?!.*\\/\\.)(?!.*\\.\\.)(?!.*\\/\\/)(?!.*@\\{)[^\\x00-\\x1F\\x7F ~^:?*[\\\\]+[^./]$/;\n\nexport class RefsGitSubProvider implements GitRefsSubProvider {\n\tconstructor(\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: GitHubGitProviderInternal,\n\t) {}\n\n\t@debug()\n\tcheckIfCouldBeValidBranchOrTagName(_repoPath: string, ref: string): Promise<boolean> {\n\t\treturn Promise.resolve(validBranchOrTagRegex.test(ref));\n\t}\n\n\t@debug()\n\tgetMergeBase(\n\t\trepoPath: string,\n\t\tref1: string,\n\t\tref2: string,\n\t\t_options?: { forkPoint?: boolean; priority?: GitCommandPriority },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\tif (repoPath == null) return Promise.resolve(undefined);\n\n\t\tconst a = stripOrigin(ref1);\n\t\tconst b = stripOrigin(ref2);\n\t\t// `merge-base` is symmetric, so normalize ref order in the cache key to coalesce\n\t\t// `(A, B)` and `(B, A)` lookups onto a single entry.\n\t\tconst [left, right] = a < b ? [a, b] : [b, a];\n\t\tconst cacheKey = `${left}...${right}`;\n\t\tconst queryRange = createRevisionRange(a, b, '...');\n\n\t\treturn this.cache.mergeBase.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst scope = getScopedLogger();\n\n\t\t\tconst { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);\n\n\t\t\ttry {\n\t\t\t\tconst result = await github.getComparison(\n\t\t\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\t\t\tmetadata.repo.owner,\n\t\t\t\t\tmetadata.repo.name,\n\t\t\t\t\tqueryRange,\n\t\t\t\t);\n\t\t\t\treturn result?.merge_base_commit?.sha;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\tdebugger;\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t});\n\t}\n\n\t@debug()\n\tasync getReference(\n\t\trepoPath: string,\n\t\tref: string,\n\t\toptions?: { force?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitReference | undefined> {\n\t\tif (!ref || ref === deletedOrMissing) return undefined;\n\n\t\tif (!(await this.isValidReference(repoPath, ref))) return undefined;\n\n\t\tif (ref !== 'HEAD' && !isShaWithOptionalRevisionSuffix(ref)) {\n\t\t\tconst branch = await this.provider.branches.getBranch(\n\t\t\t\trepoPath,\n\t\t\t\tref,\n\t\t\t\toptions?.force ? { force: true } : undefined,\n\t\t\t);\n\t\t\tif (branch != null) {\n\t\t\t\treturn createReference(branch.ref, repoPath, {\n\t\t\t\t\tid: branch.id,\n\t\t\t\t\trefType: 'branch',\n\t\t\t\t\tname: branch.name,\n\t\t\t\t\tremote: branch.remote,\n\t\t\t\t\tupstream: branch.upstream,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst tag = await this.provider.tags.getTag(repoPath, ref);\n\t\t\tif (tag != null) {\n\t\t\t\treturn createReference(tag.ref, repoPath, {\n\t\t\t\t\tid: tag.id,\n\t\t\t\t\trefType: 'tag',\n\t\t\t\t\tname: tag.name,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn createReference(ref, repoPath, { refType: 'revision' });\n\t}\n\n\t@debug()\n\tgetRefTips(\n\t\t_repoPath: string,\n\t\t_options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<GitRefTip[]> {\n\t\t// Not implemented for GitHub virtual repos — current consumers (timeline slice-by-branch)\n\t\t// gate this off via `!repo.virtual`. A future implementation can use GraphQL `refs` /\n\t\t// `commit.associatedRefs`.\n\t\treturn Promise.resolve([]);\n\t}\n\n\t@debug()\n\tgetRefsContainingShas(\n\t\t_repoPath: string,\n\t\t_shas: ReadonlySet<string> | readonly string[],\n\t\t_oldestSha: string,\n\t\t_options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<Map<string, GitRefTip[]>> {\n\t\t// See `getRefTips` — gated off for virtual repos until GraphQL `commit.associatedRefs` lands.\n\t\treturn Promise.resolve(new Map<string, GitRefTip[]>());\n\t}\n\n\t@debug()\n\tasync hasBranchOrTag(\n\t\trepoPath: string | undefined,\n\t\toptions?: { filter?: { branches?: (b: GitBranch) => boolean; tags?: (t: GitTag) => boolean } },\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tif (repoPath == null) return false;\n\n\t\tconst [{ values: branches }, { values: tags }] = await Promise.all([\n\t\t\tthis.provider.branches.getBranches(\n\t\t\t\trepoPath,\n\t\t\t\t{ filter: options?.filter?.branches, sort: false },\n\t\t\t\tcancellation,\n\t\t\t),\n\t\t\tthis.provider.tags.getTags(repoPath, { filter: options?.filter?.tags, sort: false }, cancellation),\n\t\t]);\n\n\t\treturn branches.length !== 0 || tags.length !== 0;\n\t}\n\n\t@debug()\n\tisValidReference(\n\t\t_repoPath: string,\n\t\t_ref: string,\n\t\t_pathOrUri?: string,\n\t\t_cancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\treturn Promise.resolve(true);\n\t}\n\n\t@debug()\n\tvalidateReference(\n\t\t_repoPath: string,\n\t\tref: string,\n\t\t_options?: { relativePath?: string; force?: boolean },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<string | undefined> {\n\t\treturn Promise.resolve(ref);\n\t}\n\n\t@debug()\n\tupdateReference(\n\t\t_repoPath: string,\n\t\t_ref: string,\n\t\t_sha: string,\n\t\t_options?: { expected?: string | 'absent' },\n\t\t_cancellation?: AbortSignal,\n\t): Promise<void> {\n\t\treturn Promise.resolve();\n\t}\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,wBAAwB;AAE9B,IAAa,qBAAb,MAA8D;CAE3C;CACA;CAFlB,YACC,OACA,UACC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,mCACmC,WAAmB,KAA+B;EACpF,OAAO,QAAQ,QAAQ,sBAAsB,KAAK,GAAG,CAAC;CACvD;CAEA,aAEC,UACA,MACA,MACA,UACA,eAC8B;EAC9B,IAAI,YAAY,MAAM,OAAO,QAAQ,QAAQ,KAAA,CAAS;EAEtD,MAAM,IAAI,YAAY,IAAI;EAC1B,MAAM,IAAI,YAAY,IAAI;EAG1B,MAAM,CAAC,MAAM,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;EAC5C,MAAM,WAAW,GAAG,KAAK,KAAK;EAC9B,MAAM,aAAa,oBAAoB,GAAG,GAAG,KAAK;EAElD,OAAO,KAAK,MAAM,UAAU,YAAY,UAAU,UAAU,YAAY;GACvE,MAAM,QAAQ,gBAAgB;GAE9B,MAAM,EAAE,UAAU,QAAQ,YAAY,MAAM,KAAK,SAAS,wBAAwB,QAAQ;GAE1F,IAAI;IAOH,QAAO,MANc,OAAO,cAC3B,YAAY,KAAK,SAAS,0BAA0B,OAAO,GAC3D,SAAS,KAAK,OACd,SAAS,KAAK,MACd,UACD,EAAA,EACe,mBAAmB;GACnC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;GAAM,MAAM;EAAM,GAAG,YAAY,CAClG,CAAC;EAED,OAAO,SAAS,WAAW,KAAK,KAAK,WAAW;CACjD;CAEA,iBAEC,WACA,MACA,YACA,eACmB;EACnB,OAAO,QAAQ,QAAQ,IAAI;CAC5B;CAEA,kBAEC,WACA,KACA,UACA,eAC8B;EAC9B,OAAO,QAAQ,QAAQ,GAAG;CAC3B;CAEA,gBAEC,WACA,MACA,MACA,UACA,eACgB;EAChB,OAAO,QAAQ,QAAQ;CACxB;AACD;AA9JE,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,sCAAA,IAAA;AAKN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,gBAAA,IAAA;AAuCN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,gBAAA,IAAA;AAwCN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,cAAA,IAAA;AAYN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,yBAAA,IAAA;AAYN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,kBAAA,IAAA;AAoBN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,oBAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,qBAAA,IAAA;AAUN,WAAA,CAAA,MAAM,CAAA,GAAA,mBAAA,WAAA,mBAAA,IAAA"}
|
|
@@ -6,11 +6,14 @@ import { GitHubGitProviderInternal } from "../githubProvider.js";
|
|
|
6
6
|
export declare class RevisionGitSubProvider implements GitRevisionSubProvider {
|
|
7
7
|
private readonly provider;
|
|
8
8
|
constructor(provider: GitHubGitProviderInternal);
|
|
9
|
+
getEmptyTreeSha(_repoPath: string): Promise<string>;
|
|
9
10
|
getRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined>;
|
|
10
11
|
getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined>;
|
|
11
12
|
getTrackedFiles(repoPath: string): Promise<string[]>;
|
|
12
13
|
getTreeForRevision(repoPath: string, rev: string): Promise<GitTreeEntry[]>;
|
|
13
|
-
resolveRevision(repoPath: string, ref: string, pathOrUri?: string | Uri
|
|
14
|
+
resolveRevision(repoPath: string, ref: string, pathOrUri?: string | Uri, _options?: {
|
|
15
|
+
force?: boolean;
|
|
16
|
+
}): Promise<ResolvedRevision>;
|
|
14
17
|
}
|
|
15
18
|
//#endregion
|
|
16
19
|
//# sourceMappingURL=revision.d.ts.map
|
|
@@ -6,11 +6,16 @@ import { FileType } from "../../../../git/context.js";
|
|
|
6
6
|
import { gate } from "../../../../utils/decorators/gate.js";
|
|
7
7
|
import { toTokenInfo } from "../../api/tokenUtils.js";
|
|
8
8
|
//#region ../plus/git-github/src/providers/github/revision.ts
|
|
9
|
+
/** GitHub repositories are always SHA-1 */
|
|
10
|
+
const sha1EmptyTreeSha = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
9
11
|
var RevisionGitSubProvider = class {
|
|
10
12
|
provider;
|
|
11
13
|
constructor(provider) {
|
|
12
14
|
this.provider = provider;
|
|
13
15
|
}
|
|
16
|
+
getEmptyTreeSha(_repoPath) {
|
|
17
|
+
return Promise.resolve(sha1EmptyTreeSha);
|
|
18
|
+
}
|
|
14
19
|
getRevisionContent(repoPath, path, rev) {
|
|
15
20
|
const uri = rev ? this.provider.createProviderUri(repoPath, rev, path) : this.provider.createVirtualUri(repoPath, rev, path);
|
|
16
21
|
return this.provider.context.fs.readFile(uri);
|
|
@@ -57,7 +62,7 @@ var RevisionGitSubProvider = class {
|
|
|
57
62
|
});
|
|
58
63
|
return result;
|
|
59
64
|
}
|
|
60
|
-
async resolveRevision(repoPath, ref, pathOrUri) {
|
|
65
|
+
async resolveRevision(repoPath, ref, pathOrUri, _options) {
|
|
61
66
|
if (!ref || ref === "0000000000000000000000000000000000000000-") return {
|
|
62
67
|
sha: ref,
|
|
63
68
|
revision: ref
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revision.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/revision.ts"],"sourcesContent":["import { FileType } from '@gitlens/git/context.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTreeEntry } from '@gitlens/git/models/tree.js';\nimport type { GitRevisionSubProvider, ResolvedRevision } from '@gitlens/git/providers/revision.js';\nimport {\n\tisRevisionWithSuffix,\n\tisSha,\n\tisUncommitted,\n\tisUncommittedWithParentSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\nexport class RevisionGitSubProvider implements GitRevisionSubProvider {\n\tconstructor(private readonly provider: GitHubGitProviderInternal) {}\n\n\t@gate()\n\t@debug()\n\tgetRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined> {\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\treturn this.provider.context.fs.readFile(uri);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined> {\n\t\tif (repoPath == null || !path) return undefined;\n\n\t\tif (path) {\n\t\t\tpath = this.provider.getRelativePath(path, repoPath);\n\t\t}\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\tconst stats = await this.provider.context.fs.stat(uri);\n\t\tif (stats == null) return undefined;\n\n\t\treturn {\n\t\t\tref: rev,\n\t\t\toid: '',\n\t\t\tpath: this.provider.getRelativePath(uri, repoPath),\n\t\t\tsize: stats.size,\n\t\t\ttype: (stats.type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t};\n\t}\n\n\t@debug()\n\tasync getTrackedFiles(repoPath: string): Promise<string[]> {\n\t\tconst tree = await this.getTreeForRevision(repoPath, 'HEAD');\n\t\treturn tree.filter(f => f.type === 'blob').map(f => f.path);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeForRevision(repoPath: string, rev: string): Promise<GitTreeEntry[]> {\n\t\tif (repoPath == null) return [];\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return [];\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst baseUri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev);\n\n\t\tconst entries = await this.provider.context.fs.readDirectory(baseUri);\n\t\tif (entries == null) return [];\n\n\t\tconst result: GitTreeEntry[] = [];\n\t\tfor (const [path, type] of entries) {\n\t\t\tresult.push({\n\t\t\t\tref: rev,\n\t\t\t\toid: '',\n\t\t\t\tpath: path,\n\t\t\t\tsize: 0,\n\t\t\t\ttype: (type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync resolveRevision(
|
|
1
|
+
{"version":3,"file":"revision.js","names":[],"sources":["../../../../../../plus/git-github/src/providers/github/revision.ts"],"sourcesContent":["import { FileType } from '@gitlens/git/context.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTreeEntry } from '@gitlens/git/models/tree.js';\nimport type { GitRevisionSubProvider, ResolvedRevision } from '@gitlens/git/providers/revision.js';\nimport {\n\tisRevisionWithSuffix,\n\tisSha,\n\tisUncommitted,\n\tisUncommittedWithParentSuffix,\n\tstripOrigin,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toTokenInfo } from '../../api/tokenUtils.js';\nimport type { GitHubGitProviderInternal } from '../githubProvider.js';\n\n/** GitHub repositories are always SHA-1 */\nconst sha1EmptyTreeSha = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';\n\nexport class RevisionGitSubProvider implements GitRevisionSubProvider {\n\tconstructor(private readonly provider: GitHubGitProviderInternal) {}\n\n\tgetEmptyTreeSha(_repoPath: string): Promise<string> {\n\t\treturn Promise.resolve(sha1EmptyTreeSha);\n\t}\n\n\t@gate()\n\t@debug()\n\tgetRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined> {\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\treturn this.provider.context.fs.readFile(uri);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined> {\n\t\tif (repoPath == null || !path) return undefined;\n\n\t\tif (path) {\n\t\t\tpath = this.provider.getRelativePath(path, repoPath);\n\t\t}\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return undefined;\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst uri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev, path)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev, path);\n\n\t\tconst stats = await this.provider.context.fs.stat(uri);\n\t\tif (stats == null) return undefined;\n\n\t\treturn {\n\t\t\tref: rev,\n\t\t\toid: '',\n\t\t\tpath: this.provider.getRelativePath(uri, repoPath),\n\t\t\tsize: stats.size,\n\t\t\ttype: (stats.type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t};\n\t}\n\n\t@debug()\n\tasync getTrackedFiles(repoPath: string): Promise<string[]> {\n\t\tconst tree = await this.getTreeForRevision(repoPath, 'HEAD');\n\t\treturn tree.filter(f => f.type === 'blob').map(f => f.path);\n\t}\n\n\t@gate()\n\t@debug()\n\tasync getTreeForRevision(repoPath: string, rev: string): Promise<GitTreeEntry[]> {\n\t\tif (repoPath == null) return [];\n\n\t\tif (rev === 'HEAD') {\n\t\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\t\tif (context == null) return [];\n\n\t\t\tconst revision = await context.metadata.getRevision();\n\t\t\trev = revision?.revision;\n\t\t}\n\n\t\tconst baseUri = rev\n\t\t\t? this.provider.createProviderUri(repoPath, rev)\n\t\t\t: this.provider.createVirtualUri(repoPath, rev);\n\n\t\tconst entries = await this.provider.context.fs.readDirectory(baseUri);\n\t\tif (entries == null) return [];\n\n\t\tconst result: GitTreeEntry[] = [];\n\t\tfor (const [path, type] of entries) {\n\t\t\tresult.push({\n\t\t\t\tref: rev,\n\t\t\t\toid: '',\n\t\t\t\tpath: path,\n\t\t\t\tsize: 0,\n\t\t\t\ttype: (type & FileType.Directory) !== 0 ? 'tree' : 'blob',\n\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t@debug()\n\tasync resolveRevision(\n\t\trepoPath: string,\n\t\tref: string,\n\t\tpathOrUri?: string | Uri,\n\t\t// Nothing to force here — every call resolves fresh from the GitHub API; there is no cache to bypass.\n\t\t_options?: { force?: boolean },\n\t): Promise<ResolvedRevision> {\n\t\tif (!ref || ref === deletedOrMissing) return { sha: ref, revision: ref };\n\n\t\tlet relativePath;\n\t\tif (pathOrUri == null) {\n\t\t\tif (isSha(ref)) return { sha: ref, revision: ref };\n\t\t\tif (ref.endsWith('^3')) return { sha: ref, revision: ref };\n\t\t} else {\n\t\t\tif (isUncommittedWithParentSuffix(ref)) {\n\t\t\t\tref = 'HEAD';\n\t\t\t}\n\t\t\tif (isUncommitted(ref)) return { sha: ref, revision: ref };\n\n\t\t\trelativePath = this.provider.getRelativePath(pathOrUri, repoPath);\n\t\t}\n\n\t\tconst context = await this.provider.ensureRepositoryContext(repoPath);\n\t\tif (context == null) return { sha: ref, revision: ref };\n\n\t\tconst { metadata, github, session } = context;\n\n\t\tconst sha = await github.resolveReference(\n\t\t\ttoTokenInfo(this.provider.authenticationProviderId, session),\n\t\t\tmetadata.repo.owner,\n\t\t\tmetadata.repo.name,\n\t\t\tstripOrigin(ref),\n\t\t\trelativePath,\n\t\t);\n\n\t\tif (sha == null) {\n\t\t\treturn { sha: relativePath ? deletedOrMissing : ref, revision: ref };\n\t\t}\n\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\treturn { sha: sha, revision: isRevisionWithSuffix(ref) ? sha : ref };\n\t}\n}\n"],"mappings":";;;;;;;;;AAkBA,MAAM,mBAAmB;AAEzB,IAAa,yBAAb,MAAsE;CACxC;CAA7B,YAAY,UAAsD;EAArC,KAAA,WAAA;CAAsC;CAEnE,gBAAgB,WAAoC;EACnD,OAAO,QAAQ,QAAQ,gBAAgB;CACxC;CAEA,mBAEmB,UAAkB,MAAc,KAA8C;EAChG,MAAM,MAAM,MACT,KAAK,SAAS,kBAAkB,UAAU,KAAK,IAAI,IACnD,KAAK,SAAS,iBAAiB,UAAU,KAAK,IAAI;EAErD,OAAO,KAAK,SAAS,QAAQ,GAAG,SAAS,GAAG;CAC7C;CAEA,MAEM,wBAAwB,UAAkB,MAAc,KAAgD;EAC7G,IAAI,YAAY,QAAQ,CAAC,MAAM,OAAO,KAAA;EAEtC,IAAI,MACH,OAAO,KAAK,SAAS,gBAAgB,MAAM,QAAQ;EAGpD,IAAI,QAAQ,QAAQ;GACnB,MAAM,UAAU,MAAM,KAAK,SAAS,wBAAwB,QAAQ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