@gitkraken/core-gitlens 0.37.1 → 0.38.1

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 (116) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/dist/git/cache.d.ts +128 -8
  3. package/dist/git/cache.js +425 -46
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/features.d.ts +1 -1
  6. package/dist/git/features.js +3 -0
  7. package/dist/git/features.js.map +1 -1
  8. package/dist/git/providers/branches.d.ts +42 -1
  9. package/dist/git/providers/diff.d.ts +17 -0
  10. package/dist/git/providers/provider.d.ts +7 -0
  11. package/dist/git/providers/shared/remotes.js +8 -4
  12. package/dist/git/providers/shared/remotes.js.map +1 -1
  13. package/dist/git/remotes/matcher.js +2 -2
  14. package/dist/git/remotes/matcher.js.map +1 -1
  15. package/dist/git/repositoryService.d.ts +16 -1
  16. package/dist/git/repositoryService.js +51 -3
  17. package/dist/git/repositoryService.js.map +1 -1
  18. package/dist/git/run.types.d.ts +1 -0
  19. package/dist/git/service.js +6 -2
  20. package/dist/git/service.js.map +1 -1
  21. package/dist/git/utils/fileStatus.utils.d.ts +5 -0
  22. package/dist/git/utils/fileStatus.utils.js +18 -1
  23. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  24. package/dist/git/watching/changeEvent.d.ts +13 -3
  25. package/dist/git/watching/changeEvent.js +15 -4
  26. package/dist/git/watching/changeEvent.js.map +1 -1
  27. package/dist/git/watching/changeOrdinal.d.ts +9 -0
  28. package/dist/git/watching/changeOrdinal.js +14 -0
  29. package/dist/git/watching/changeOrdinal.js.map +1 -0
  30. package/dist/git/watching/unwatchedCacheValidator.d.ts +38 -5
  31. package/dist/git/watching/unwatchedCacheValidator.js +180 -36
  32. package/dist/git/watching/unwatchedCacheValidator.js.map +1 -1
  33. package/dist/git/watching/watchGroup.d.ts +63 -14
  34. package/dist/git/watching/watchGroup.js +213 -74
  35. package/dist/git/watching/watchGroup.js.map +1 -1
  36. package/dist/git/watching/watchService.js +4 -3
  37. package/dist/git/watching/watchService.js.map +1 -1
  38. package/dist/git/watching/watchSession.d.ts +10 -2
  39. package/dist/git/watching/watchSession.js +18 -4
  40. package/dist/git/watching/watchSession.js.map +1 -1
  41. package/dist/git/watching/watcherPatterns.d.ts +18 -4
  42. package/dist/git/watching/watcherPatterns.js +39 -8
  43. package/dist/git/watching/watcherPatterns.js.map +1 -1
  44. package/dist/git/watching/worktreeSummary.d.ts +23 -12
  45. package/dist/git/watching/worktreeSummary.js +164 -41
  46. package/dist/git/watching/worktreeSummary.js.map +1 -1
  47. package/dist/git-cli/cliGitProvider.d.ts +1 -0
  48. package/dist/git-cli/cliGitProvider.js +11 -2
  49. package/dist/git-cli/cliGitProvider.js.map +1 -1
  50. package/dist/git-cli/exec/git.d.ts +7 -2
  51. package/dist/git-cli/exec/git.js +46 -10
  52. package/dist/git-cli/exec/git.js.map +1 -1
  53. package/dist/git-cli/exec/headState.d.ts +24 -0
  54. package/dist/git-cli/exec/headState.js +46 -6
  55. package/dist/git-cli/exec/headState.js.map +1 -1
  56. package/dist/git-cli/parsers/logParser.js +6 -3
  57. package/dist/git-cli/parsers/logParser.js.map +1 -1
  58. package/dist/git-cli/providers/branches.d.ts +135 -10
  59. package/dist/git-cli/providers/branches.js +622 -80
  60. package/dist/git-cli/providers/branches.js.map +1 -1
  61. package/dist/git-cli/providers/commits.d.ts +16 -0
  62. package/dist/git-cli/providers/commits.js +80 -28
  63. package/dist/git-cli/providers/commits.js.map +1 -1
  64. package/dist/git-cli/providers/config.d.ts +10 -0
  65. package/dist/git-cli/providers/config.js +50 -12
  66. package/dist/git-cli/providers/config.js.map +1 -1
  67. package/dist/git-cli/providers/contributors.js +11 -7
  68. package/dist/git-cli/providers/contributors.js.map +1 -1
  69. package/dist/git-cli/providers/diff.d.ts +12 -0
  70. package/dist/git-cli/providers/diff.js +107 -15
  71. package/dist/git-cli/providers/diff.js.map +1 -1
  72. package/dist/git-cli/providers/graph.js +32 -25
  73. package/dist/git-cli/providers/graph.js.map +1 -1
  74. package/dist/git-cli/providers/operations.d.ts +37 -3
  75. package/dist/git-cli/providers/operations.js +124 -46
  76. package/dist/git-cli/providers/operations.js.map +1 -1
  77. package/dist/git-cli/providers/patch.js +1 -1
  78. package/dist/git-cli/providers/patch.js.map +1 -1
  79. package/dist/git-cli/providers/refs.d.ts +1 -1
  80. package/dist/git-cli/providers/refs.js +10 -11
  81. package/dist/git-cli/providers/refs.js.map +1 -1
  82. package/dist/git-cli/providers/status.d.ts +4 -5
  83. package/dist/git-cli/providers/status.js +36 -33
  84. package/dist/git-cli/providers/status.js.map +1 -1
  85. package/dist/git-cli/providers/tags.d.ts +8 -0
  86. package/dist/git-cli/providers/tags.js +53 -34
  87. package/dist/git-cli/providers/tags.js.map +1 -1
  88. package/dist/git-cli/service.d.ts +15 -0
  89. package/dist/git-cli/service.js +19 -1
  90. package/dist/git-cli/service.js.map +1 -1
  91. package/dist/plus/git-github/providers/github/diff.d.ts +1 -0
  92. package/dist/plus/git-github/providers/github/diff.js +6 -1
  93. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  94. package/dist/plus/integrations/integrationService.js +9 -0
  95. package/dist/plus/integrations/integrationService.js.map +1 -1
  96. package/dist/plus/integrations/providers/jira-server.js +1 -1
  97. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  98. package/dist/plus/integrations/providers/jira.d.ts +20 -9
  99. package/dist/plus/integrations/providers/jira.js +114 -99
  100. package/dist/plus/integrations/providers/jira.js.map +1 -1
  101. package/dist/plus/integrations/providers/linear.d.ts +11 -4
  102. package/dist/plus/integrations/providers/linear.js +75 -32
  103. package/dist/plus/integrations/providers/linear.js.map +1 -1
  104. package/dist/plus/integrations/providers/utils/discoveryCache.d.ts +35 -4
  105. package/dist/plus/integrations/providers/utils/discoveryCache.js +45 -11
  106. package/dist/plus/integrations/providers/utils/discoveryCache.js.map +1 -1
  107. package/dist/utils/env/node/exec.d.ts +8 -4
  108. package/dist/utils/env/node/exec.js +115 -9
  109. package/dist/utils/env/node/exec.js.map +1 -1
  110. package/dist/utils/holdOffMap.d.ts +23 -0
  111. package/dist/utils/holdOffMap.js +43 -0
  112. package/dist/utils/holdOffMap.js.map +1 -0
  113. package/dist/utils/promiseCache.d.ts +15 -2
  114. package/dist/utils/promiseCache.js +34 -4
  115. package/dist/utils/promiseCache.js.map +1 -1
  116. package/package.json +1 -1
