@gitkraken/core-gitlens 0.8.0 → 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.
Files changed (72) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/dist/git/cache.d.ts +11 -0
  3. package/dist/git/cache.js +26 -3
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/context.d.ts +3 -2
  6. package/dist/git/context.js.map +1 -1
  7. package/dist/git/features.d.ts +1 -1
  8. package/dist/git/features.js +1 -0
  9. package/dist/git/features.js.map +1 -1
  10. package/dist/git/models/reflog.d.ts +6 -0
  11. package/dist/git/models/reflog.js.map +1 -1
  12. package/dist/git/models/revision.d.ts +0 -1
  13. package/dist/git/models/revision.js +1 -2
  14. package/dist/git/models/revision.js.map +1 -1
  15. package/dist/git/providers/commits.d.ts +20 -1
  16. package/dist/git/providers/operations.d.ts +13 -0
  17. package/dist/git/providers/provider.d.ts +14 -4
  18. package/dist/git/providers/refs.d.ts +10 -0
  19. package/dist/git/providers/revision.d.ts +2 -0
  20. package/dist/git/providers/staging.d.ts +2 -1
  21. package/dist/git/providers/stash.d.ts +3 -2
  22. package/dist/git/providers/status.d.ts +4 -0
  23. package/dist/git/run.types.d.ts +16 -0
  24. package/dist/git-cli/cliGitProvider.d.ts +24 -3
  25. package/dist/git-cli/cliGitProvider.js +79 -17
  26. package/dist/git-cli/cliGitProvider.js.map +1 -1
  27. package/dist/git-cli/exec/commandClassifier.d.ts +31 -0
  28. package/dist/git-cli/exec/commandClassifier.js +391 -0
  29. package/dist/git-cli/exec/commandClassifier.js.map +1 -0
  30. package/dist/git-cli/exec/git.d.ts +24 -3
  31. package/dist/git-cli/exec/git.js +116 -12
  32. package/dist/git-cli/exec/git.js.map +1 -1
  33. package/dist/git-cli/parsers/reflogParser.d.ts +7 -0
  34. package/dist/git-cli/parsers/reflogParser.js +11 -1
  35. package/dist/git-cli/parsers/reflogParser.js.map +1 -1
  36. package/dist/git-cli/providers/branches.js +16 -14
  37. package/dist/git-cli/providers/branches.js.map +1 -1
  38. package/dist/git-cli/providers/commits.d.ts +4 -2
  39. package/dist/git-cli/providers/commits.js +55 -4
  40. package/dist/git-cli/providers/commits.js.map +1 -1
  41. package/dist/git-cli/providers/diff.js +4 -4
  42. package/dist/git-cli/providers/diff.js.map +1 -1
  43. package/dist/git-cli/providers/operations.d.ts +12 -0
  44. package/dist/git-cli/providers/operations.js +26 -3
  45. package/dist/git-cli/providers/operations.js.map +1 -1
  46. package/dist/git-cli/providers/patch.js +2 -5
  47. package/dist/git-cli/providers/patch.js.map +1 -1
  48. package/dist/git-cli/providers/refs.d.ts +5 -0
  49. package/dist/git-cli/providers/refs.js +26 -1
  50. package/dist/git-cli/providers/refs.js.map +1 -1
  51. package/dist/git-cli/providers/remotes.js +3 -2
  52. package/dist/git-cli/providers/remotes.js.map +1 -1
  53. package/dist/git-cli/providers/revision.d.ts +2 -0
  54. package/dist/git-cli/providers/revision.js +11 -0
  55. package/dist/git-cli/providers/revision.js.map +1 -1
  56. package/dist/git-cli/providers/staging.d.ts +2 -1
  57. package/dist/git-cli/providers/staging.js +12 -7
  58. package/dist/git-cli/providers/staging.js.map +1 -1
  59. package/dist/git-cli/providers/stash.d.ts +3 -2
  60. package/dist/git-cli/providers/stash.js +34 -22
  61. package/dist/git-cli/providers/stash.js.map +1 -1
  62. package/dist/git-cli/providers/status.d.ts +2 -0
  63. package/dist/git-cli/providers/status.js +27 -9
  64. package/dist/git-cli/providers/status.js.map +1 -1
  65. package/dist/plus/git-github/providers/github/commits.d.ts +4 -2
  66. package/dist/plus/git-github/providers/github/commits.js +3 -1
  67. package/dist/plus/git-github/providers/github/commits.js.map +1 -1
  68. package/dist/plus/git-github/providers/github/revision.d.ts +1 -0
  69. package/dist/plus/git-github/providers/github/revision.js +5 -0
  70. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  71. package/docs/kepler-git-write-api-parity.md +140 -14
  72. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  //#region ../git/src/features.d.ts
