@gitkraken/core-gitlens 0.58.0 → 0.60.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/git/context.d.ts +1 -0
  3. package/dist/git/context.js.map +1 -1
  4. package/dist/git/features.d.ts +1 -1
  5. package/dist/git/features.js +1 -0
  6. package/dist/git/features.js.map +1 -1
  7. package/dist/git/models/graph.d.ts +2 -1
  8. package/dist/git/models/graph.js.map +1 -1
  9. package/dist/git/models/graphSession.d.ts +8 -0
  10. package/dist/git/models/graphSession.js.map +1 -1
  11. package/dist/git/parsers/diffParser.js +1 -1
  12. package/dist/git/utils/hiddenRefs.utils.d.ts +26 -0
  13. package/dist/git/utils/hiddenRefs.utils.js +89 -0
  14. package/dist/git/utils/hiddenRefs.utils.js.map +1 -0
  15. package/dist/git/utils/search.utils.d.ts +3 -1
  16. package/dist/git/utils/search.utils.js +3 -1
  17. package/dist/git/utils/search.utils.js.map +1 -1
  18. package/dist/git-cli/exec/git.js +2 -1
  19. package/dist/git-cli/exec/git.js.map +1 -1
  20. package/dist/git-cli/exec/locator.d.ts +2 -1
  21. package/dist/git-cli/exec/locator.js +11 -3
  22. package/dist/git-cli/exec/locator.js.map +1 -1
  23. package/dist/git-cli/parsers/blameParser.js +1 -1
  24. package/dist/git-cli/parsers/indexParser.js +1 -1
  25. package/dist/git-cli/parsers/statusParser.js +1 -1
  26. package/dist/git-cli/providers/branches.js +1 -1
  27. package/dist/git-cli/providers/commits.js +3 -2
  28. package/dist/git-cli/providers/commits.js.map +1 -1
  29. package/dist/git-cli/providers/config.js +2 -2
  30. package/dist/git-cli/providers/graph.d.ts +11 -1
  31. package/dist/git-cli/providers/graph.js +156 -38
  32. package/dist/git-cli/providers/graph.js.map +1 -1
  33. package/dist/git-cli/providers/pausedOperations.js +2 -2
  34. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  35. package/dist/git-cli/providers/refs.js +1 -1
  36. package/dist/git-cli/providers/staging.js +1 -1
  37. package/dist/git-cli/providers/tags.js +1 -1
  38. package/dist/git-cli/service.js +1 -1
  39. package/dist/ipc/discovery.js +1 -1
  40. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  41. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  42. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  43. package/dist/plus/integrations/index.d.ts +2 -1
  44. package/dist/plus/integrations/index.js.map +1 -1
  45. package/dist/plus/integrations/integrationService.d.ts +7 -0
  46. package/dist/plus/integrations/integrationService.js +71 -8
  47. package/dist/plus/integrations/integrationService.js.map +1 -1
  48. package/dist/plus/integrations/manager.d.ts +6 -0
  49. package/dist/plus/integrations/models/azurePullRequestWrites.d.ts +3 -1
  50. package/dist/plus/integrations/models/gitlabIssueWrites.d.ts +86 -0
  51. package/dist/plus/integrations/models/gitlabIssueWrites.js +9 -0
  52. package/dist/plus/integrations/models/gitlabIssueWrites.js.map +1 -0
  53. package/dist/plus/integrations/models/integration.d.ts +1 -1
  54. package/dist/plus/integrations/models/integration.js +1 -1
  55. package/dist/plus/integrations/models/integration.js.map +1 -1
  56. package/dist/plus/integrations/models/issueTrackerWrites.d.ts +12 -3
  57. package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
  58. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  59. package/dist/plus/integrations/providers/azure/models.d.ts +1 -1
  60. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  61. package/dist/plus/integrations/providers/azurePullRequestWriteErrors.d.ts +6 -2
  62. package/dist/plus/integrations/providers/azurePullRequestWriteErrors.js +44 -10
  63. package/dist/plus/integrations/providers/azurePullRequestWriteErrors.js.map +1 -1
  64. package/dist/plus/integrations/providers/azurePullRequestWrites.d.ts +1 -0
  65. package/dist/plus/integrations/providers/azurePullRequestWrites.js +28 -13
  66. package/dist/plus/integrations/providers/azurePullRequestWrites.js.map +1 -1
  67. package/dist/plus/integrations/providers/github.js +1 -1
  68. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +4 -1
  69. package/dist/plus/integrations/providers/gitlab/gitlab.js +4 -0
  70. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  71. package/dist/plus/integrations/providers/gitlab/issueWriteErrors.d.ts +11 -0
  72. package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js +73 -0
  73. package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js.map +1 -0
  74. package/dist/plus/integrations/providers/gitlab/issueWrites.d.ts +33 -0
  75. package/dist/plus/integrations/providers/gitlab/issueWrites.js +325 -0
  76. package/dist/plus/integrations/providers/gitlab/issueWrites.js.map +1 -0
  77. package/dist/plus/integrations/providers/gitlab.d.ts +7 -1
  78. package/dist/plus/integrations/providers/gitlab.js +24 -0
  79. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  80. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  81. package/dist/plus/integrations/providers/jira-server.d.ts +10 -0
  82. package/dist/plus/integrations/providers/jira-server.js +16 -1
  83. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  84. package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +6 -0
  85. package/dist/plus/integrations/providers/jiraIssueWrites.js +60 -11
  86. package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -1
  87. package/dist/plus/integrations/providers/providerApiClient.js +6 -2
  88. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  89. package/dist/plus/integrations/providers/providersApi.d.ts +3 -0
  90. package/dist/plus/integrations/providers/providersApi.js +13 -0
  91. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  92. package/dist/plus/integrations/reads/currentAccount.d.ts +1 -1
  93. package/dist/plus/integrations/reads/currentAccount.js +1 -1
  94. package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
  95. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  96. package/dist/plus/integrations/reads/issueTracker.js +4 -1
  97. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  98. package/dist/utils/env/node/exec.js +2 -2
  99. package/docs/integrations.md +65 -5
  100. package/docs/kepler-read-api-parity.md +2 -1
  101. package/package.json +1 -1