@@ -10,6 +10,10 @@ import { Cache, GkConfigInvalidationTarget } from "../../git/cache.js";
10
10
  import { Git } from "../exec/git.js";
11
11
  import { CliGitProviderInternal } from "../cliGitProvider.js";
12
12
  //#region ../git-cli/src/providers/branches.d.ts
13
+ /** The clock a failed default branch lookup's wait is measured on, exported for testing */
14
+ export declare const defaultBranchLookupClock: {
15
+ now: () => number;
16
+ };
13
17
  /** The clock an unfinished patch comparison's expiry is read from, exported for testing */
14
18
  export declare const patchCheckClock: {
15
19
  now: () => number;
@@ -43,6 +47,18 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
43
47
  * measured against one base shares one read of it until it changes
44
48
  */
45
49
  private readonly baseReflogs;
50
+ /**
51
+ * The fork points git found in their base's tip's history, by `<commonPath>\0<forkPoint>\0<tip>`, for a base carried
52
+ * past a commit (see `getAheadOfBaseAfterCommit`): every commit on a branch asks again while neither moves
53
+ */
54
+ private readonly forkPointsInTipHistory;
55
+ /**
56
+ * For the local branch tracking a base, what its reflog reaches at its tip (else `false`), by `<commonPath>\0<ref>`,
57
+ * held, as {@link baseMovedForward}'s reads are, for the tip, the reflog and the replace refs it was read under. A
58
+ * move of the branch reaches every worktree measured against the base, so they share the read, and the checked-out
59
+ * branches holding any commit it reaches off the tip's history (by tip sha), read once for the tips in `heads`
60
+ */
61
+ private readonly trackingReflogReaches;
46
62
  /** Whether the repository at a common git directory keeps its refs and reflogs in reftables, by `<commonPath>` */
47
63
  private readonly reftableRepositories;
48
64
  /**
@@ -51,6 +67,12 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
51
67
  * run again on every full read of the base while the machine is likely still as busy
52
68
  */
53
69
  private readonly unfinishedPatchChecks;
70
+ /**
71
+ * Failed network reads of a remote's default branch, by common path and remote (see {@link getDefaultBranchName}),
72
+ * each with the drop stamp taken before it. A drop of the repository's cached default branch since (a change to its
73
+ * remotes or branches, a close or reset) ends it, so a fixed remote is tried again straight away
74
+ */
75
+ private readonly failedDefaultBranchLookups;
54
76
  /**
55
77
  * When each `commonPath\0branch\0key` was last stamped by this process. Bounded: a dropped entry only costs a
56
78
  * read of the stored stamp, which still holds off a write under 5 minutes old
@@ -82,8 +104,9 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
82
104
  force?: boolean;
83
105
  }, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
84
106
  /**
85
- * What `getBranches(repoPath)` would answer for the named branch, or for the current one when `name` is omitted,
86
- * without keeping that worktree's copy of the whole list, and whether the shared list it read is still kept
107
+ * What `getBranches(repoPath)` would answer for the first branch `matches` accepts, or for the current one when
108
+ * `matches` is omitted, without keeping that worktree's copy of the whole list, and whether the shared list it read
109
+ * is still kept. `matches` sees each entry as the shared list holds it, or as `repoPath` sees it when `mapped`
87
110
  */
88
111
  private getBranchFromSharedList;
89
112
  /** The current ref of `repoPath` and the default worktree path of `commonPath`, rejecting if the caller aborted mid-read */
@@ -165,6 +188,11 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
165
188
  getBranchMergedStatus(repoPath: string, branch: GitBranchReference, into: GitBranchReference, cancellation?: AbortSignal): Promise<GitBranchMergedStatus>;
166
189
  private getBranchMergedStatusCore;
167
190
  getLocalBranchByUpstream(repoPath: string, remoteBranchName: string, cancellation?: AbortSignal): Promise<GitBranch | undefined>;
191
+ /**
192
+ * Whether `getBranches(repoPath)` holds a branch `matches` accepts (any when omitted), judged on each as that list
193
+ * would hold it, without keeping that worktree's copy of the list
194
+ */
195
+ hasBranch(repoPath: string, matches: ((branch: GitBranch) => boolean) | undefined, cancellation?: AbortSignal): Promise<boolean>;
168
196
  getPushTarget(repoPath: string, branch?: string, cancellation?: AbortSignal): Promise<GitPushTarget>;
169
197
  /** Detects potential conflicts when applying commits onto a target branch (git rebase and cherry-pick) */
170
198
  getPotentialApplyConflicts(repoPath: string, targetBranch: string, shas: string[], options?: {
@@ -187,7 +215,8 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
187
215
  private getBaseBranchFromReflog;
188
216
  /**
189
217
  * The start point `ref`'s own reflog says it was created from (`branch: Created from <name>`), as git wrote it:
190
- * a branch, `HEAD`, a sha, a tag or any other revision. `undefined` unless exactly one entry says so. Rejects
218
+ * a branch, `HEAD`, a sha, a tag or any other revision. `undefined` unless exactly one entry says so. Read from the
219
+ * reflog's file (see {@link readBaseReflog}) for a local branch the cached ref list names, else from git. Rejects
191
220
  * when the reflog can't be read, including for a ref that doesn't exist.
192
221
  */
193
222
  private getReflogCreatedFrom;
@@ -241,12 +270,93 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
241
270
  readonly base: NonNullable<AheadOfBase['base']>;
242
271
  readonly dependsOn: readonly string[];
243
272
  readonly defaultBranch?: string | null;
273
+ readonly measuredFrom?: string;
244
274
  }, moved: readonly string[], cancellation?: AbortSignal): Promise<AheadOfBase | undefined>;
275
+ getAheadOfBaseAfterCommit(repoPath: string, branch: string | undefined, previous: {
276
+ readonly head: string;
277
+ readonly base: NonNullable<AheadOfBase['base']>;
278
+ readonly dependsOn: readonly string[];
279
+ readonly defaultBranch?: string | null;
280
+ readonly measuredFrom?: string;
281
+ }, head: string, cancellation?: AbortSignal): Promise<AheadOfBase | undefined>;
282
+ /**
283
+ * The full name of the local branch tracking the base `baseRef` (a remote-tracking ref), when `moved` names it: the
284
+ * default branch the previous read resolved, which the base was compared with as that branch's tracking ref. Only a
285
+ * branch that exists is ever named the default, so it existed for that read too. `undefined` when `moved` doesn't
286
+ * name it, it is the branch measured, or anything else lets its move reach the answer: a ref of an `upstream`
287
+ * remote, whose copy of a candidate contends with it and is skipped at its tip, or another branch that tracks it
288
+ * locally, which a read would compare it with as that branch's upstream. Its tracking is read from both the ref list
289
+ * and the config, which must agree.
290
+ */
291
+ private getMovedTrackingBranch;
292
+ /**
293
+ * {@link getAheadOfBaseAfterBaseMove} after only `tracking`, the local branch tracking the base (see
294
+ * {@link getMovedTrackingBranch}), moved: the previous answer, unchanged, while the base, HEAD and the default
295
+ * branch are as that answer left them and the branch still loses to the base (see
296
+ * {@link isTrackingBranchBehindBase}). `record` is the base's listed ref.
297
+ */
298
+ private getAheadOfBaseAfterTrackingBranchMove;
299
+ /**
300
+ * Whether `tracking`, the local branch tracking the base `baseRef` at `baseTip` (see {@link getMovedTrackingBranch}),
301
+ * still loses to the base for HEAD at `head`, which forked from the base at `forkPoint`.
302
+ *
303
+ * A full read compares the branch with the base as its tracking ref (see {@link getNearestForkTarget}), and the base
304
+ * wins, with its own settled fork point whatever the branch's tip, whenever git reads the branch (`--fork-point`,
305
+ * else the merge base: either way a commit HEAD shares with the branch's tip or a value of its reflog) at or below
306
+ * where it reads the base. Nothing else in that read depends on the branch (see {@link getMovedTrackingBranch}), so
307
+ * the base's answer stands. Git's reading of the base is never below `forkPoint`: settling only moves down from it,
308
+ * and the base's tip (when the base is in HEAD's history) and the merge base are at or below it too, as the base's
309
+ * reflog holds its tip. So it is enough that HEAD shares nothing past `forkPoint` with the branch's tip and reflog:
310
+ * HEAD's commits they don't reach are as many as HEAD's commits past `forkPoint`, which they reach. Those are counted
311
+ * past the branch's tip and past `forkPoint` once for every checked-out branch, when nothing the reflog reaches off
312
+ * the tip's history is HEAD's; else listed by HEAD's own walk past all of it, `forkPoint` not among them.
313
+ *
314
+ * At the base's own tip no count is needed: with nothing the branch's reflog reaches off the tip's history in HEAD's,
315
+ * HEAD shares with the branch exactly what it shares with the base's tip, which the base's reflog holds. When git
316
+ * finds the one best common ancestor of HEAD and the base's reflog, everything the branch shares with HEAD is at or
317
+ * below it; when it reads the base's merge base with HEAD instead, the branch reads as that same commit, whether as
318
+ * the one best common ancestor of HEAD and the tip both share or as the merge base of the same two commits.
319
+ *
320
+ * The base's reflog must hold its tip as its newest value, or be empty, when `--fork-point` reads the tip alone
321
+ * (`checkBaseReflog` reads it for a caller that hasn't); the branch's must end at its tip.
322
+ */
323
+ private isTrackingBranchBehindBase;
324
+ /**
325
+ * What `ref`'s reflog reaches at `tip` (see {@link trackingReflogReaches}), and whether any of it off the tip's
326
+ * history is in `head`'s, or that can't be told from the checked-out branches; `undefined` when its reflog is empty
327
+ * or doesn't end at `tip`, reaches too much off `tip`'s history to tell, or git couldn't say
328
+ */
329
+ private getTrackingReflogReach;
330
+ /**
331
+ * Reads {@link getTrackingReflogReach}'s reach, in `commonPath`, without spawning when the reflog's file shows only
332
+ * moves forward. Not bound to one caller's cancellation, since every worktree the move reached rides this one read.
333
+ * `false` when the reflog is empty or doesn't end at `tip`, or reaches too much off its history to tell; `undefined`
334
+ * when git couldn't say.
335
+ */
336
+ private readTrackingReflogReach;
337
+ /**
338
+ * The tips of the `checkedOut` branches holding any of `commits`, from one `for-each-ref` in `commonPath`, which holds
339
+ * every worktree's branches; `undefined` when git couldn't say
340
+ */
341
+ private readHeadsHolding;
245
342
  /**
246
343
  * Whether the repository is shallow, by its common git directory's `shallow` file, which spawns nothing; `undefined`
247
344
  * when it can't be read
248
345
  */
249
346
  private isShallowRepository;
347
+ /**
348
+ * Whether the repository has a grafts file, which rewrites the parents every walk sees, by its common git directory's
349
+ * `info/grafts`, which spawns nothing; `undefined` when it can't be read
350
+ */
351
+ private hasGrafts;
352
+ /**
353
+ * Whether `records`, the cached ref list, now lists a ref a base read for `branch` that compared the created-from and
354
+ * default candidates would compare too, but which isn't among `dependsOn`, the refs that read depended on, as it
355
+ * leaves out one that was absent: the branch `createdFrom` names (as the branch's reflog gives it, see
356
+ * {@link getListedBaseName}), unless it is the branch itself or its copy on a remote, or the `upstream` remote's
357
+ * copy of a candidate `dependsOn` names (see {@link getUpstreamContender}), matched by its name's end alone
358
+ */
359
+ private hasAppearedCandidate;
250
360
  /** Whether `ref` is a `refs/remotes/<remote>/HEAD` symref pointing at `target`, from the cached local symref */
251
361
  private isRemoteHeadOf;
252
362
  /**
@@ -376,7 +486,7 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
376
486
  * stays, with `ahead`, only when the merge base can't be read either.
377
487
  */
378
488
  private countPastForkPoint;
379
- /** {@link settleForkPoint} from HEAD, then {@link countPastForkPoint} */
489
+ /** {@link settleForkPoint} from `reads.from`, then {@link countPastForkPoint} */
380
490
  private settleForkPointAndCount;
381
491
  /**
382
492
  * Where `reads.from` forked from `ref` (a base at `tip`), from `forkPoint`, git's reading of `ref`'s reflog. A fork
@@ -401,11 +511,18 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
401
511
  * repository, which keeps reflogs out of files, or when the file can't be read or parsed.
402
512
  */
403
513
  private readBaseReflog;
514
+ /**
515
+ * {@link readBaseReflog} of `ref`, a local branch's full name, in place of git's reading of it; `undefined` when only
516
+ * git can say. Git rejects a ref that doesn't exist, even when a reflog file is left for it, so the file is taken
517
+ * only for a branch the cached ref list names.
518
+ */
519
+ private readListedBranchReflog;
404
520
  /** Counts the default branch's own commits past its upstream (see {@link getSelfUpstreamTarget}) for {@link getAheadOfBase} */
405
521
  private measureAheadOfSelfUpstream;
406
522
  /**
407
- * HEAD's count against `ref` from their merge base: `left` only `ref` has, `right` only HEAD has. `undefined`
408
- * before HEAD's first commit, when there is nothing to count; any other failure rejects with git's error.
523
+ * `from`'s count (HEAD, or a commit) against `ref` from their merge base: `left` only `ref` has, `right` only `from`
524
+ * has. `undefined` before HEAD's first commit, when there is nothing to count; any other failure rejects with git's
525
+ * error.
409
526
  */
410
527
  private countAgainstBase;
411
528
  getAheadBehindCounts(repoPath: string, base: string, options?: {
@@ -432,7 +549,8 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
432
549
  private getRemoteNames;
433
550
  /**
434
551
  * Whether `ref` names `selfName` itself (see {@link isSelfRef}) and sits at `reads.from`'s commit; tips are read
435
- * only after the name matched. HEAD's commit is asked of git, a branch's read from the cached ref list
552
+ * only after the name matched. HEAD's commit is asked of git, a branch's read from the cached ref list, and a commit
553
+ * is itself
436
554
  */
437
555
  private isSelfAtTip;
438
556
  /** The remotes a default branch is read from, in order: `upstream`, `origin`, then the first remote */
@@ -465,11 +583,18 @@ export declare class BranchesGitSubProvider implements GitBranchesSubProvider {
465
583
  */
466
584
  private getNearestForkTarget;
467
585
  /**
468
- * `<name>@{u}`, without asking git when the cached ref list shows `name` can't have one: a failed lookup isn't
469
- * cached, so asking it of a remote-tracking ref (`origin/main`, the usual default) re-spawns on every read. The
470
- * list's own upstream isn't used: a config-only change (`git branch -u`) doesn't refresh it.
586
+ * `<name>@{u}`, without asking git when the cached ref list shows `name` can't have one, as a remote-tracking ref
587
+ * (`origin/main`, the usual default) can't. A local branch the list names is asked in the main checkout, so the
588
+ * repository's checkouts share one read, unless the config listing the base read took shows config that can differ
589
+ * by checkout. The list's own upstream isn't the same answer: it names an upstream that is gone, which this reports
590
+ * as none, and can differ for one outside `refs/remotes/` or a short name that is ambiguous.
471
591
  */
472
592
  private getUpstreamName;
593
+ /**
594
+ * Whether `repoPath`'s config is its repository's main checkout's, as the config listing already read for its base
595
+ * shows it (see `mayConfigDifferByCheckout`). Never reads the listing: `false` when there is none to go by.
596
+ */
597
+ private isConfigSharedByCheckouts;
473
598
  /**
474
599
  * The base for a branch that is itself the default branch, with its tip: its own upstream, `upstream/<branch>`
475
600
  * when an `upstream` remote has it, else `<branch>@{u}`. Read from the cached ref and branch lists; only a