2
- export type GitFeatures = 'git:checkout:pathspec-from-file' | 'git:commit-graph' | 'git:commit-graph:changed-paths' | 'git:for-each-ref:worktreePath' | 'git:fsmonitor' | 'git:fsmonitor:linux' | 'git:ignoreRevsFile' | 'git:index:skipHash' | 'git:maintenance' | 'git:maintenance:pack-refs' | 'git:maintenance:start' | 'git:maintenance:start:systemd' | 'git:manyFiles' | 'git:merge-tree:merge-base' | 'git:merge-tree:write-tree' | 'git:push:force-if-includes' | 'git:rebase:autosquash' | 'git:rev-parse:end-of-options' | 'git:signing:ssh' | 'git:signing:x509' | 'git:sparse-index' | 'git:stash:push:pathspecs' | 'git:stash:push:staged' | 'git:stash:push:stdin' | 'git:status:find-renames' | 'git:status:porcelain-v2' | 'git:untrackedCache' | 'git:worktrees';
2
+ export type GitFeatures = 'git:checkout:pathspec-from-file' | 'git:commit-graph' | 'git:commit-graph:changed-paths' | 'git:fetch:no-write-fetch-head' | 'git:for-each-ref:worktreePath' | 'git:fsmonitor' | 'git:fsmonitor:linux' | 'git:ignoreRevsFile' | 'git:index:skipHash' | 'git:maintenance' | 'git:maintenance:pack-refs' | 'git:maintenance:start' | 'git:maintenance:start:systemd' | 'git:manyFiles' | 'git:merge-tree:merge-base' | 'git:merge-tree:write-tree' | 'git:push:force-if-includes' | 'git:rebase:autosquash' | 'git:rev-parse:end-of-options' | 'git:signing:ssh' | 'git:signing:x509' | 'git:sparse-index' | 'git:stash:push:pathspecs' | 'git:stash:push:staged' | 'git:stash:push:stdin' | 'git:status:find-renames' | 'git:status:porcelain-v2' | 'git:untrackedCache' | 'git:worktrees';
3
3
  type ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}` ? Rest extends `${infer SubPrefix}:${string}` ? T | `${Prefix}:${SubPrefix}` | Prefix : T | Prefix : never;
4
4
  export type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;
5
5
  export type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures ? T : Extract<GitFeatures, T | `${T}:${string}`>;
@@ -4,6 +4,7 @@ const gitFeaturesByVersion = /* @__PURE__ */ new Map([
4
4
  ["git:checkout:pathspec-from-file", "2.26"],
5
5
  ["git:commit-graph", "2.24"],
6
6
  ["git:commit-graph:changed-paths", "2.31"],
7
+ ["git:fetch:no-write-fetch-head", "2.29"],
7
8
  ["git:for-each-ref:worktreePath", "2.23"],
8
9
  ["git:fsmonitor", "2.37"],
9
10
  ["git:fsmonitor:linux", "2.55"],
@@ -1 +1 @@
1
- {"version":3,"file":"features.js","names":[],"sources":["../../../git/src/features.ts"],"sourcesContent":["// GitFeature's must start with `git:` to be recognized in all usages\nexport type GitFeatures =\n\t| 'git:checkout:pathspec-from-file'\n\t| 'git:commit-graph'\n\t| 'git:commit-graph:changed-paths'\n\t| 'git:for-each-ref:worktreePath'\n\t| 'git:fsmonitor'\n\t| 'git:fsmonitor:linux'\n\t| 'git:ignoreRevsFile'\n\t| 'git:index:skipHash'\n\t| 'git:maintenance'\n\t| 'git:maintenance:pack-refs'\n\t| 'git:maintenance:start'\n\t| 'git:maintenance:start:systemd'\n\t| 'git:manyFiles'\n\t| 'git:merge-tree:merge-base'\n\t| 'git:merge-tree:write-tree'\n\t| 'git:push:force-if-includes'\n\t| 'git:rebase:autosquash'\n\t| 'git:rev-parse:end-of-options'\n\t| 'git:signing:ssh'\n\t| 'git:signing:x509'\n\t| 'git:sparse-index'\n\t| 'git:stash:push:pathspecs'\n\t| 'git:stash:push:staged'\n\t| 'git:stash:push:stdin'\n\t| 'git:status:find-renames'\n\t| 'git:status:porcelain-v2'\n\t| 'git:untrackedCache'\n\t| 'git:worktrees';\n\ntype ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}`\n\t? Rest extends `${infer SubPrefix}:${string}`\n\t\t? T | `${Prefix}:${SubPrefix}` | Prefix\n\t\t: T | Prefix\n\t: never;\n\nexport type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;\nexport type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures\n\t? T\n\t: Extract<GitFeatures, T | `${T}:${string}`>;\n\nexport const gitMinimumVersion = '2.7.2';\nexport const gitFeaturesByVersion = new Map<GitFeatures, string>([\n\t['git:checkout:pathspec-from-file', '2.26'],\n\t// 2.24 is when git READS the commit-graph file by default (core.commitGraph on); writing it for\n\t// older gits would be dead weight.\n\t['git:commit-graph', '2.24'],\n\t// Changed-path Bloom filters (`--changed-paths`), the v2 filter format — pre-2.31 shipped Bloom filters\n\t// with real correctness bugs (bad results for merge commits), so 2.31 is the safe floor to write them.\n\t['git:commit-graph:changed-paths', '2.31'],\n\t['git:for-each-ref:worktreePath', '2.23'],\n\t// `core.fsmonitor=true` selects the built-in FSMonitor daemon (accepting a bool rather than only a\n\t// hook path). This 2.37 floor is the Windows + macOS one.\n\t['git:fsmonitor', '2.37'],\n\t// Linux got its own FSMonitor backend (inotify) only in 2.55, hence a separate floor. Note the backend\n\t// places a watch on EVERY directory, so a large repo can exhaust `fs.inotify.max_user_watches` and the\n\t// daemon fails at runtime even on a new enough git — the apply path must still probe, not just gate.\n\t['git:fsmonitor:linux', '2.55'],\n\t['git:ignoreRevsFile', '2.23'],\n\t// `index.skipHash` (skip the trailing index checksum for faster writes); part of `feature.manyFiles`.\n\t['git:index:skipHash', '2.40'],\n\t// `git maintenance run --task=…`. The `maintenance` builtin + `commit-graph`/`gc` tasks are 2.29, but\n\t// the loose-objects + incremental-repack tasks the auto tier uses landed in 2.30 (and `core.multiPackIndex`\n\t// is default-on from 2.30, so no separate midx config write is needed) — 2.30 is the safe floor.\n\t['git:maintenance', '2.30'],\n\t// The pack-refs maintenance task landed one release after the maintenance builtin.\n\t['git:maintenance:pack-refs', '2.31'],\n\t// `git maintenance start` — the subcommands exist from 2.30 (cron only); launchctl (macOS) + schtasks\n\t// (Windows) scheduling arrived in 2.31, so 2.31 is the cross-platform-safe floor.\n\t['git:maintenance:start', '2.31'],\n\t// `git maintenance start` systemd-timer scheduling. On Linux, 2.31–2.33 is cron-only and modern distros\n\t// often ship without cron (scheduling then silently fails); the systemd fallback arrived in 2.34.\n\t['git:maintenance:start:systemd', '2.34'],\n\t// `feature.manyFiles` umbrella (index v4 + untracked cache + skipHash where available).\n\t['git:manyFiles', '2.24'],\n\t['git:merge-tree:merge-base', '2.40'],\n\t// `merge-tree --write-tree` mode with `-z`/`--name-only`/`--no-messages`; the older trivial mode can't check conflicts\n\t['git:merge-tree:write-tree', '2.38'],\n\t['git:push:force-if-includes', '2.30.0'],\n\t// `--autosquash` WITHOUT `-i` (folding `fixup!`/`squash!` commits into a plain/automatic rebase).\n\t// Interactive rebases support autosquash on every git version GitLens supports, so this floor only\n\t// gates the non-interactive path.\n\t['git:rebase:autosquash', '2.44'],\n\t['git:rev-parse:end-of-options', '2.30'],\n\t['git:signing:ssh', '2.34.0'],\n\t['git:signing:x509', '2.19.0'],\n\t// Sparse-index support debuted earlier, but 2.33 shipped a corruption fix and 2.34 broadened command\n\t// support. Use 2.34 as the conservative floor before offering a repository mutation.\n\t['git:sparse-index', '2.34'],\n\t['git:stash:push:pathspecs', '2.13.2'],\n\t['git:stash:push:staged', '2.35.0'],\n\t['git:stash:push:stdin', '2.30.0'],\n\t['git:status:find-renames', '2.18'],\n\t['git:status:porcelain-v2', '2.11'],\n\t// `core.untrackedCache=true` (repo-local cache of untracked-file scans — the auto-tier config lever).\n\t['git:untrackedCache', '2.8'],\n\t['git:worktrees', '2.17.0'],\n]);\n"],"mappings":";AA0CA,MAAa,oBAAoB;AACjC,MAAa,uCAAuB,IAAI,IAAyB;CAChE,CAAC,mCAAmC,MAAM;CAG1C,CAAC,oBAAoB,MAAM;CAG3B,CAAC,kCAAkC,MAAM;CACzC,CAAC,iCAAiC,MAAM;CAGxC,CAAC,iBAAiB,MAAM;CAIxB,CAAC,uBAAuB,MAAM;CAC9B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,sBAAsB,MAAM;CAI7B,CAAC,mBAAmB,MAAM;CAE1B,CAAC,6BAA6B,MAAM;CAGpC,CAAC,yBAAyB,MAAM;CAGhC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iBAAiB,MAAM;CACxB,CAAC,6BAA6B,MAAM;CAEpC,CAAC,6BAA6B,MAAM;CACpC,CAAC,8BAA8B,QAAQ;CAIvC,CAAC,yBAAyB,MAAM;CAChC,CAAC,gCAAgC,MAAM;CACvC,CAAC,mBAAmB,QAAQ;CAC5B,CAAC,oBAAoB,QAAQ;CAG7B,CAAC,oBAAoB,MAAM;CAC3B,CAAC,4BAA4B,QAAQ;CACrC,CAAC,yBAAyB,QAAQ;CAClC,CAAC,wBAAwB,QAAQ;CACjC,CAAC,2BAA2B,MAAM;CAClC,CAAC,2BAA2B,MAAM;CAElC,CAAC,sBAAsB,KAAK;CAC5B,CAAC,iBAAiB,QAAQ;AAC3B,CAAC"}
1
+ {"version":3,"file":"features.js","names":[],"sources":["../../../git/src/features.ts"],"sourcesContent":["// GitFeature's must start with `git:` to be recognized in all usages\nexport type GitFeatures =\n\t| 'git:checkout:pathspec-from-file'\n\t| 'git:commit-graph'\n\t| 'git:commit-graph:changed-paths'\n\t| 'git:fetch:no-write-fetch-head'\n\t| 'git:for-each-ref:worktreePath'\n\t| 'git:fsmonitor'\n\t| 'git:fsmonitor:linux'\n\t| 'git:ignoreRevsFile'\n\t| 'git:index:skipHash'\n\t| 'git:maintenance'\n\t| 'git:maintenance:pack-refs'\n\t| 'git:maintenance:start'\n\t| 'git:maintenance:start:systemd'\n\t| 'git:manyFiles'\n\t| 'git:merge-tree:merge-base'\n\t| 'git:merge-tree:write-tree'\n\t| 'git:push:force-if-includes'\n\t| 'git:rebase:autosquash'\n\t| 'git:rev-parse:end-of-options'\n\t| 'git:signing:ssh'\n\t| 'git:signing:x509'\n\t| 'git:sparse-index'\n\t| 'git:stash:push:pathspecs'\n\t| 'git:stash:push:staged'\n\t| 'git:stash:push:stdin'\n\t| 'git:status:find-renames'\n\t| 'git:status:porcelain-v2'\n\t| 'git:untrackedCache'\n\t| 'git:worktrees';\n\ntype ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}`\n\t? Rest extends `${infer SubPrefix}:${string}`\n\t\t? T | `${Prefix}:${SubPrefix}` | Prefix\n\t\t: T | Prefix\n\t: never;\n\nexport type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;\nexport type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures\n\t? T\n\t: Extract<GitFeatures, T | `${T}:${string}`>;\n\nexport const gitMinimumVersion = '2.7.2';\nexport const gitFeaturesByVersion = new Map<GitFeatures, string>([\n\t['git:checkout:pathspec-from-file', '2.26'],\n\t// 2.24 is when git READS the commit-graph file by default (core.commitGraph on); writing it for\n\t// older gits would be dead weight.\n\t['git:commit-graph', '2.24'],\n\t// Changed-path Bloom filters (`--changed-paths`), the v2 filter format — pre-2.31 shipped Bloom filters\n\t// with real correctness bugs (bad results for merge commits), so 2.31 is the safe floor to write them.\n\t['git:commit-graph:changed-paths', '2.31'],\n\t['git:fetch:no-write-fetch-head', '2.29'],\n\t['git:for-each-ref:worktreePath', '2.23'],\n\t// `core.fsmonitor=true` selects the built-in FSMonitor daemon (accepting a bool rather than only a\n\t// hook path). This 2.37 floor is the Windows + macOS one.\n\t['git:fsmonitor', '2.37'],\n\t// Linux got its own FSMonitor backend (inotify) only in 2.55, hence a separate floor. Note the backend\n\t// places a watch on EVERY directory, so a large repo can exhaust `fs.inotify.max_user_watches` and the\n\t// daemon fails at runtime even on a new enough git — the apply path must still probe, not just gate.\n\t['git:fsmonitor:linux', '2.55'],\n\t['git:ignoreRevsFile', '2.23'],\n\t// `index.skipHash` (skip the trailing index checksum for faster writes); part of `feature.manyFiles`.\n\t['git:index:skipHash', '2.40'],\n\t// `git maintenance run --task=…`. The `maintenance` builtin + `commit-graph`/`gc` tasks are 2.29, but\n\t// the loose-objects + incremental-repack tasks the auto tier uses landed in 2.30 (and `core.multiPackIndex`\n\t// is default-on from 2.30, so no separate midx config write is needed) — 2.30 is the safe floor.\n\t['git:maintenance', '2.30'],\n\t// The pack-refs maintenance task landed one release after the maintenance builtin.\n\t['git:maintenance:pack-refs', '2.31'],\n\t// `git maintenance start` — the subcommands exist from 2.30 (cron only); launchctl (macOS) + schtasks\n\t// (Windows) scheduling arrived in 2.31, so 2.31 is the cross-platform-safe floor.\n\t['git:maintenance:start', '2.31'],\n\t// `git maintenance start` systemd-timer scheduling. On Linux, 2.31–2.33 is cron-only and modern distros\n\t// often ship without cron (scheduling then silently fails); the systemd fallback arrived in 2.34.\n\t['git:maintenance:start:systemd', '2.34'],\n\t// `feature.manyFiles` umbrella (index v4 + untracked cache + skipHash where available).\n\t['git:manyFiles', '2.24'],\n\t['git:merge-tree:merge-base', '2.40'],\n\t// `merge-tree --write-tree` mode with `-z`/`--name-only`/`--no-messages`; the older trivial mode can't check conflicts\n\t['git:merge-tree:write-tree', '2.38'],\n\t['git:push:force-if-includes', '2.30.0'],\n\t// `--autosquash` WITHOUT `-i` (folding `fixup!`/`squash!` commits into a plain/automatic rebase).\n\t// Interactive rebases support autosquash on every git version GitLens supports, so this floor only\n\t// gates the non-interactive path.\n\t['git:rebase:autosquash', '2.44'],\n\t['git:rev-parse:end-of-options', '2.30'],\n\t['git:signing:ssh', '2.34.0'],\n\t['git:signing:x509', '2.19.0'],\n\t// Sparse-index support debuted earlier, but 2.33 shipped a corruption fix and 2.34 broadened command\n\t// support. Use 2.34 as the conservative floor before offering a repository mutation.\n\t['git:sparse-index', '2.34'],\n\t['git:stash:push:pathspecs', '2.13.2'],\n\t['git:stash:push:staged', '2.35.0'],\n\t['git:stash:push:stdin', '2.30.0'],\n\t['git:status:find-renames', '2.18'],\n\t['git:status:porcelain-v2', '2.11'],\n\t// `core.untrackedCache=true` (repo-local cache of untracked-file scans — the auto-tier config lever).\n\t['git:untrackedCache', '2.8'],\n\t['git:worktrees', '2.17.0'],\n]);\n"],"mappings":";AA2CA,MAAa,oBAAoB;AACjC,MAAa,uCAAuB,IAAI,IAAyB;CAChE,CAAC,mCAAmC,MAAM;CAG1C,CAAC,oBAAoB,MAAM;CAG3B,CAAC,kCAAkC,MAAM;CACzC,CAAC,iCAAiC,MAAM;CACxC,CAAC,iCAAiC,MAAM;CAGxC,CAAC,iBAAiB,MAAM;CAIxB,CAAC,uBAAuB,MAAM;CAC9B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,sBAAsB,MAAM;CAI7B,CAAC,mBAAmB,MAAM;CAE1B,CAAC,6BAA6B,MAAM;CAGpC,CAAC,yBAAyB,MAAM;CAGhC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iBAAiB,MAAM;CACxB,CAAC,6BAA6B,MAAM;CAEpC,CAAC,6BAA6B,MAAM;CACpC,CAAC,8BAA8B,QAAQ;CAIvC,CAAC,yBAAyB,MAAM;CAChC,CAAC,gCAAgC,MAAM;CACvC,CAAC,mBAAmB,QAAQ;CAC5B,CAAC,oBAAoB,QAAQ;CAG7B,CAAC,oBAAoB,MAAM;CAC3B,CAAC,4BAA4B,QAAQ;CACrC,CAAC,yBAAyB,QAAQ;CAClC,CAAC,wBAAwB,QAAQ;CACjC,CAAC,2BAA2B,MAAM;CAClC,CAAC,2BAA2B,MAAM;CAElC,CAAC,sBAAsB,KAAK;CAC5B,CAAC,iBAAiB,QAAQ;AAC3B,CAAC"}
@@ -1,5 +1,11 @@
1
1
  import { Shape } from "../../utils/types.js";
2
2
  //#region ../git/src/models/reflog.d.ts
3
+ /** One entry of `refs.getReflogEntries`; {@link GitReflog} is the aggregated HEAD walk instead */
4
+ export interface GitReflogEntry {
5
+ readonly sha: string;
6
+ /** The reflog subject, `%gs`. */
7
+ readonly message: string;
8
+ }
3
9
  export interface GitReflog {
4
10
  readonly repoPath: string;
5
11
  readonly records: GitReflogRecord[];
@@ -1 +1 @@
1
- {"version":3,"file":"reflog.js","names":[],"sources":["../../../../git/src/models/reflog.ts"],"sourcesContent":["import { formatDate, fromNow } from '@gitlens/utils/date.js';\nimport { loggable } from '@gitlens/utils/decorators/log.js';\nimport { memoize } from '@gitlens/utils/decorators/memoize.js';\nimport type { Shape } from '@gitlens/utils/types.js';\nimport { shortenRevision } from '../utils/revision.utils.js';\n\nexport interface GitReflog {\n\treadonly repoPath: string;\n\treadonly records: GitReflogRecord[];\n\n\treadonly count: number;\n\treadonly total: number;\n\treadonly limit: number | undefined;\n\treadonly hasMore: boolean;\n\tmore?(limit: number | undefined): Promise<GitReflog | undefined>;\n}\n\nexport type GitReflogRecordShape = Shape<GitReflogRecord>;\n\n@loggable(i => `${shortenRevision(i.sha)}|${i.command}`)\nexport class GitReflogRecord {\n\tprivate _previousSha: string | undefined;\n\n\tconstructor(\n\t\tpublic readonly repoPath: string,\n\t\tpublic readonly sha: string,\n\t\tprivate _selector: string,\n\t\tpublic readonly date: Date,\n\t\tpublic readonly command: string,\n\t\tpublic readonly commandArgs: string | undefined,\n\t\tpublic readonly details: string | undefined,\n\t) {}\n\n\t@memoize()\n\tget HEAD(): string {\n\t\tif (this._selector == null || this._selector.length === 0) return '';\n\n\t\tif (this._selector.startsWith('refs/heads')) {\n\t\t\treturn this._selector.substring(11);\n\t\t}\n\n\t\tif (this._selector.startsWith('refs/remotes')) {\n\t\t\treturn this._selector.substring(13);\n\t\t}\n\n\t\treturn this._selector;\n\t}\n\n\tget previousSha(): string | undefined {\n\t\treturn this._previousSha;\n\t}\n\n\t@memoize()\n\tget previousShortSha(): string {\n\t\treturn shortenRevision(this._previousSha);\n\t}\n\n\tget selector(): string {\n\t\treturn this._selector;\n\t}\n\n\t@memoize()\n\tget shortSha(): string {\n\t\treturn shortenRevision(this.sha);\n\t}\n\n\t/** @internal Called by the parser to set previousSha/selector before the record is published */\n\tupdate(previousSha?: string, selector?: string): void {\n\t\tif (previousSha !== undefined) {\n\t\t\tthis._previousSha = previousSha;\n\t\t}\n\t\tif (selector !== undefined) {\n\t\t\tthis._selector = selector;\n\t\t}\n\t}\n\n\tstatic is(record: unknown): record is GitReflogRecord {\n\t\treturn record instanceof GitReflogRecord;\n\t}\n\n\tstatic formatDate(record: GitReflogRecordShape, format?: string | null): string {\n\t\treturn formatDate(record.date, format ?? 'MMMM Do, YYYY h:mma');\n\t}\n\n\tstatic formatDateFromNow(record: GitReflogRecordShape): string {\n\t\treturn fromNow(record.date);\n\t}\n}\n"],"mappings":";;;;;;;AAoBO,IAAM,kBAAA,mBAAN,MAAM,gBAAgB;CAIX;CACA;CACR;CACQ;CACA;CACA;CACA;CATjB;CAEA,YACC,UACA,KACA,WACA,MACA,SACA,aACA,SACC;EAPe,KAAA,WAAA;EACA,KAAA,MAAA;EACR,KAAA,YAAA;EACQ,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,cAAA;EACA,KAAA,UAAA;CACd;CAEH,IACI,OAAe;EAClB,IAAI,KAAK,aAAa,QAAQ,KAAK,UAAU,WAAW,GAAG,OAAO;EAElE,IAAI,KAAK,UAAU,WAAW,YAAY,GACzC,OAAO,KAAK,UAAU,UAAU,EAAE;EAGnC,IAAI,KAAK,UAAU,WAAW,cAAc,GAC3C,OAAO,KAAK,UAAU,UAAU,EAAE;EAGnC,OAAO,KAAK;CACb;CAEA,IAAI,cAAkC;EACrC,OAAO,KAAK;CACb;CAEA,IACI,mBAA2B;EAC9B,OAAO,gBAAgB,KAAK,YAAY;CACzC;CAEA,IAAI,WAAmB;EACtB,OAAO,KAAK;CACb;CAEA,IACI,WAAmB;EACtB,OAAO,gBAAgB,KAAK,GAAG;CAChC;;CAGA,OAAO,aAAsB,UAAyB;EACrD,IAAI,gBAAgB,KAAA,GACnB,KAAK,eAAe;EAErB,IAAI,aAAa,KAAA,GAChB,KAAK,YAAY;CAEnB;CAEA,OAAO,GAAG,QAA4C;EACrD,OAAO,kBAAA;CACR;CAEA,OAAO,WAAW,QAA8B,QAAgC;EAC/E,OAAO,WAAW,OAAO,MAAM,UAAU,qBAAqB;CAC/D;CAEA,OAAO,kBAAkB,QAAsC;EAC9D,OAAO,QAAQ,OAAO,IAAI;CAC3B;AACD;AAtDE,WAAA,CAAA,QAAQ,CAAA,GAAA,gBAAA,WAAA,QAAA,IAAA;AAmBR,WAAA,CAAA,QAAQ,CAAA,GAAA,gBAAA,WAAA,oBAAA,IAAA;AASR,WAAA,CAAA,QAAQ,CAAA,GAAA,gBAAA,WAAA,YAAA,IAAA;AA1CT,kBAAA,mBAAA,WAAA,CAAA,UAAS,MAAK,GAAG,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAA,GAAA,eAAA"}
1
+ {"version":3,"file":"reflog.js","names":[],"sources":["../../../../git/src/models/reflog.ts"],"sourcesContent":["import { formatDate, fromNow } from '@gitlens/utils/date.js';\nimport { loggable } from '@gitlens/utils/decorators/log.js';\nimport { memoize } from '@gitlens/utils/decorators/memoize.js';\nimport type { Shape } from '@gitlens/utils/types.js';\nimport { shortenRevision } from '../utils/revision.utils.js';\n\n/** One entry of `refs.getReflogEntries`; {@link GitReflog} is the aggregated HEAD walk instead */\nexport interface GitReflogEntry {\n\treadonly sha: string;\n\t/** The reflog subject, `%gs`. */\n\treadonly message: string;\n}\n\nexport interface GitReflog {\n\treadonly repoPath: string;\n\treadonly records: GitReflogRecord[];\n\n\treadonly count: number;\n\treadonly total: number;\n\treadonly limit: number | undefined;\n\treadonly hasMore: boolean;\n\tmore?(limit: number | undefined): Promise<GitReflog | undefined>;\n}\n\nexport type GitReflogRecordShape = Shape<GitReflogRecord>;\n\n@loggable(i => `${shortenRevision(i.sha)}|${i.command}`)\nexport class GitReflogRecord {\n\tprivate _previousSha: string | undefined;\n\n\tconstructor(\n\t\tpublic readonly repoPath: string,\n\t\tpublic readonly sha: string,\n\t\tprivate _selector: string,\n\t\tpublic readonly date: Date,\n\t\tpublic readonly command: string,\n\t\tpublic readonly commandArgs: string | undefined,\n\t\tpublic readonly details: string | undefined,\n\t) {}\n\n\t@memoize()\n\tget HEAD(): string {\n\t\tif (this._selector == null || this._selector.length === 0) return '';\n\n\t\tif (this._selector.startsWith('refs/heads')) {\n\t\t\treturn this._selector.substring(11);\n\t\t}\n\n\t\tif (this._selector.startsWith('refs/remotes')) {\n\t\t\treturn this._selector.substring(13);\n\t\t}\n\n\t\treturn this._selector;\n\t}\n\n\tget previousSha(): string | undefined {\n\t\treturn this._previousSha;\n\t}\n\n\t@memoize()\n\tget previousShortSha(): string {\n\t\treturn shortenRevision(this._previousSha);\n\t}\n\n\tget selector(): string {\n\t\treturn this._selector;\n\t}\n\n\t@memoize()\n\tget shortSha(): string {\n\t\treturn shortenRevision(this.sha);\n\t}\n\n\t/** @internal Called by the parser to set previousSha/selector before the record is published */\n\tupdate(previousSha?: string, selector?: string): void {\n\t\tif (previousSha !== undefined) {\n\t\t\tthis._previousSha = previousSha;\n\t\t}\n\t\tif (selector !== undefined) {\n\t\t\tthis._selector = selector;\n\t\t}\n\t}\n\n\tstatic is(record: unknown): record is GitReflogRecord {\n\t\treturn record instanceof GitReflogRecord;\n\t}\n\n\tstatic formatDate(record: GitReflogRecordShape, format?: string | null): string {\n\t\treturn formatDate(record.date, format ?? 'MMMM Do, YYYY h:mma');\n\t}\n\n\tstatic formatDateFromNow(record: GitReflogRecordShape): string {\n\t\treturn fromNow(record.date);\n\t}\n}\n"],"mappings":";;;;;;;AA2BO,IAAM,kBAAA,mBAAN,MAAM,gBAAgB;CAIX;CACA;CACR;CACQ;CACA;CACA;CACA;CATjB;CAEA,YACC,UACA,KACA,WACA,MACA,SACA,aACA,SACC;EAPe,KAAA,WAAA;EACA,KAAA,MAAA;EACR,KAAA,YAAA;EACQ,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,cAAA;EACA,KAAA,UAAA;CACd;CAEH,IACI,OAAe;EAClB,IAAI,KAAK,aAAa,QAAQ,KAAK,UAAU,WAAW,GAAG,OAAO;EAElE,IAAI,KAAK,UAAU,WAAW,YAAY,GACzC,OAAO,KAAK,UAAU,UAAU,EAAE;EAGnC,IAAI,KAAK,UAAU,WAAW,cAAc,GAC3C,OAAO,KAAK,UAAU,UAAU,EAAE;EAGnC,OAAO,KAAK;CACb;CAEA,IAAI,cAAkC;EACrC,OAAO,KAAK;CACb;CAEA,IACI,mBAA2B;EAC9B,OAAO,gBAAgB,KAAK,YAAY;CACzC;CAEA,IAAI,WAAmB;EACtB,OAAO,KAAK;CACb;CAEA,IACI,WAAmB;EACtB,OAAO,gBAAgB,KAAK,GAAG;CAChC;;CAGA,OAAO,aAAsB,UAAyB;EACrD,IAAI,gBAAgB,KAAA,GACnB,KAAK,eAAe;EAErB,IAAI,aAAa,KAAA,GAChB,KAAK,YAAY;CAEnB;CAEA,OAAO,GAAG,QAA4C;EACrD,OAAO,kBAAA;CACR;CAEA,OAAO,WAAW,QAA8B,QAAgC;EAC/E,OAAO,WAAW,OAAO,MAAM,UAAU,qBAAqB;CAC/D;CAEA,OAAO,kBAAkB,QAAsC;EAC9D,OAAO,QAAQ,OAAO,IAAI;CAC3B;AACD;AAtDE,WAAA,CAAA,QAAQ,CAAA,GAAA,gBAAA,WAAA,QAAA,IAAA;AAmBR,WAAA,CAAA,QAAQ,CAAA,GAAA,gBAAA,WAAA,oBAAA,IAAA;AASR,WAAA,CAAA,QAAQ,CAAA,GAAA,gBAAA,WAAA,YAAA,IAAA;AA1CT,kBAAA,mBAAA,WAAA,CAAA,UAAS,MAAK,GAAG,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAA,GAAA,eAAA"}
@@ -2,7 +2,6 @@
2
2
  export declare const deletedOrMissing = "0000000000000000000000000000000000000000-";
3
3
  export declare const uncommitted = "0000000000000000000000000000000000000000";
4
4
  export declare const uncommittedStaged = "0000000000000000000000000000000000000000:";
5
- export declare const rootSha = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
6
5
  export type GitRevisionRange = `${GitRevisionRangeNotation}${string}` | `${string}${GitRevisionRangeNotation}` | `${string}${GitRevisionRangeNotation}${string}`;
7
6
  export type GitRevisionRangeNotation = '..' | '...';
8
7
  //#endregion
@@ -2,8 +2,7 @@
2
2
  const deletedOrMissing = "0000000000000000000000000000000000000000-";
3
3
  const uncommitted = "0000000000000000000000000000000000000000";
4
4
  const uncommittedStaged = "0000000000000000000000000000000000000000:";
5
- const rootSha = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
6
5
  //#endregion
7
- export { deletedOrMissing, rootSha, uncommitted, uncommittedStaged };
6
+ export { deletedOrMissing, uncommitted, uncommittedStaged };
8
7
 
9
8
  //# sourceMappingURL=revision.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"revision.js","names":[],"sources":["../../../../git/src/models/revision.ts"],"sourcesContent":["export const deletedOrMissing = '0000000000000000000000000000000000000000-';\nexport const uncommitted = '0000000000000000000000000000000000000000';\nexport const uncommittedStaged = '0000000000000000000000000000000000000000:';\n// This is a root sha of all git repo's if using sha1\nexport const rootSha = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';\n\nexport type GitRevisionRange =\n\t| `${GitRevisionRangeNotation}${string}`\n\t| `${string}${GitRevisionRangeNotation}`\n\t| `${string}${GitRevisionRangeNotation}${string}`;\n\nexport type GitRevisionRangeNotation = '..' | '...';\n"],"mappings":";AAAA,MAAa,mBAAmB;AAChC,MAAa,cAAc;AAC3B,MAAa,oBAAoB;AAEjC,MAAa,UAAU"}
1
+ {"version":3,"file":"revision.js","names":[],"sources":["../../../../git/src/models/revision.ts"],"sourcesContent":["export const deletedOrMissing = '0000000000000000000000000000000000000000-';\nexport const uncommitted = '0000000000000000000000000000000000000000';\nexport const uncommittedStaged = '0000000000000000000000000000000000000000:';\n\nexport type GitRevisionRange =\n\t| `${GitRevisionRangeNotation}${string}`\n\t| `${string}${GitRevisionRangeNotation}`\n\t| `${string}${GitRevisionRangeNotation}${string}`;\n\nexport type GitRevisionRangeNotation = '..' | '...';\n"],"mappings":";AAAA,MAAa,mBAAmB;AAChC,MAAa,cAAc;AAC3B,MAAa,oBAAoB"}
@@ -45,6 +45,8 @@ export interface GitLogForPathOptions extends Omit<GitLogOptions, 'stashes'> {
45
45
  export interface GitLogShasOptions extends GitLogOptionsBase {
46
46
  all?: boolean;
47
47
  authors?: GitUser[];
48
+ /** Leaves out commits reachable from these refs, relative to `rev` (`HEAD` when omitted) — see {@link GitRefExclusions} */
49
+ excluding?: GitRefExclusions;
48
50
  merges?: boolean | 'first-parent';
49
51
  pathOrUri?: string | Uri;
50
52
  reverse?: boolean;
@@ -63,6 +65,20 @@ export interface IncomingActivityOptions extends GitLogOptionsBase {
63
65
  branch?: string;
64
66
  skip?: number;
65
67
  }
68
+ /**
69
+ * Refs whose commits a history read (`getCommitCount`, `getLogShas`) leaves out, as `--not`.
70
+ * `branches`/`remotes`/`tags` exclude every ref in that namespace; `except` carves full ref names or globs (`refs/heads/feat`, `refs/remotes/origin/*`)
71
+ * back out of an enabled namespace and is ignored otherwise; `refs` are further revisions, passed verbatim.
72
+ * A read is cached until a branch, remote-tracking branch or tag changes, so a `refs` entry outside those namespaces
73
+ * (a tool's own `refs/<tool>/…`) can move without refreshing it: pass that ref's SHA instead, which keys a new read.
74
+ */
75
+ export interface GitRefExclusions {
76
+ branches?: boolean;
77
+ remotes?: boolean;
78
+ tags?: boolean;
79
+ refs?: readonly string[];
80
+ except?: readonly string[];
81
+ }
66
82
  export interface GitCommitReachability {
67
83
  readonly partial?: boolean;
68
84
  readonly refs: ({
@@ -78,7 +94,10 @@ export interface GitCommitReachability {
78
94
  }
79
95
  export interface GitCommitsSubProvider {
80
96
  getCommit(repoPath: string, rev: string, cancellation?: AbortSignal): Promise<GitCommit | undefined>;
81
- getCommitCount(repoPath: string, rev: string, cancellation?: AbortSignal): Promise<number | undefined>;
97
+ /** Counts the commits reachable from `rev`, less any reachable from `excluding` — e.g. what only one branch has */
98
+ getCommitCount(repoPath: string, rev: string, options?: {
99
+ excluding?: GitRefExclusions;
100
+ }, cancellation?: AbortSignal): Promise<number | undefined>;
82
101
  /** Whether `rev` has any commits not reachable from any remote-tracking ref (i.e. unpushed/unpublished).
83
102
  * Cheap early-exit probe (`rev-list --not --remotes <rev> -n 1`) — it does NOT count them. Returns
84
103
  * `undefined` when it can't be determined. */
@@ -47,6 +47,19 @@ export interface GitOperationsSubProvider {
47
47
  prune?: boolean | undefined;
48
48
  pull?: boolean | undefined;
49
49
  remote?: string | undefined;
50
+ refspecs?: undefined;
51
+ /** Leaves `FETCH_HEAD` for a user's own `git pull` to read (`--no-write-fetch-head`); ignored on git older than 2.29 */
52
+ preserveFetchHead?: boolean | undefined;
53
+ } | {
54
+ all?: undefined;
55
+ branch?: undefined;
56
+ prune?: boolean | undefined;
57
+ pull?: undefined;
58
+ remote: string;
59
+ /** Passed verbatim after `remote`; never adds `-u`, so git keeps refusing to write into a checked-out branch. */
60
+ refspecs: readonly string[];
61
+ /** Leaves `FETCH_HEAD` for a user's own `git pull` to read (`--no-write-fetch-head`); ignored on git older than 2.29 */
62
+ preserveFetchHead?: boolean | undefined;
50
63
  }, runOptions?: GitOperationRunOptions): Promise<void>;
51
64
  merge(repoPath: string, ref: string, options?: {
52
65
  fastForward?: boolean | 'only';
@@ -8,12 +8,12 @@ import { GitBranchesSubProvider } from "./branches.js";
8
8
  import { GitContributorsSubProvider } from "./contributors.js";
9
9
  import { GitRevisionSubProvider } from "./revision.js";
10
10
  import { CachedGitTypes } from "../cache.js";
11
+ import { GitOperationRunOptions, GitOperationsSubProvider } from "./operations.js";
11
12
  import { GitBlameSubProvider } from "./blame.js";
12
13
  import { GitConfigSubProvider } from "./config.js";
13
14
  import { GitStagingSubProvider } from "./staging.js";
14
15
  import { GitDiffSubProvider } from "./diff.js";
15
16
  import { GitGraphSubProvider } from "./graph.js";
16
- import { GitOperationsSubProvider } from "./operations.js";
17
17
  import { GitPatchSubProvider } from "./patch.js";
18
18
  import { GitPausedOperationsSubProvider } from "./pausedOperations.js";
19
19
  import { GitRefsSubProvider } from "./refs.js";
@@ -33,7 +33,12 @@ export interface GitProvider {
33
33
  readonly descriptor: GitProviderDescriptor;
34
34
  getAbsoluteUri(pathOrUri: string | Uri, base: string | Uri): Uri;
35
35
  getRelativePath(pathOrUri: string | Uri, base: string | Uri): string;
36
- clone?(url: string, parentPath: string): Promise<string | undefined>;
36
+ clone?(url: string, parentPath: string, options?: {
37
+ /** Used exactly, with no collision probing or auto-numbering; git itself refuses a non-empty target. */
38
+ folderName?: string;
39
+ },
40
+ /** Spread into the run (`env`, `cancellation`, `timeout`) — the caller decides the timeout for a large clone. */
41
+ runOptions?: GitOperationRunOptions): Promise<string | undefined>;
37
42
  excludeIgnoredUris?(repoPath: string, uris: Uri[]): Promise<Uri[]>;
38
43
  getIgnoreFilter?(repoPath: string, gitDirPath: string): GitIgnoreFilter;
39
44
  getIgnoredUrisFilter?(repoPath: string): Promise<(uri: Uri) => boolean>;
@@ -47,8 +52,13 @@ export interface GitProvider {
47
52
  * Notifies the provider that `repoPath` was mutated outside of a typed sub-provider method — e.g. a
48
53
  * consumer that ran a command through the raw `git.run`/`provider.git.run` escape hatch. Fires the same
49
54
  * `cache.onReset`/`repository.onChanged` hooks a typed mutator would, so, exactly as after a typed write,
50
- * the provider clears its own caches for `repoPath` (every type, or just `options.cache` when given) and
51
- * its pending commands before the host's handlers run.
55
+ * the provider clears its own caches for `repoPath` and the repository's pending commands before the
56
+ * host's handlers run.
57
+ *
58
+ * What is reset: `options.cache` when given (`'all'` for everything, `[]` for nothing); otherwise the
59
+ * cache types `changes` map to, the same mapping a file watcher's changes get. An empty `changes`, or one
60
+ * naming `'unknown'` or `'closed'`, resets everything. Changes that map to no cache type (e.g.
61
+ * `'starred'`) reset nothing and fire no `onReset`; `onChanged` always fires.
52
62
  */
53
63
  notifyChanged?(repoPath: string, changes: readonly RepositoryChange[], options?: {
54
64
  cache?: readonly CachedGitTypes[] | 'all';
@@ -3,6 +3,7 @@ import { GitRefTip, GitReference } from "../models/reference.js";
3
3
  import { GitBranch } from "../models/branch.js";
4
4
  import { GitTag } from "../models/tag.js";
5
5
  import { GitCommandPriority } from "../run.types.js";
6
+ import { GitReflogEntry } from "../models/reflog.js";
6
7
  //#region ../git/src/providers/refs.d.ts
7
8
  export interface GitRefsSubProvider {
8
9
  checkIfCouldBeValidBranchOrTagName(repoPath: string, ref: string): Promise<boolean>;
@@ -15,6 +16,15 @@ export interface GitRefsSubProvider {
15
16
  options?: {
16
17
  force?: boolean;
17
18
  }, cancellation?: AbortSignal): Promise<GitReference | undefined>;
19
+ /**
20
+ * Reads `ref`'s reflog, newest first, optionally keeping only entries whose message matches `grep` (git's
21
+ * `--grep-reflog` pattern). Resolves `[]` when nothing matches or `ref` has no reflog, and rejects when the
22
+ * read fails (e.g. `ref` doesn't exist), so "no answer" is distinguishable from "never read".
23
+ */
24
+ getReflogEntries?(repoPath: string, ref: string, options?: {
25
+ grep?: string;
26
+ priority?: GitCommandPriority;
27
+ }, cancellation?: AbortSignal): Promise<GitReflogEntry[]>;
18
28
  /**
19
29
  * Lightweight enumeration of ref tips (heads/remotes/tags) — no enrichment.
20
30
  * Use this when you need a SHA-to-refs map; use `getBranches`/`getTags` for full models.
@@ -18,6 +18,8 @@ export interface GitRevisionSubProvider {
18
18
  exists?(repoPath: string, path: string, revOrOptions?: string | {
19
19
  untracked?: 'only' | 'include';
20
20
  }): Promise<boolean>;
21
+ /** The empty tree's id in this repository's object format (SHA-1 or SHA-256). */
22
+ getEmptyTreeSha(repoPath: string): Promise<string>;
21
23
  getRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined>;
22
24
  getSubmoduleHead?(repoPath: string, submodulePath: string): Promise<string | undefined>;
23
25
  /** Gets tracked file paths from the index (reflects working tree state, even during rebase) */
@@ -1,5 +1,6 @@
1
1
  import { Uri } from "../../utils/uri.js";
2
2
  import { UnifiedAsyncDisposable } from "../../utils/disposable.js";
3
+ import { GitOperationRunOptions } from "./operations.js";
3
4
  //#region ../git/src/providers/staging.d.ts
4
5
  export interface DisposableTemporaryGitIndex extends UnifiedAsyncDisposable {
5
6
  path: string;
@@ -48,7 +49,7 @@ export interface GitStagingSubProvider {
48
49
  directories?: boolean;
49
50
  force?: boolean;
50
51
  ignored?: boolean;
51
- }): Promise<void>;
52
+ }, runOptions?: GitOperationRunOptions): Promise<void>;
52
53
  }
53
54
  //#endregion
54
55
  //# sourceMappingURL=staging.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { Uri } from "../../utils/uri.js";
2
2
  import { GitFileChange } from "../models/fileChange.js";
3
3
  import { GitStash } from "../models/stash.js";
4
+ import { GitOperationRunOptions } from "./operations.js";
4
5
  //#region ../git/src/providers/stash.d.ts
5
6
  export interface StashApplyResult {
6
7
  readonly conflicted: boolean;
@@ -15,7 +16,7 @@ export interface GitStashSubProvider {
15
16
  applyStash(repoPath: string, stashNameOrSha: string, options?: {
16
17
  deleteAfter?: boolean | undefined;
17
18
  index?: boolean | undefined;
18
- }): Promise<StashApplyResult>;
19
+ }, runOptions?: GitOperationRunOptions): Promise<StashApplyResult>;
19
20
  /**
20
21
  * Creates a stash commit without adding it to the stash list (plumbing — equivalent to
21
22
  * `git stash create`). Returns the created commit SHA, or `undefined` if there was nothing to
@@ -36,7 +37,7 @@ export interface GitStashSubProvider {
36
37
  includeUntracked?: boolean;
37
38
  keepIndex?: boolean;
38
39
  onlyStaged?: boolean;
39
- }): Promise<void>;
40
+ }, runOptions?: GitOperationRunOptions): Promise<void>;
40
41
  saveSnapshot(repoPath: string, message?: string): Promise<void>;
41
42
  }
42
43
  //#endregion
@@ -14,6 +14,10 @@ export interface GitStatusSubProvider {
14
14
  getStatus(repoPath: string | undefined, options?: {
15
15
  priority?: GitCommandPriority;
16
16
  force?: boolean;
17
+ /** `git status -u<value>`; defaults to `'all'` (today's `-u`, listing files in an untracked directory individually). */
18
+ untracked?: 'no' | 'normal' | 'all';
19
+ /** `false` omits `--branch`, computing no upstream ahead/behind; the result's `branch`, `sha`, `upstream` and `detached` are then not read and mean nothing */
20
+ branch?: false;
17
21
  }, cancellation?: AbortSignal): Promise<GitStatus | undefined>;
18
22
  getStatusForFile?(repoPath: string, pathOrUri: string | Uri, options?: {
19
23
  renames?: boolean;
@@ -1,5 +1,6 @@
1
1
  import { CacheController } from "../utils/promiseCache.js";
2
2
  import { GitWarningKey } from "./errors.js";
3
+ import { RepositoryChange } from "./models/repository.js";
3
4
  import { GitHealthSlownessCategory } from "./gitHealth.js";
4
5
  //#region ../git/src/run.types.d.ts
5
6
  export type GitErrorHandling = 'throw' | 'ignore';
@@ -126,6 +127,21 @@ export interface GitRunOptions {
126
127
  */
127
128
  force?: boolean;
128
129
  };
130
+ /**
131
+ * Opt-in: after the run settles (success, failure, or cancellation), announce a change to the provider
132
+ * for this run's repository, the same way a typed sub-provider mutator does. `'infer'` classifies the
133
+ * command's argv (a `-C <path>` re-scopes which repository); a read-only or object-store-only command
134
+ * then announces nothing. An explicit array announces exactly those {@link RepositoryChange} kinds,
135
+ * regardless of what the argv looks like. Left unset, nothing is classified or announced — zero cost
136
+ * for every existing caller. The change is announced for `cwd`, or the `-C` target, as given: run from the
137
+ * repository root, since that's the path core's caches are keyed by. A `-C`-scoped verb whose effect every
138
+ * worktree shares (`branch`, `fetch`, …) is announced for the caller's `cwd` too, resetting once per repository.
139
+ *
140
+ * The announcement resets only the caches the announced kinds can have made stale, the same ones a file
141
+ * watcher's change of those kinds clears, and drops the repository's pending git runs. A write `'infer'`
142
+ * can't classify announces `[]`, which resets everything, as does `['unknown']`.
143
+ */
144
+ notify?: 'infer' | readonly RepositoryChange[];
129
145
  cwd?: string;
130
146
  readonly env?: Record<string, string | undefined>;
131
147
  readonly encoding?: BufferEncoding | 'buffer' | string;
@@ -4,6 +4,7 @@ import { GitIgnoreFilter } from "../git/watching/gitIgnoreFilter.js";
4
4
  import { RepositoryChange } from "../git/models/repository.js";
5
5
  import { GitServiceContext } from "../git/context.js";
6
6
  import { Cache, CachedGitTypes } from "../git/cache.js";
7
+ import { GitOperationRunOptions } from "../git/providers/operations.js";
7
8
  import { GitProvider } from "../git/providers/provider.js";
8
9
  import { FilteredGitFeatures, GitFeatureOrPrefix, GitFeatures } from "../git/features.js";
9
10
  import { GitLocation } from "./exec/locator.js";
@@ -79,6 +80,8 @@ export declare class CliGitProvider implements GitProvider {
79
80
  private readonly _cacheOwned;
80
81
  private readonly _git;
81
82
  readonly context: GitServiceContext;
83
+ /** The host's own hooks, before the provider wraps `cache.onReset` with its own clearing */
84
+ private readonly _hostHooks;
82
85
  private readonly _localRepositories;
83
86
  constructor(options: CliGitProviderOptions);
84
87
  /** The underlying cache instance (for repo path registration, etc.) */
@@ -96,7 +99,9 @@ export declare class CliGitProvider implements GitProvider {
96
99
  version(): Promise<string>;
97
100
  /** Returns the resolved git binary path. */
98
101
  path(): Promise<string>;
99
- clone(url: string, parentPath: string): Promise<string | undefined>;
102
+ clone(url: string, parentPath: string, options?: {
103
+ folderName?: string;
104
+ }, runOptions?: GitOperationRunOptions): Promise<string | undefined>;
100
105
  /** Creates a new repository at `targetPath` (`git init`), creating it first if it doesn't yet exist. */
101
106
  init(targetPath: string, options?: {
102
107
  defaultBranch?: string;
@@ -106,12 +111,28 @@ export declare class CliGitProvider implements GitProvider {
106
111
  * Notifies the provider that `repoPath` was mutated outside of a typed sub-provider method — e.g. a
107
112
  * consumer that ran a command through the raw `git.run`/`provider.git.run` escape hatch. Fires the same
108
113
  * `cache.onReset`/`repository.onChanged` hooks a typed mutator would, so, exactly as after a typed write,
109
- * the provider clears its own caches for `repoPath` (every type, or just `options.cache` when given) and
110
- * its pending commands before the host's handlers run.
114
+ * the provider hard-evicts its own caches for `repoPath` and drops its pending commands for the repository
115
+ * (its sibling worktrees included) before the host's handlers run.
116
+ *
117
+ * What is reset: `options.cache` when given (`'all'` for everything, `[]` for nothing); otherwise the
118
+ * cache types `changes` map to, the same mapping a file watcher's changes get, status clock included.
119
+ * An empty `changes`, or one naming `'unknown'` or `'closed'`, resets everything. Changes that map to
120
+ * no cache type (e.g. `'starred'`) reset nothing, and `onReset` doesn't fire; `onChanged` always fires.
111
121
  */
112
122
  notifyChanged(repoPath: string, changes: readonly RepositoryChange[], options?: {
113
123
  cache?: readonly CachedGitTypes[] | 'all';
114
124
  }): void;
125
+ /**
126
+ * {@link notifyChanged} for one change seen from several paths, e.g. a `-C` shared-state verb announced
127
+ * for both its target and the caller's `cwd`. Each path's caches are reset and the host's `onReset` fires
128
+ * for each, since a host may keep per-worktree state, but a repository's pending commands are dropped once
129
+ * however many of its worktrees are named.
130
+ */
131
+ private notifyChangedCore;
132
+ /** Evicts what a notified change reset for `repoPath`: the types reset (`[]` = all), or `undefined` for none. */
133
+ private resetForChanges;
134
+ /** `repoPath` and every worktree registered as sharing its repository, since a shared-ref write moves them all. */
135
+ private getRepositoryPaths;
115
136
  private _blame;
116
137
  get blame(): BlameGitSubProvider;
117
138
  private _branches;
@@ -57,9 +57,12 @@ var CliGitProvider = class {
57
57
  _cacheOwned;
58
58
  _git;
59
59
  context;
60
+ /** The host's own hooks, before the provider wraps `cache.onReset` with its own clearing */
61
+ _hostHooks;
60
62
  _localRepositories;
61
63
  constructor(options) {
62
64
  const hostHooks = options.context.hooks;
65
+ this._hostHooks = hostHooks;
63
66
  this.context = {
64
67
  ...options.context,
65
68
  hooks: {
@@ -68,7 +71,7 @@ var CliGitProvider = class {
68
71
  ...hostHooks?.cache,
69
72
  onReset: (repoPath, ...types) => {
70
73
  this._cache.evictCaches(repoPath, ...types);
71
- this._git.clearPendingCommands();
74
+ this._git.clearPendingCommands(this.getRepositoryPaths(repoPath));
72
75
  hostHooks?.cache?.onReset?.(repoPath, ...types);
73
76
  }
74
77
  }
@@ -81,6 +84,7 @@ var CliGitProvider = class {
81
84
  });
82
85
  this._cacheOwned = !(options.cache instanceof Cache);
83
86
  this._cache = options.cache instanceof Cache ? options.cache : new Cache();
87
+ this._git.bindChangeNotifier((repoPaths, changes) => this.notifyChangedCore(repoPaths, changes));
84
88
  }
85
89
  /** The underlying cache instance (for repo path registration, etc.) */
86
90
  get cache() {
@@ -109,17 +113,25 @@ var CliGitProvider = class {
109
113
  async path() {
110
114
  return this._git.path();
111
115
  }
112
- async clone(url, parentPath) {
113
- let count = 0;
114
- const [, , remotePath] = parseGitRemoteUrl(url);
115
- const remoteName = remotePath.split("/").pop();
116
- if (!remoteName) return void 0;
117
- let folderPath = joinPaths(parentPath, remoteName);
118
- while (await fsExists(folderPath) && count < 20) {
119
- count++;
120
- folderPath = joinPaths(parentPath, `${remoteName}-${count}`);
116
+ async clone(url, parentPath, options, runOptions) {
117
+ let folderPath;
118
+ if (options?.folderName) folderPath = joinPaths(parentPath, options.folderName);
119
+ else {
120
+ const [, , remotePath] = parseGitRemoteUrl(url);
121
+ const remoteName = remotePath.split("/").pop();
122
+ if (!remoteName) return void 0;
123
+ let count = 0;
124
+ folderPath = joinPaths(parentPath, remoteName);
125
+ while (await fsExists(folderPath) && count < 20) {
126
+ count++;
127
+ folderPath = joinPaths(parentPath, `${remoteName}-${count}`);
128
+ }
121
129
  }
122
- await this._git.run({ cwd: parentPath }, "clone", url, folderPath);
130
+ await this._git.run({
131
+ cwd: parentPath,
132
+ errors: "throw",
133
+ ...runOptions
134
+ }, "clone", url, folderPath);
123
135
  return folderPath;
124
136
  }
125
137
  /** Creates a new repository at `targetPath` (`git init`), creating it first if it doesn't yet exist. */
@@ -134,14 +146,64 @@ var CliGitProvider = class {
134
146
  * Notifies the provider that `repoPath` was mutated outside of a typed sub-provider method — e.g. a
135
147
  * consumer that ran a command through the raw `git.run`/`provider.git.run` escape hatch. Fires the same
136
148
  * `cache.onReset`/`repository.onChanged` hooks a typed mutator would, so, exactly as after a typed write,
137
- * the provider clears its own caches for `repoPath` (every type, or just `options.cache` when given) and
138
- * its pending commands before the host's handlers run.
149
+ * the provider hard-evicts its own caches for `repoPath` and drops its pending commands for the repository
150
+ * (its sibling worktrees included) before the host's handlers run.
151
+ *
152
+ * What is reset: `options.cache` when given (`'all'` for everything, `[]` for nothing); otherwise the
153
+ * cache types `changes` map to, the same mapping a file watcher's changes get, status clock included.
154
+ * An empty `changes`, or one naming `'unknown'` or `'closed'`, resets everything. Changes that map to
155
+ * no cache type (e.g. `'starred'`) reset nothing, and `onReset` doesn't fire; `onChanged` always fires.
139
156
  */
140
157
  notifyChanged(repoPath, changes, options) {
141
- const types = options?.cache;
142
- if (types == null || types === "all") this.context.hooks?.cache?.onReset?.(repoPath);
143
- else if (types.length) this.context.hooks?.cache?.onReset?.(repoPath, ...types);
144
- this.context.hooks?.repository?.onChanged?.(repoPath, [...changes]);
158
+ this.notifyChangedCore([repoPath], changes, options);
159
+ }
160
+ /**
161
+ * {@link notifyChanged} for one change seen from several paths, e.g. a `-C` shared-state verb announced
162
+ * for both its target and the caller's `cwd`. Each path's caches are reset and the host's `onReset` fires
163
+ * for each, since a host may keep per-worktree state, but a repository's pending commands are dropped once
164
+ * however many of its worktrees are named.
165
+ */
166
+ notifyChangedCore(repoPaths, changes, options) {
167
+ const resets = [];
168
+ const pendingPaths = /* @__PURE__ */ new Set();
169
+ for (const repoPath of repoPaths) {
170
+ const types = this.resetForChanges(repoPath, changes, options?.cache);
171
+ if (types == null) {
172
+ if (options?.cache == null && changes.includes("gkConfig")) for (const path of this.getRepositoryPaths(repoPath)) pendingPaths.add(path);
173
+ continue;
174
+ }
175
+ resets.push({
176
+ repoPath,
177
+ types
178
+ });
179
+ for (const path of this.getRepositoryPaths(repoPath)) pendingPaths.add(path);
180
+ }
181
+ if (pendingPaths.size) this._git.clearPendingCommands([...pendingPaths]);
182
+ for (const { repoPath, types } of resets) this._hostHooks?.cache?.onReset?.(repoPath, ...types);
183
+ for (const repoPath of repoPaths) this.context.hooks?.repository?.onChanged?.(repoPath, [...changes]);
184
+ }
185
+ /** Evicts what a notified change reset for `repoPath`: the types reset (`[]` = all), or `undefined` for none. */
186
+ resetForChanges(repoPath, changes, cache) {
187
+ if (cache != null && cache !== "all") {
188
+ if (!cache.length) return void 0;
189
+ this._cache.evictCaches(repoPath, ...cache);
190
+ return [...cache];
191
+ }
192
+ if (cache === "all" || !changes.length || changes.some((c) => c === "unknown" || c === "closed")) {
193
+ this._cache.evictCaches(repoPath);
194
+ return [];
195
+ }
196
+ const types = this._cache.applyRepositoryChanges(repoPath, changes, "evict");
197
+ return types.length ? types : void 0;
198
+ }
199
+ /** `repoPath` and every worktree registered as sharing its repository, since a shared-ref write moves them all. */
200
+ getRepositoryPaths(repoPath) {
201
+ const commonPath = this._cache.getCommonPath(repoPath);
202
+ return [.../* @__PURE__ */ new Set([
203
+ repoPath,
204
+ commonPath,
205
+ ...this._cache.getWorktreePaths(commonPath)
206
+ ])];
145
207
  }
146
208
  _blame;
147
209
  get blame() {