@@ -15,9 +15,9 @@ import { KeyedSequencer } from "../exec/indexLock.js";
15
15
  import { isFolder, isGitAnswer, isGitUnanswered, throwIfUnanswered } from "../exec/git.js";
16
16
  import { HoldOffMap } from "../../utils/holdOffMap.js";
17
17
  import { gate } from "../../utils/decorators/gate.js";
18
- import { hostname, userInfo } from "os";
19
- import { env } from "process";
20
18
  import { promises, statSync } from "fs";
19
+ import { env } from "process";
20
+ import { hostname, userInfo } from "os";
21
21
  //#region ../git-cli/src/providers/config.ts
22
22
  const mappedAuthorRegex = /(.+)\s<(.+)>/;
23
23
  const emptyArray = Object.freeze([]);
@@ -3,11 +3,17 @@ import { GitServiceContext } from "../../git/context.js";
3
3
  import { Cache } from "../../git/cache.js";
4
4
  import { GitGraph, GitGraphRowsStats, GraphIncrementalSeed, GraphReachabilityTable, GraphRowProcessor, IncrementalGraphOutcome } from "../../git/models/graph.js";
5
5
  import { GitGraphSearch, GitGraphSearchCursor, GitGraphSearchProgress, GitGraphSearchResults } from "../../git/models/graphSearch.js";
6
- import { GitGraphSession } from "../../git/models/graphSession.js";
6
+ import { GitGraphCommitVisibility, GitGraphSession } from "../../git/models/graphSession.js";
7
7
  import { GitGraphSubProvider } from "../../git/providers/graph.js";
8
8
  import { Git } from "../exec/git.js";
9
+ import { NormalizedHiddenRefPatterns } from "../../git/utils/hiddenRefs.utils.js";
9
10
  import { CliGitProviderInternal } from "../cliGitProvider.js";
10
11
  //#region ../git-cli/src/providers/graph.d.ts
12
+ type GraphWalkShape = {
13
+ readonly ordering: 'date' | 'author-date' | 'topo';
14
+ readonly onlyFollowFirstParent: boolean;
15
+ readonly hiddenRefs: NormalizedHiddenRefPatterns;
16
+ };
11
17
  export declare class GraphGitSubProvider implements GitGraphSubProvider {
12
18
  private readonly context;
13
19
  private readonly git;
@@ -25,6 +31,9 @@ export declare class GraphGitSubProvider implements GitGraphSubProvider {
25
31
  private getShallowBoundary;
26
32
  /** Whether `oldSha` is an ancestor of `newSha` (i.e. the ref moved fast-forward). */
27
33
  private isFastForward;
34
+ getCommitVisibility(repoPath: string, sha: string, shape: GraphWalkShape, cancellation?: AbortSignal): Promise<GitGraphCommitVisibility>;
35
+ getUnreachableCommits(repoPath: string, shas: readonly string[], shape: GraphWalkShape, cancellation?: AbortSignal): Promise<Set<string>>;
36
+ private createUnreachableProbe;
28
37
  openGraphSession(repoPath: string, options?: {
29
38
  rowProcessor?: GraphRowProcessor;
30
39
  rev?: string;
@@ -47,6 +56,7 @@ export declare class GraphGitSubProvider implements GitGraphSubProvider {
47
56
  onIncrementalResult?: (outcome: IncrementalGraphOutcome) => void;
48
57
  rebindFromRepoPath?: string;
49
58
  onMutationStart?: () => void;
59
+ walkShape?: GraphWalkShape;
50
60
  }, cancellation?: AbortSignal): Promise<GitGraph>;
51
61
  searchGraph(repoPath: string, search: SearchQuery, options?: {
52
62
  limit?: number;
@@ -13,6 +13,7 @@ import { classifySearchError, gitConfigsLog } from "../exec/git.js";
13
13
  import _usingCtx from "../../_virtual/@oxc-project+runtime/helpers/esm/usingCtx.js";
14
14
  import { fnv1aHash64 } from "../../utils/hash.js";
15
15
  import { isUserMatch } from "../../git/utils/user.utils.js";
16
+ import { getHiddenRefExcludeArgs, getHiddenRefPatternGroups, normalizeHiddenRefPatterns } from "../../git/utils/hiddenRefs.utils.js";
16
17
  import { getSearchQueryComparisonKey, parseSearchQueryGitCommand } from "../../git/utils/search.utils.js";
17
18
  import { getGraphParser, getShaAndDatesLogParser, getShaAndDatesWithFilesLogParser, getShaAndStatsLogParser, getShaLogParser } from "../parsers/logParser.js";
18
19
  import { convertStashesToStdin } from "./stash.js";
@@ -93,10 +94,23 @@ function downstreamsChanged(prior, next) {
93
94
  }
94
95
  return false;
95
96
  }
96
- /** The walk-shape key (`ordering|onlyFollowFirstParent`) an incremental seed is gated on — one builder so the
97
- * refresh/rebuild sites can't drift in how they stringify it. */
97
+ function getGraphWalkShape(cfg) {
98
+ return {
99
+ ordering: cfg?.graph?.commitOrdering ?? cfg?.commits.ordering ?? "date",
100
+ onlyFollowFirstParent: cfg?.graph?.onlyFollowFirstParent ?? false,
101
+ hiddenRefs: normalizeHiddenRefPatterns(cfg?.hiddenRefPatterns)
102
+ };
103
+ }
104
+ const loggedHiddenRefRefusals = /* @__PURE__ */ new Set();
105
+ function logHiddenRefRefusals(scope, hiddenRefs) {
106
+ if (scope == null || !hiddenRefs.refused.length) return;
107
+ const key = JSON.stringify(hiddenRefs.refused);
108
+ if (loggedHiddenRefRefusals.has(key)) return;
109
+ loggedHiddenRefRefusals.add(key);
110
+ scope.warn(`Ignoring hidden ref patterns: ${hiddenRefs.refused.map((r) => `'${r.pattern}' (${r.reason})`).join(", ")}`);
111
+ }
98
112
  function buildShapeKey(shape) {
99
- return `${shape.ordering}|${shape.onlyFollowFirstParent}`;
113
+ return `${shape.ordering}|${shape.onlyFollowFirstParent}|${shape.hiddenRefs.key}`;
100
114
  }
101
115
  /** Compare the inputs that can rewrite existing commits without moving branch tips. */
102
116
  function getAncestryChange(prior, current) {
@@ -168,15 +182,64 @@ var GraphGitSubProvider = class {
168
182
  errors: "ignore"
169
183
  }, "merge-base", "--is-ancestor", oldSha, newSha)).exitCode === 0;
170
184
  }
171
- async openGraphSession(repoPath, options, cancellation) {
172
- const getWalkShape = () => {
173
- const cfg = this.context.config;
174
- return {
175
- ordering: cfg?.graph?.commitOrdering ?? cfg?.commits.ordering ?? "date",
176
- onlyFollowFirstParent: cfg?.graph?.onlyFollowFirstParent ?? false
185
+ async getCommitVisibility(repoPath, sha, shape, cancellation) {
186
+ const supportsEndOfOptions = await this.git.supports("git:rev-parse:end-of-options");
187
+ const verified = await this.git.run({
188
+ cwd: repoPath,
189
+ cancellation,
190
+ errors: "throw",
191
+ expectedExitCodes: [1]
192
+ }, "rev-parse", "--verify", "-q", supportsEndOfOptions ? "--end-of-options" : void 0, `${sha}^{commit}`);
193
+ const commit = verified.stdout.trim();
194
+ if (verified.exitCode !== 0 || !commit) return { status: "missing" };
195
+ const probe = await this.createUnreachableProbe(repoPath, shape, cancellation);
196
+ const { patterns } = shape.hiddenRefs;
197
+ if (!(await probe([commit], patterns)).has(commit)) return { status: "visible" };
198
+ if (!patterns.length || (await probe([commit], [])).has(commit)) return { status: "outside" };
199
+ for (const [pattern, dropped] of getHiddenRefPatternGroups(patterns)) {
200
+ const remaining = patterns.filter((p) => !dropped.includes(p));
201
+ if (!(await probe([commit], remaining)).has(commit)) return {
202
+ status: "hidden",
203
+ pattern
177
204
  };
205
+ }
206
+ return { status: "hidden" };
207
+ }
208
+ async getUnreachableCommits(repoPath, shas, shape, cancellation) {
209
+ if (!shas.length) return /* @__PURE__ */ new Set();
210
+ return (await this.createUnreachableProbe(repoPath, shape, cancellation))(shas, shape.hiddenRefs.patterns);
211
+ }
212
+ async createUnreachableProbe(repoPath, shape, cancellation) {
213
+ const [gitStash, excludeFirstParentOnly] = await Promise.all([this.provider.stash?.getStash(repoPath, { includeFiles: false }, cancellation), shape.onlyFollowFirstParent ? this.git.supports("git:rev-list:exclude-first-parent-only") : false]);
214
+ let roots = "";
215
+ for (const line of convertStashesToStdin(gitStash?.stashes).stdin?.split("\n") ?? []) if (line) roots += `^${line}\n`;
216
+ return async (shas, patterns) => {
217
+ const args = ["rev-list"];
218
+ let stdin = roots;
219
+ if (shas.length === 1) args.push("-n1", shas[0]);
220
+ else stdin = `${join(shas, "\n")}\n${roots}`;
221
+ if (shape.onlyFollowFirstParent) {
222
+ args.push("--first-parent");
223
+ if (excludeFirstParentOnly) args.push("--exclude-first-parent-only");
224
+ }
225
+ args.push("--not", ...getHiddenRefExcludeArgs(patterns), "--all", "--stdin");
226
+ const result = await this.git.run({
227
+ cwd: repoPath,
228
+ cancellation,
229
+ errors: "throw",
230
+ stdin
231
+ }, ...args);
232
+ const requested = new Set(shas);
233
+ const unreachable = /* @__PURE__ */ new Set();
234
+ for (const line of result.stdout.split("\n")) {
235
+ const sha = line.trim();
236
+ if (requested.has(sha)) unreachable.add(sha);
237
+ }
238
+ return unreachable;
178
239
  };
179
- const session = new GraphSession(this, repoPath, options?.rowProcessor, getWalkShape);
240
+ }
241
+ async openGraphSession(repoPath, options, cancellation) {
242
+ const session = new GraphSession(this, repoPath, options?.rowProcessor, () => getGraphWalkShape(this.context.config));
180
243
  await session.initialize(options, cancellation);
181
244
  return session;
182
245
  }
@@ -184,30 +247,38 @@ var GraphGitSubProvider = class {
184
247
  const scope = getScopedLogger();
185
248
  const cfg = this.context.config;
186
249
  const defaultLimit = options?.limit ?? 5e3;
187
- const ordering = cfg?.graph?.commitOrdering ?? cfg?.commits.ordering ?? "date";
188
- const onlyFollowFirstParent = cfg?.graph?.onlyFollowFirstParent ?? false;
250
+ const { ordering, onlyFollowFirstParent, hiddenRefs } = options?.walkShape ?? getGraphWalkShape(cfg);
251
+ const hiddenRefExcludes = getHiddenRefExcludeArgs(hiddenRefs.patterns);
252
+ logHiddenRefRefusals(scope, hiddenRefs);
189
253
  const deferStats = options?.include?.stats;
190
254
  let rowsStatsSeed = options?.rowsStatsSeed;
191
255
  const parser = getGraphParser(options?.include?.stats && !deferStats);
192
256
  const shaParser = getShaLogParser();
193
257
  const statsParser = getShaAndStatsLogParser();
194
258
  const stashPromise = this.provider.stash?.getStash(repoPath, { includeFiles: false }, cancellation);
259
+ const getWalkCommand = (stdin) => {
260
+ const args = [
261
+ "log",
262
+ ...parser.arguments,
263
+ `--${ordering}-order`,
264
+ ...hiddenRefExcludes,
265
+ "--all"
266
+ ];
267
+ if (stdin) args.push("--stdin");
268
+ if (onlyFollowFirstParent) args.push("--first-parent");
269
+ return {
270
+ args,
271
+ stdin
272
+ };
273
+ };
274
+ const walkCommandPromise = Promise.resolve(stashPromise).then((gitStash) => getWalkCommand(convertStashesToStdin(gitStash?.stashes).stdin), () => getWalkCommand(void 0));
195
275
  const prespawnAborter = new AbortController();
196
276
  const onPrespawnCancel = () => prespawnAborter.abort();
197
277
  cancellation?.addEventListener("abort", onPrespawnCancel, { once: true });
198
278
  if (cancellation?.aborted) onPrespawnCancel();
199
279
  let prespawn = (async () => {
200
280
  try {
201
- const gitStash = await stashPromise;
202
- const { stdin } = convertStashesToStdin(gitStash?.stashes);
203
- const args = [
204
- "log",
205
- ...parser.arguments,
206
- `--${ordering}-order`,
207
- "--all"
208
- ];
209
- if (stdin) args.push("--stdin");
210
- if (onlyFollowFirstParent) args.push("--first-parent");
281
+ const { args, stdin } = await walkCommandPromise;
211
282
  return { stream: this.git.stream({
212
283
  cwd: repoPath,
213
284
  configs: gitConfigsLog,
@@ -297,7 +368,7 @@ var GraphGitSubProvider = class {
297
368
  };
298
369
  seedDownstreamMapFromBranches();
299
370
  const gitStash = getSettledValue(stashResult);
300
- const { stdin, remappedIds } = convertStashesToStdin(gitStash?.stashes);
371
+ const { remappedIds } = convertStashesToStdin(gitStash?.stashes);
301
372
  const avatars = /* @__PURE__ */ new Map();
302
373
  const ids = /* @__PURE__ */ new Set();
303
374
  const reachableFromHEAD = /* @__PURE__ */ new Set();
@@ -578,14 +649,7 @@ var GraphGitSubProvider = class {
578
649
  })
579
650
  };
580
651
  };
581
- const args = [
582
- "log",
583
- ...parser.arguments,
584
- `--${ordering}-order`,
585
- "--all"
586
- ];
587
- if (stdin) args.push("--stdin");
588
- if (onlyFollowFirstParent) args.push("--first-parent");
652
+ const { args, stdin } = await walkCommandPromise;
589
653
  async function getCommitsForGraphCore(limit, sha, cursor, cancellation, isPage) {
590
654
  try {
591
655
  try {
@@ -721,6 +785,10 @@ var GraphGitSubProvider = class {
721
785
  fallback("first-parent");
722
786
  return;
723
787
  }
788
+ if ((seed.hiddenRefsKey ?? normalizeHiddenRefPatterns(void 0).key) !== hiddenRefs.key) {
789
+ fallback("hidden-refs-changed");
790
+ return;
791
+ }
724
792
  const currentHeadSha = rev == null ? selectSha : headBranch?.sha;
725
793
  const currentTips = refTips;
726
794
  const affected = /* @__PURE__ */ new Set();
@@ -805,7 +873,7 @@ var GraphGitSubProvider = class {
805
873
  configs: gitConfigsLog,
806
874
  cancellation,
807
875
  stdin: exclusionsStdin
808
- }, "log", ...parser.arguments, "--date-order", "--all", "--stdin", "--");
876
+ }, "log", ...parser.arguments, "--date-order", ...hiddenRefExcludes, "--all", "--stdin", "--");
809
877
  const newCommits = [...parser.parse(enumResult.stdout)];
810
878
  let maxSeedDate = Number.NEGATIVE_INFINITY;
811
879
  for (const r of seed.rows) if (r.date > maxSeedDate) maxSeedDate = r.date;
@@ -971,9 +1039,9 @@ var GraphGitSubProvider = class {
971
1039
  ...search
972
1040
  };
973
1041
  const currentUser = search.query.includes("@me") ? await this.provider.config.getCurrentUser(repoPath) : void 0;
974
- const { args: searchArgs, files, shas, filters } = parseSearchQueryGitCommand(search, currentUser);
1042
+ const { args: searchArgs, files, shas } = parseSearchQueryGitCommand(search, currentUser, { hiddenRefExcludes: getHiddenRefExcludeArgs(normalizeHiddenRefPatterns(this.context.config?.hiddenRefPatterns).patterns) });
975
1043
  if (shas?.size) return 0;
976
- if (filters.type === "merge") {
1044
+ if (searchArgs.includes("--merges")) {
977
1045
  const allIndex = searchArgs.indexOf("--all");
978
1046
  if (allIndex !== -1) searchArgs.splice(allIndex, 0, "--exclude=refs/stash");
979
1047
  }
@@ -1001,7 +1069,7 @@ var GraphGitSubProvider = class {
1001
1069
  const comparisonKey = getSearchQueryComparisonKey(search);
1002
1070
  try {
1003
1071
  const currentUser = search.query.includes("@me") ? await this.provider.config.getCurrentUser(repoPath) : void 0;
1004
- const { args: searchArgs, files, shas, filters } = parseSearchQueryGitCommand(search, currentUser);
1072
+ const { args: searchArgs, files, shas, filters } = parseSearchQueryGitCommand(search, currentUser, { hiddenRefExcludes: getHiddenRefExcludeArgs(normalizeHiddenRefPatterns(this.context.config?.hiddenRefPatterns).patterns) });
1005
1073
  const tipsOnly = filters.type === "tip";
1006
1074
  const mergesOnly = searchArgs.includes("--merges");
1007
1075
  const parser = filters.files ? getShaAndDatesWithFilesLogParser(tipsOnly) : getShaAndDatesLogParser(tipsOnly);
@@ -1250,6 +1318,9 @@ var GraphSession = class {
1250
1318
  _current;
1251
1319
  _window = [];
1252
1320
  _buildShape;
1321
+ _walkShape;
1322
+ _visibility = /* @__PURE__ */ new Map();
1323
+ _reachable = /* @__PURE__ */ new Map();
1253
1324
  _rebindMutationStarted = false;
1254
1325
  constructor(provider, _repoPath, rowProcessor, getWalkShape) {
1255
1326
  this.provider = provider;
@@ -1273,6 +1344,46 @@ var GraphSession = class {
1273
1344
  get current() {
1274
1345
  return this._current;
1275
1346
  }
1347
+ getCommitVisibility(sha, cancellation) {
1348
+ return this.getCommitVisibilityCore(sha, this._walkShape, cancellation);
1349
+ }
1350
+ async getUnreachableCommits(shas, cancellation) {
1351
+ const shape = this._walkShape;
1352
+ const prefix = `${buildShapeKey(shape)}|`;
1353
+ const unreachable = /* @__PURE__ */ new Set();
1354
+ const pending = [];
1355
+ for (const sha of shas) {
1356
+ const visibility = this._visibility.get(prefix + sha);
1357
+ const reachable = this._reachable.get(prefix + sha) ?? (visibility != null ? visibility.status === "visible" : void 0);
1358
+ if (reachable == null) pending.push(sha);
1359
+ else if (!reachable) unreachable.add(sha);
1360
+ }
1361
+ if (!pending.length) return unreachable;
1362
+ const found = await this.provider.getUnreachableCommits(this.repoPath, pending, shape, cancellation);
1363
+ for (const sha of pending) {
1364
+ this._reachable.set(prefix + sha, !found.has(sha));
1365
+ if (found.has(sha)) unreachable.add(sha);
1366
+ }
1367
+ return unreachable;
1368
+ }
1369
+ async getCommitVisibilityCore(sha, shape, cancellation) {
1370
+ const key = `${buildShapeKey(shape)}|${sha}`;
1371
+ const cached = this._visibility.get(key);
1372
+ if (cached != null) return cached;
1373
+ const visibility = await this.provider.getCommitVisibility(this.repoPath, sha, shape, cancellation);
1374
+ if (visibility.status !== "missing") this._visibility.set(key, visibility);
1375
+ return visibility;
1376
+ }
1377
+ async getVisibleAnchor(rev, shape, cancellation) {
1378
+ const prior = this._walkShape;
1379
+ if (rev == null || isUncommitted(rev) || prior.hiddenRefs.key === shape.hiddenRefs.key && prior.onlyFollowFirstParent === shape.onlyFollowFirstParent) return rev;
1380
+ try {
1381
+ return (await this.getCommitVisibilityCore(rev, shape, cancellation)).status === "visible" ? rev : void 0;
1382
+ } catch (ex) {
1383
+ if (isCancellationError(ex) || cancellation?.aborted) throw ex;
1384
+ return;
1385
+ }
1386
+ }
1276
1387
  /**
1277
1388
  * First walk — no seed (nothing accumulated yet), equivalent to a plain `getGraph`.
1278
1389
  *
@@ -1284,7 +1395,8 @@ var GraphSession = class {
1284
1395
  const graph = await this.provider.getGraph(this.repoPath, options?.rev, {
1285
1396
  include: options?.include,
1286
1397
  limit: options?.limit,
1287
- rowProcessor: this.rowProcessor
1398
+ rowProcessor: this.rowProcessor,
1399
+ walkShape: shape
1288
1400
  }, cancellation);
1289
1401
  this.applyRebuild(graph, shape);
1290
1402
  }
@@ -1332,6 +1444,7 @@ var GraphSession = class {
1332
1444
  const shape = this.getWalkShape();
1333
1445
  const buildShape = buildShapeKey(shape);
1334
1446
  const prior = this._current;
1447
+ const rev = await this.getVisibleAnchor(options?.rev, shape, cancellation);
1335
1448
  const priorHead = find(prior.branches.values(), (b) => b.current);
1336
1449
  const incrementalSeed = options?.rebuild !== true && prior.refTips != null && this._buildShape === buildShape ? {
1337
1450
  rows: this._window,
@@ -1341,13 +1454,14 @@ var GraphSession = class {
1341
1454
  rowsStats: prior.rowsStats,
1342
1455
  hasMore: prior.paging?.hasMore ?? false,
1343
1456
  onlyFollowFirstParent: shape.onlyFollowFirstParent,
1457
+ hiddenRefsKey: shape.hiddenRefs.key,
1344
1458
  shallowBoundary: prior.shallowBoundary,
1345
1459
  decorationFingerprint: prior.decorationFingerprint,
1346
1460
  headRefUpstreamName: priorHead?.upstream?.name,
1347
1461
  headRefUpstreamLocal: priorHead?.upstream?.local === true
1348
1462
  } : void 0;
1349
1463
  let outcome;
1350
- const graph = await this.provider.getGraph(this.repoPath, options?.rev, {
1464
+ const graph = await this.provider.getGraph(this.repoPath, rev, {
1351
1465
  include: options?.include,
1352
1466
  limit: options?.limit,
1353
1467
  rowProcessor: this.rowProcessor,
@@ -1361,7 +1475,8 @@ var GraphSession = class {
1361
1475
  rebindFromRepoPath,
1362
1476
  onMutationStart: () => {
1363
1477
  this._rebindMutationStarted = true;
1364
- }
1478
+ },
1479
+ walkShape: shape
1365
1480
  }, cancellation);
1366
1481
  mergeAvatarsForward(prior.avatars, graph.avatars);
1367
1482
  this.applyRebuild(graph, shape);
@@ -1442,6 +1557,9 @@ var GraphSession = class {
1442
1557
  this._current = graph;
1443
1558
  this._window = graph.rows;
1444
1559
  this._buildShape = buildShapeKey(shape);
1560
+ this._walkShape = shape;
1561
+ this._visibility.clear();
1562
+ this._reachable.clear();
1445
1563
  this.writes.invalidate();
1446
1564
  }
1447
1565
  /** A page-append: keep the window up to the cursor and append the page (the reducer's cursor-anchored