@gitkraken/core-gitlens 0.16.4 → 0.17.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 (90) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/dist/git/cache.d.ts +8 -2
  3. package/dist/git/cache.js +15 -6
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/models/issue.d.ts +20 -1
  6. package/dist/git/models/issue.js +3 -1
  7. package/dist/git/models/issue.js.map +1 -1
  8. package/dist/git/models/repository.d.ts +4 -2
  9. package/dist/git/models/repository.js +1 -0
  10. package/dist/git/models/repository.js.map +1 -1
  11. package/dist/git/models/worktree.d.ts +5 -1
  12. package/dist/git/models/worktree.js +5 -3
  13. package/dist/git/models/worktree.js.map +1 -1
  14. package/dist/git/providers/provider.d.ts +17 -0
  15. package/dist/git/providers/worktrees.d.ts +17 -2
  16. package/dist/git/run.types.d.ts +7 -0
  17. package/dist/git/service.d.ts +5 -2
  18. package/dist/git/service.js +11 -5
  19. package/dist/git/service.js.map +1 -1
  20. package/dist/git/utils/issue.utils.js +5 -1
  21. package/dist/git/utils/issue.utils.js.map +1 -1
  22. package/dist/git/watching/classifyChange.d.ts +4 -3
  23. package/dist/git/watching/classifyChange.js +7 -4
  24. package/dist/git/watching/classifyChange.js.map +1 -1
  25. package/dist/git/watching/provider.d.ts +6 -0
  26. package/dist/git/watching/watchGroup.d.ts +142 -3
  27. package/dist/git/watching/watchGroup.js +424 -19
  28. package/dist/git/watching/watchGroup.js.map +1 -1
  29. package/dist/git/watching/watchService.d.ts +25 -0
  30. package/dist/git/watching/watchService.js +27 -7
  31. package/dist/git/watching/watchService.js.map +1 -1
  32. package/dist/git/watching/watchSession.d.ts +13 -8
  33. package/dist/git/watching/watchSession.js +50 -10
  34. package/dist/git/watching/watchSession.js.map +1 -1
  35. package/dist/git/watching/watcherPatterns.d.ts +14 -0
  36. package/dist/git/watching/watcherPatterns.js +38 -1
  37. package/dist/git/watching/watcherPatterns.js.map +1 -1
  38. package/dist/git/watching/worktreeSummary.d.ts +64 -2
  39. package/dist/git/watching/worktreeSummary.js +326 -13
  40. package/dist/git/watching/worktreeSummary.js.map +1 -1
  41. package/dist/git-cli/cliGitProvider.d.ts +26 -0
  42. package/dist/git-cli/cliGitProvider.js +66 -5
  43. package/dist/git-cli/cliGitProvider.js.map +1 -1
  44. package/dist/git-cli/exec/commandClassifier.d.ts +9 -3
  45. package/dist/git-cli/exec/commandClassifier.js +98 -17
  46. package/dist/git-cli/exec/commandClassifier.js.map +1 -1
  47. package/dist/git-cli/exec/git.d.ts +20 -0
  48. package/dist/git-cli/exec/git.js +69 -7
  49. package/dist/git-cli/exec/git.js.map +1 -1
  50. package/dist/git-cli/exec/headState.d.ts +5 -0
  51. package/dist/git-cli/exec/headState.js +14 -1
  52. package/dist/git-cli/exec/headState.js.map +1 -1
  53. package/dist/git-cli/parsers/worktreeParser.js +2 -2
  54. package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
  55. package/dist/git-cli/providers/branches.js +8 -4
  56. package/dist/git-cli/providers/branches.js.map +1 -1
  57. package/dist/git-cli/providers/graph.js +1 -1
  58. package/dist/git-cli/providers/graph.js.map +1 -1
  59. package/dist/git-cli/providers/operations.d.ts +3 -0
  60. package/dist/git-cli/providers/operations.js +14 -5
  61. package/dist/git-cli/providers/operations.js.map +1 -1
  62. package/dist/git-cli/providers/worktrees.d.ts +25 -3
  63. package/dist/git-cli/providers/worktrees.js +125 -32
  64. package/dist/git-cli/providers/worktrees.js.map +1 -1
  65. package/dist/git-cli/service.d.ts +2 -0
  66. package/dist/git-cli/service.js +4 -2
  67. package/dist/git-cli/service.js.map +1 -1
  68. package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -0
  69. package/dist/plus/integrations/models/gitHostIntegration.js +20 -3
  70. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  71. package/dist/plus/integrations/models/integration.d.ts +12 -0
  72. package/dist/plus/integrations/models/integration.js +7 -1
  73. package/dist/plus/integrations/models/integration.js.map +1 -1
  74. package/dist/plus/integrations/providers/azure/azure.d.ts +13 -0
  75. package/dist/plus/integrations/providers/azure/azure.js +11 -3
  76. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  77. package/dist/plus/integrations/providers/azure/models.d.ts +3 -1
  78. package/dist/plus/integrations/providers/azure/models.js +11 -5
  79. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  80. package/dist/plus/integrations/providers/azureDevOps.d.ts +33 -5
  81. package/dist/plus/integrations/providers/azureDevOps.js +75 -11
  82. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  83. package/dist/plus/integrations/providers/azureDevOpsServer.js +1 -0
  84. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  85. package/dist/plus/integrations/providers/models.d.ts +19 -0
  86. package/dist/plus/integrations/providers/models.js +12 -3
  87. package/dist/plus/integrations/providers/models.js.map +1 -1
  88. package/dist/plus/integrations/reads/etag.js +6 -1
  89. package/dist/plus/integrations/reads/etag.js.map +1 -1
  90. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"commandClassifier.js","names":[],"sources":["../../../../git-cli/src/exec/commandClassifier.ts"],"sourcesContent":["import { isAbsolute, join } from 'node:path';\nimport type { RepositoryChange } from '@gitlens/git/models/repository.js';\nimport { getRefChangeKind } from '@gitlens/git/watching/changeEvent.js';\n\n/**\n * Verbs that never move a ref, the index or the working tree, so a raw run needs no notification.\n * Anything not listed is treated as a mutation: a needless notification costs a full cache eviction, a\n * missed one serves stale state. Object-writing plumbing (`hash-object -w`, `mktree`, `commit-tree`,\n * `write-tree`) is listed too: it only adds loose objects nothing cached observes.\n */\nconst readOnlyVerbs = new Set([\n\t'annotate',\n\t'archive',\n\t'blame',\n\t'cat-file',\n\t'check-attr',\n\t'check-ignore',\n\t'check-mailmap',\n\t'check-ref-format',\n\t'cherry',\n\t'commit-tree',\n\t'count-objects',\n\t'describe',\n\t'diff',\n\t'diff-files',\n\t'diff-index',\n\t'diff-tree',\n\t'for-each-ref',\n\t'fsck',\n\t'grep',\n\t'hash-object',\n\t'help',\n\t'log',\n\t'ls-files',\n\t// Asks a remote what it has; nothing local moves.\n\t'ls-remote',\n\t'ls-tree',\n\t'merge-base',\n\t'merge-tree',\n\t'mktree',\n\t'name-rev',\n\t'patch-id',\n\t'range-diff',\n\t'rev-list',\n\t'rev-parse',\n\t'shortlog',\n\t'show',\n\t'show-branch',\n\t'show-ref',\n\t'status',\n\t'var',\n\t'verify-commit',\n\t'verify-pack',\n\t'verify-tag',\n\t'version',\n\t'whatchanged',\n\t'write-tree',\n]);\n\nconst reflogWriteSubcommands: ReadonlySet<string> = new Set(['expire', 'delete', 'drop']);\n\n/**\n * Sub-commands of otherwise-mutating verbs that only list. `''` is the bare verb, which lists for `branch`,\n * `tag`, `remote` and `notes`; `branch -v` and every `tag` filter imply git's own list mode.\n */\nconst readOnlySubcommands: Readonly<Record<string, ReadonlySet<string>>> = {\n\tbranch: new Set([\n\t\t'',\n\t\t'-l',\n\t\t'--list',\n\t\t'--show-current',\n\t\t'-a',\n\t\t'-r',\n\t\t'-v',\n\t\t'-vv',\n\t\t'--verbose',\n\t\t'--contains',\n\t\t'--no-contains',\n\t\t'--merged',\n\t\t'--no-merged',\n\t\t'--points-at',\n\t]),\n\tconfig: new Set(['get', 'list']),\n\tnotes: new Set(['', 'list', 'show', 'get-ref']),\n\t// `stash create` writes a commit object and prints it; no ref moves\n\tstash: new Set(['list', 'show', 'create']),\n\ttag: new Set([\n\t\t'',\n\t\t'-l',\n\t\t'--list',\n\t\t'-n',\n\t\t'-v',\n\t\t'--verify',\n\t\t'--contains',\n\t\t'--no-contains',\n\t\t'--merged',\n\t\t'--no-merged',\n\t\t'--points-at',\n\t]),\n\tworktree: new Set(['list']),\n\tremote: new Set(['', '-v', 'get-url', 'show']),\n};\n\n/**\n * Options that make an argv write whatever else it contains, checked across the whole argv rather than\n * only its first token: `branch -r -d origin/x` leads with a listing flag and still deletes.\n */\nconst writeOptions: Readonly<Record<string, readonly string[]>> = {\n\tbranch: [\n\t\t'-d',\n\t\t'-D',\n\t\t'--delete',\n\t\t'-m',\n\t\t'-M',\n\t\t'--move',\n\t\t'-c',\n\t\t'-C',\n\t\t'--copy',\n\t\t'-f',\n\t\t'--force',\n\t\t'-t',\n\t\t'--track',\n\t\t'--no-track',\n\t\t'-u',\n\t\t'--set-upstream-to',\n\t\t'--unset-upstream',\n\t\t'--edit-description',\n\t],\n\tconfig: [\n\t\t'--add',\n\t\t'--replace-all',\n\t\t'--unset',\n\t\t'--unset-all',\n\t\t'--rename-section',\n\t\t'--remove-section',\n\t\t'-e',\n\t\t'--edit',\n\t],\n};\n\nconst configReadOptions = new Set([\n\t'--get',\n\t'--get-all',\n\t'--get-regexp',\n\t'--get-urlmatch',\n\t'--get-color',\n\t'--get-colorbool',\n\t'--list',\n\t'-l',\n]);\n\nfunction hasWriteOption(verb: string, rest: readonly string[]): boolean {\n\tconst options = writeOptions[verb];\n\tif (options == null) return false;\n\treturn hasOption(rest, options);\n}\n\nfunction hasOption(rest: readonly string[], options: readonly string[]): boolean {\n\treturn rest.some(arg => options.some(opt => arg === opt || arg.startsWith(`${opt}=`)));\n}\n\n/**\n * `config <key>` with nothing after the key is git's own read form, as is any `--get*`/`--list`. `config edit`\n * (git 2.46's subcommand form of `--edit`) also has a single non-flag argument but writes.\n */\nfunction isConfigRead(rest: readonly string[]): boolean {\n\tif (rest[0] === 'edit') return false;\n\tif (rest.some(arg => configReadOptions.has(arg))) return true;\n\n\treturn rest.filter(arg => !arg.startsWith('-')).length === 1;\n}\n\n/** Global options whose value is the next argument, so the verb scan must skip both. */\nconst globalOptionsWithValue = new Set([\n\t'-c',\n\t'--config-env',\n\t'--exec-path',\n\t'--git-dir',\n\t'--namespace',\n\t'--super-prefix',\n\t'--work-tree',\n]);\n\nexport interface LeadingCommand {\n\tverb: string;\n\treadOnly: boolean;\n\t/** The first token after the verb, unresolved — used for subcommand-shaped decisions (`worktree add`). */\n\tsubcommand?: string;\n\t/** Every token after the verb */\n\trest: readonly string[];\n\t/** The `-C <path>` target when the caller re-scopes the command to another working tree. */\n\tpathOverride?: string;\n\t/** Each `-c <key>[=<value>]` given before the verb, in order */\n\tconfigs?: readonly string[];\n}\n\n/**\n * Skips the global options (`-c key=val`, `-C path`) git accepts before the verb to find it, and notes a\n * `-C` re-scope so notification targets that tree.\n */\nexport function leadingCommand(args: readonly string[]): LeadingCommand {\n\tlet pathOverride: string | undefined;\n\tlet configs: string[] | undefined;\n\tlet i = 0;\n\twhile (i < args.length) {\n\t\tconst arg = args[i];\n\t\tif (arg === '-C') {\n\t\t\t// git applies each `-C` relative to the one before it\n\t\t\tconst path = args[i + 1];\n\t\t\tif (path != null) {\n\t\t\t\tpathOverride = pathOverride == null || isAbsolute(path) ? path : join(pathOverride, path);\n\t\t\t}\n\t\t\ti += 2;\n\n\t\t\tcontinue;\n\t\t}\n\t\tif (globalOptionsWithValue.has(arg)) {\n\t\t\tif (arg === '-c' && args[i + 1] != null) {\n\t\t\t\t(configs ??= []).push(args[i + 1]);\n\t\t\t}\n\t\t\ti += 2;\n\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg.startsWith('-')) {\n\t\t\ti += 1;\n\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tconst verb = args[i] ?? '';\n\tconst rest = args.slice(i + 1);\n\tconst readOnly =\n\t\t!hasWriteOption(verb, rest) &&\n\t\t(readOnlyVerbs.has(verb) ||\n\t\t\t(readOnlySubcommands[verb]?.has(rest[0] ?? '') ?? false) ||\n\t\t\t(verb === 'config' && isConfigRead(rest)) ||\n\t\t\t// Every `reflog` form reads (bare, `<ref>`, `show`, `list`, `exists`) except the three that rewrite\n\t\t\t// it. Base-branch detection answers \"none\" unless a branch's reflog has exactly one creation entry,\n\t\t\t// so a rewrite can make a cached \"none\" derivable; no change kind names a reflog, so it resets all.\n\t\t\t(verb === 'reflog' && !reflogWriteSubcommands.has(rest[0] ?? '')) ||\n\t\t\t// A bare `symbolic-ref <name>` reads; a second non-flag argument, or a delete, writes.\n\t\t\t(verb === 'symbolic-ref' &&\n\t\t\t\t!rest.includes('-d') &&\n\t\t\t\t!rest.includes('--delete') &&\n\t\t\t\trest.filter(a => !a.startsWith('-')).length < 2));\n\n\treturn {\n\t\tverb: verb,\n\t\treadOnly: readOnly,\n\t\tsubcommand: rest[0],\n\t\trest: rest,\n\t\tpathOverride: pathOverride,\n\t\tconfigs: configs,\n\t};\n}\n\n/**\n * The change kinds every worktree sharing a `.git` sees: its refs, stash, worktree list and config. The rest a\n * classified verb announces — HEAD, the index, a paused operation, FETCH_HEAD — belong to the one tree the\n * command ran in, so a `-C`-scoped write tells the caller's own `cwd` only this subset of what it changed.\n */\nexport const worktreeSharedChanges: ReadonlySet<RepositoryChange> = new Set([\n\t'heads',\n\t'tags',\n\t'stash',\n\t'remotes',\n\t'worktrees',\n\t'config',\n]);\n\n/**\n * Verbs whose effect is confined to the object store that nothing cached observes — repacking or pruning\n * `.git/objects` changes no cached read (branches, refs, status, worktrees, …). `init` and `clone` create a\n * repository rather than mutate a registered one, so there is nothing yet registered to notify.\n */\nconst objectOnlyVerbs = new Set([\n\t'gc',\n\t'repack',\n\t'prune',\n\t'maintenance',\n\t'commit-graph',\n\t'multi-pack-index',\n\t'init',\n\t'clone',\n]);\n\n/**\n * The {@link RepositoryChange} kinds each mutating verb announces. A worktree subcommand other than a\n * listing is handled separately (see {@link getChangesForCommand}), and any verb absent from both this\n * table and {@link objectOnlyVerbs} announces `[]` — the conservative default for an unclassified\n * mutation: the caller still learns something changed, just not what. An entry covers at least what the\n * verb's typed mutator announces; `update-ref` and `symbolic-ref` name every kind their target ref could be.\n * {@link getNamedChanges} narrows the forms whose argv proves what moved, which can announce less: the typed\n * checkout announces `heads` for any target, but a `--detach` or full-SHA checkout moves only this tree's HEAD,\n * no shared ref.\n * The kinds decide which caches the announcement resets, so a verb that can start or end a paused operation\n * names `pausedOp`: `commit` concludes a merge, cherry-pick or revert, `reset` aborts one, and `am` runs in\n * `rebase-apply`.\n */\nconst changesByVerb: Readonly<Record<string, readonly RepositoryChange[]>> = {\n\tcommit: ['head', 'heads', 'index', 'pausedOp'],\n\tam: ['head', 'heads', 'index', 'pausedOp'],\n\tbisect: ['head', 'index'],\n\tcheckout: ['head', 'heads', 'index'],\n\tswitch: ['head', 'heads', 'index'],\n\treset: ['head', 'heads', 'index', 'pausedOp'],\n\tmerge: ['head', 'heads', 'index', 'pausedOp', 'merge'],\n\trebase: ['head', 'heads', 'index', 'pausedOp', 'rebase'],\n\t'cherry-pick': ['head', 'heads', 'index', 'pausedOp', 'cherryPick'],\n\trevert: ['head', 'heads', 'index', 'pausedOp', 'revert'],\n\tpull: ['head', 'heads', 'index', 'remotes', 'tags', 'lastFetched', 'pausedOp', 'merge', 'rebase'],\n\tadd: ['index'],\n\trm: ['index'],\n\tmv: ['index'],\n\trestore: ['index'],\n\tapply: ['index'],\n\t'read-tree': ['index'],\n\t'update-index': ['index'],\n\tclean: ['index'],\n\tstash: ['stash', 'index'],\n\t'update-ref': ['head', 'heads', 'remotes', 'tags', 'stash'],\n\tbranch: ['heads', 'remotes'],\n\t'symbolic-ref': ['head', 'heads', 'remotes', 'tags'],\n\t'pack-refs': ['heads', 'remotes', 'tags'],\n\ttag: ['tags'],\n\t// A refspec can write a local branch (`fetch origin main:main`), which only the typed fetch parses for\n\tfetch: ['heads', 'remotes', 'tags', 'lastFetched'],\n\tpush: ['remotes'],\n\tremote: ['remotes', 'config'],\n\tconfig: ['config', 'heads', 'remotes'],\n\tnotes: ['heads'],\n};\n\n/**\n * `branch` options that write `.git/config`: a rename, copy or delete moves or drops the branch's section, and the\n * rest set or clear its upstream or description. A plain create (or `-f`) writes tracking only from a remote-tracking\n * start point, which the `.git/config` watcher reports.\n */\nconst branchConfigOptions: readonly string[] = [\n\t'-d',\n\t'-D',\n\t'--delete',\n\t'-m',\n\t'-M',\n\t'--move',\n\t'-c',\n\t'-C',\n\t'--copy',\n\t'-t',\n\t'--track',\n\t'-u',\n\t'--set-upstream-to',\n\t'--unset-upstream',\n\t'--edit-description',\n];\nconst branchConfigChanges: readonly RepositoryChange[] = ['config', 'heads', 'remotes'];\n\n/**\n * Whether creating a branch from `startPoint` may write its tracking to `.git/config`, as git's default\n * `branch.autoSetupMerge=true` does from a remote-tracking start point. Only a name holding a `/` can be one, so a\n * local name with a `/` counts too. The `.git/config` watcher reports what this misses, such as\n * `branch.autoSetupMerge=always`.\n */\nexport function mayWriteTracking(startPoint: string | undefined, noTracking: boolean | undefined): boolean {\n\tif (noTracking || !startPoint) return false;\n\tif (startPoint.startsWith('refs/')) return startPoint.startsWith('refs/remotes/');\n\n\treturn startPoint.includes('/');\n}\n\nconst worktreeChanges: readonly RepositoryChange[] = ['worktrees', 'heads'];\nconst emptyChanges: readonly RepositoryChange[] = [];\n\nexport interface CommandChanges {\n\tchanges: readonly RepositoryChange[];\n\t/** The `-C <path>` target when the caller re-scoped the command to another working tree. */\n\tpathOverride?: string;\n\t/** The subset of {@link changes} every worktree sharing the same `.git` sees, not just the tree the command ran in. */\n\tsharedChanges: readonly RepositoryChange[];\n\t/**\n\t * The full ref names the command creates, moves or deletes, when its argv proves them. A ref kind in\n\t * {@link changes} with a name of its kind here is fully described by those names, as `repository.onChanged`'s\n\t * `refs` are; a ref kind with none stays unnamed.\n\t */\n\trefs?: readonly string[];\n\t/** The command's `config` change touches only the `branch.<name>` sections of the local branches {@link refs} names */\n\tconfigConfinedToRefs?: boolean;\n\t/**\n\t * The command moves only the branch HEAD is on, or no branch when HEAD is detached, so `git.run` reads HEAD\n\t * before and after the run to name it.\n\t */\n\tmovesHeadBranch?: boolean;\n}\n\ntype NamedChanges = Omit<CommandChanges, 'pathOverride' | 'sharedChanges'>;\n\nconst configHeadsChanges: readonly RepositoryChange[] = ['config', 'heads'];\nconst headsChanges: readonly RepositoryChange[] = ['heads'];\nconst remotesChanges: readonly RepositoryChange[] = ['remotes'];\nconst tagsChanges: readonly RepositoryChange[] = ['tags'];\nconst stashChanges: readonly RepositoryChange[] = ['stash'];\nconst stashIndexChanges: readonly RepositoryChange[] = ['stash', 'index'];\nconst stashBranchChanges: readonly RepositoryChange[] = ['head', 'heads', 'index', 'stash'];\nconst indexChanges: readonly RepositoryChange[] = ['index'];\nconst headHeadsChanges: readonly RepositoryChange[] = ['head', 'heads'];\nconst headIndexChanges: readonly RepositoryChange[] = ['head', 'index'];\nconst checkoutChanges: readonly RepositoryChange[] = ['head', 'heads', 'index'];\nconst checkoutTrackingChanges: readonly RepositoryChange[] = ['config', 'head', 'heads', 'index'];\nconst worktreeOnlyChanges: readonly RepositoryChange[] = ['worktrees'];\nconst worktreeTrackingChanges: readonly RepositoryChange[] = ['config', 'worktrees', 'heads'];\n\nconst stashRefs: readonly string[] = ['refs/stash'];\n\n/** A full object name, which `checkout` and `worktree add` never DWIM into a new branch */\nconst fullShaRegex = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i;\n\n/**\n * Whether a branch name in argv is the branch it names. Git expands `@{-<n>}` (and `@`) wherever it takes a branch\n * name, `branch -d @{-1}` deleting the previous branch, and no ref name can hold `@{` or be `@`\n */\nfunction isLiteralBranchName(name: string): boolean {\n\treturn name !== '@' && !name.includes('@{');\n}\n\ninterface ParsedArgs {\n\t/** Each option in argv order, with its value when it takes one */\n\toptions: readonly (readonly [name: string, value: string | undefined])[];\n\t/** The non-option arguments, including those after `--` */\n\tpositionals: readonly string[];\n\t/** Where `--` fell in {@link positionals}, for the verbs that take pathspecs after it */\n\tdashDash?: number;\n}\n\n/**\n * Splits a verb's arguments by its own option table, since one letter means different things to different verbs\n * (`-m` moves, merges or sets a message). An option outside the table returns `undefined` rather than a guess at\n * whether it takes a value. A valued option accepts `--opt=<v>`, `--opt <v>`, `-o <v>` and `-o<v>`.\n */\nfunction parseArgs(\n\targs: readonly string[],\n\tflags: ReadonlySet<string>,\n\tvalued: ReadonlySet<string>,\n): ParsedArgs | undefined {\n\tconst options: [string, string | undefined][] = [];\n\tconst positionals: string[] = [];\n\tlet dashDash: number | undefined;\n\tlet optionsEnded = false;\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\t\t// Still a pathspec separator after `--end-of-options`, as `checkout` and `reset` read it\n\t\tif (arg === '--' && dashDash == null) {\n\t\t\tdashDash = positionals.length;\n\t\t\toptionsEnded = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (optionsEnded || arg === '-' || !arg.startsWith('-')) {\n\t\t\tpositionals.push(arg);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === '--end-of-options') {\n\t\t\toptionsEnded = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flags.has(arg)) {\n\t\t\toptions.push([arg, undefined]);\n\t\t\tcontinue;\n\t\t}\n\t\tif (valued.has(arg)) {\n\t\t\tconst value = args[i + 1];\n\t\t\tif (value == null) return undefined;\n\n\t\t\toptions.push([arg, value]);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst long = arg.startsWith('--');\n\t\tconst name = long ? arg.split('=', 1)[0] : arg.slice(0, 2);\n\t\tif (name === arg || !valued.has(name)) return undefined;\n\n\t\toptions.push([name, arg.slice(long ? name.length + 1 : name.length)]);\n\t}\n\treturn { options: options, positionals: positionals, dashDash: dashDash };\n}\n\nfunction hasParsedOption(parsed: ParsedArgs, ...names: string[]): boolean {\n\treturn parsed.options.some(([option]) => names.includes(option));\n}\n\nconst updateRefFlags: ReadonlySet<string> = new Set(['-d', '--delete', '--no-deref', '--create-reflog']);\nconst updateRefValued: ReadonlySet<string> = new Set(['-m', '--message']);\n\n/**\n * `update-ref` moves the one ref it names, or the ref a symbolic one points to without `--no-deref`, so `HEAD` and a\n * remote's `HEAD` stay unnamed. `null` means a ref outside the namespaces core reads, which the typed\n * `updateReference` doesn't announce either. `git log --all` (graph, search, contributors) does walk such a ref when\n * it points at a commit, and argv can't tell that from a blob ref, so a row it adds or drops can stay stale until the\n * next heads change: the trade the typed write makes not to refresh every worktree on each bookkeeping write. A packed\n * ref's delete rewrites `packed-refs`, which the watcher still reports.\n */\nfunction getUpdateRefChanges(args: readonly string[]): NamedChanges | null | undefined {\n\tconst parsed = parseArgs(args, updateRefFlags, updateRefValued);\n\tif (parsed == null) return undefined;\n\n\tconst [ref] = parsed.positionals;\n\tif (!ref) return undefined;\n\tif (ref === 'HEAD') return { changes: headHeadsChanges };\n\tif (!ref.startsWith('refs/')) return undefined;\n\tif (ref.endsWith('/HEAD') && !hasParsedOption(parsed, '--no-deref')) return undefined;\n\n\tconst kind = getRefChangeKind(ref);\n\tif (kind != null) return { changes: [kind], refs: [ref] };\n\t// The watcher reports `refs/replace` as heads, and `notes` announces heads too\n\tif (ref.startsWith('refs/replace/') || ref.startsWith('refs/notes/')) return { changes: headsChanges };\n\n\treturn null;\n}\n\nconst branchFlags: ReadonlySet<string> = new Set([\n\t'-f',\n\t'--force',\n\t'--no-track',\n\t'-d',\n\t'-D',\n\t'--delete',\n\t'-m',\n\t'-M',\n\t'--move',\n\t'-c',\n\t'-C',\n\t'--copy',\n\t'-r',\n\t'--remotes',\n\t'-q',\n\t'--quiet',\n\t'--create-reflog',\n]);\nconst noValuedOptions: ReadonlySet<string> = new Set();\n\n/**\n * The create, delete, rename and copy forms of `branch` name every branch they write. A delete removes a local\n * branch's `branch.<name>` section and a rename or copy moves it; a create writes it only for tracking.\n */\nfunction getBranchChanges(args: readonly string[]): NamedChanges | undefined {\n\tconst parsed = parseArgs(args, branchFlags, noValuedOptions);\n\tif (parsed == null) return undefined;\n\n\tlet mode: 'delete' | 'move' | undefined;\n\tlet remote = false;\n\tlet noTrack = false;\n\tfor (const [option] of parsed.options) {\n\t\tswitch (option) {\n\t\t\tcase '-d':\n\t\t\tcase '-D':\n\t\t\tcase '--delete':\n\t\t\t\tif (mode === 'move') return undefined;\n\n\t\t\t\tmode = 'delete';\n\t\t\t\tbreak;\n\t\t\tcase '-m':\n\t\t\tcase '-M':\n\t\t\tcase '--move':\n\t\t\tcase '-c':\n\t\t\tcase '-C':\n\t\t\tcase '--copy':\n\t\t\t\tif (mode === 'delete') return undefined;\n\n\t\t\t\tmode = 'move';\n\t\t\t\tbreak;\n\t\t\tcase '-r':\n\t\t\tcase '--remotes':\n\t\t\t\tremote = true;\n\t\t\t\tbreak;\n\t\t\tcase '--no-track':\n\t\t\t\tnoTrack = true;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst names = parsed.positionals;\n\tif (mode === 'delete') {\n\t\tif (!names.length || !names.every(isLiteralBranchName)) return undefined;\n\t\tif (remote) return { changes: remotesChanges, refs: names.map(n => `refs/remotes/${n}`) };\n\n\t\treturn { changes: configHeadsChanges, refs: names.map(n => `refs/heads/${n}`), configConfinedToRefs: true };\n\t}\n\tif (remote) return undefined;\n\n\tif (mode === 'move') {\n\t\t// With one name, git renames or copies the current branch, which argv doesn't name\n\t\tif (names.length !== 2 || !names.every(isLiteralBranchName)) return undefined;\n\n\t\treturn { changes: configHeadsChanges, refs: names.map(n => `refs/heads/${n}`), configConfinedToRefs: true };\n\t}\n\n\tif ((names.length !== 1 && names.length !== 2) || !isLiteralBranchName(names[0])) return undefined;\n\n\tconst refs = [`refs/heads/${names[0]}`];\n\tif (mayWriteTracking(names[1], noTrack)) {\n\t\treturn { changes: configHeadsChanges, refs: refs, configConfinedToRefs: true };\n\t}\n\treturn { changes: headsChanges, refs: refs };\n}\n\nconst tagFlags: ReadonlySet<string> = new Set([\n\t'-f',\n\t'--force',\n\t'-d',\n\t'--delete',\n\t'-a',\n\t'--annotate',\n\t'-s',\n\t'--sign',\n\t'--no-sign',\n\t'-e',\n\t'--edit',\n\t'--create-reflog',\n]);\nconst tagValued: ReadonlySet<string> = new Set(['-m', '--message', '-F', '--file', '-u', '--local-user', '--cleanup']);\n\nfunction getTagChanges(args: readonly string[]): NamedChanges | undefined {\n\tconst parsed = parseArgs(args, tagFlags, tagValued);\n\tif (parsed == null) return undefined;\n\n\tconst names = parsed.positionals;\n\tif (hasParsedOption(parsed, '-d', '--delete')) {\n\t\tif (!names.length) return undefined;\n\n\t\treturn { changes: tagsChanges, refs: names.map(n => `refs/tags/${n}`) };\n\t}\n\tif (names.length !== 1 && names.length !== 2) return undefined;\n\n\treturn { changes: tagsChanges, refs: [`refs/tags/${names[0]}`] };\n}\n\n/** The `worktree` subcommands other than `add` and `list`; none writes a branch */\nconst worktreeEditSubcommands: ReadonlySet<string> = new Set(['remove', 'prune', 'lock', 'unlock', 'move', 'repair']);\nconst worktreeAddFlags: ReadonlySet<string> = new Set([\n\t'-f',\n\t'--force',\n\t'-d',\n\t'--detach',\n\t'--checkout',\n\t'--no-checkout',\n\t'--lock',\n\t'-q',\n\t'--quiet',\n\t'--track',\n\t'--no-track',\n\t'--guess-remote',\n\t'--no-guess-remote',\n\t'--orphan',\n]);\nconst worktreeAddValued: ReadonlySet<string> = new Set(['-b', '-B', '--reason']);\n\n/**\n * `worktree add` is the only subcommand that can create a branch: the `-b`/`-B` one it names or, without either, one\n * git DWIMs from a short commit-ish (or from the path, given none), which argv can't name. A detached or full-SHA add\n * creates none.\n */\nfunction getWorktreeChanges(args: readonly string[]): NamedChanges | undefined {\n\tconst [subcommand, ...rest] = args;\n\tif (subcommand != null && worktreeEditSubcommands.has(subcommand)) return { changes: worktreeOnlyChanges };\n\tif (subcommand !== 'add') return undefined;\n\n\tconst parsed = parseArgs(rest, worktreeAddFlags, worktreeAddValued);\n\tif (parsed == null) return undefined;\n\n\tlet branch: string | undefined;\n\tlet detach = false;\n\tlet orphan = false;\n\tlet track: boolean | undefined;\n\tfor (const [option, value] of parsed.options) {\n\t\tswitch (option) {\n\t\t\tcase '-b':\n\t\t\tcase '-B':\n\t\t\t\tbranch = value;\n\t\t\t\tbreak;\n\t\t\tcase '-d':\n\t\t\tcase '--detach':\n\t\t\t\tdetach = true;\n\t\t\t\tbreak;\n\t\t\tcase '--orphan':\n\t\t\t\torphan = true;\n\t\t\t\tbreak;\n\t\t\tcase '--track':\n\t\t\t\ttrack = true;\n\t\t\t\tbreak;\n\t\t\tcase '--no-track':\n\t\t\t\ttrack = false;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst [path, commitish, ...extra] = parsed.positionals;\n\tif (orphan || path == null || extra.length) return undefined;\n\n\tif (branch) {\n\t\tif (!isLiteralBranchName(branch)) return undefined;\n\n\t\tconst refs = [`refs/heads/${branch}`];\n\t\t// An explicit `--track` writes tracking from a local start point too. Git may also write\n\t\t// `extensions.relativeWorktrees` (under `worktree.useRelativePaths`), which nothing a worktree shows reads, so\n\t\t// the change is still claimed confined: unlike the typed add, a raw run can't evict the config cache unannounced\n\t\tif (track === true || mayWriteTracking(commitish, track === false)) {\n\t\t\treturn { changes: worktreeTrackingChanges, refs: refs, configConfinedToRefs: true };\n\t\t}\n\t\treturn { changes: worktreeChanges, refs: refs };\n\t}\n\tif (detach || (commitish != null && fullShaRegex.test(commitish))) return { changes: worktreeOnlyChanges };\n\n\treturn undefined;\n}\n\nconst checkoutFlags: ReadonlySet<string> = new Set([\n\t'-q',\n\t'--quiet',\n\t'-f',\n\t'--force',\n\t'--detach',\n\t'--no-track',\n\t'-m',\n\t'--merge',\n\t'--progress',\n\t'--no-progress',\n\t'--ignore-other-worktrees',\n\t'--overwrite-ignore',\n\t'--no-overwrite-ignore',\n\t'--recurse-submodules',\n\t'--no-recurse-submodules',\n]);\nconst checkoutValued: ReadonlySet<string> = new Set(['-b', '-B']);\nconst switchFlags: ReadonlySet<string> = new Set([...checkoutFlags, '-d', '--discard-changes']);\nconst switchValued: ReadonlySet<string> = new Set(['-c', '-C', '--create', '--force-create']);\n\n/**\n * `checkout`/`switch` moves no existing branch, so the only shared ref it writes is one it creates: the `-b`/`-c` one\n * it names, or the one git DWIMs from a remote branch named like its lone argument. A detached or full-SHA checkout\n * creates none, and a pathspec checkout writes only the index and working tree.\n */\nfunction getCheckoutChanges(verb: 'checkout' | 'switch', args: readonly string[]): NamedChanges | undefined {\n\tconst parsed =\n\t\tverb === 'switch' ? parseArgs(args, switchFlags, switchValued) : parseArgs(args, checkoutFlags, checkoutValued);\n\tif (parsed == null) return undefined;\n\n\tlet branch: string | undefined;\n\tlet detach = false;\n\tlet noTrack = false;\n\tfor (const [option, value] of parsed.options) {\n\t\tif (value != null) {\n\t\t\tbranch = value;\n\t\t} else if (option === '-d' || option === '--detach') {\n\t\t\tdetach = true;\n\t\t} else if (option === '--no-track') {\n\t\t\tnoTrack = true;\n\t\t}\n\t}\n\n\tconst { positionals, dashDash } = parsed;\n\tconst revs = dashDash == null ? positionals : positionals.slice(0, dashDash);\n\tconst hasPaths = dashDash != null && dashDash < positionals.length;\n\tif (branch != null) {\n\t\tif (hasPaths || revs.length > 1 || !isLiteralBranchName(branch)) return undefined;\n\n\t\tconst refs = [`refs/heads/${branch}`];\n\t\tif (mayWriteTracking(revs[0], noTrack)) {\n\t\t\treturn { changes: checkoutTrackingChanges, refs: refs, configConfinedToRefs: true };\n\t\t}\n\t\treturn { changes: checkoutChanges, refs: refs };\n\t}\n\tif (hasPaths) return verb === 'checkout' ? { changes: indexChanges } : undefined;\n\tif (revs.length > 1) return undefined;\n\tif (detach) return { changes: headIndexChanges };\n\n\tconst [rev] = revs;\n\tif (rev == null || rev === '-' || rev.startsWith('@{-')) return undefined;\n\tif (fullShaRegex.test(rev)) return { changes: headIndexChanges };\n\n\t// A path, an existing ref, or a branch git DWIMs from a remote branch, tracking it from its own config section\n\treturn { changes: checkoutTrackingChanges, refs: [`refs/heads/${rev}`], configConfinedToRefs: true };\n}\n\n/**\n * A stash write moves only `refs/stash` (or its reflog, the rest of the list), save `branch`, which also creates the\n * branch it names from a commit and checks it out; `apply` moves no ref\n */\nfunction getStashChanges(subcommand: string | undefined, rest: readonly string[]): NamedChanges | undefined {\n\tswitch (subcommand) {\n\t\tcase 'branch': {\n\t\t\tconst name = rest[1];\n\t\t\tif (!name || name.startsWith('-') || !isLiteralBranchName(name)) return undefined;\n\n\t\t\treturn { changes: stashBranchChanges, refs: [`refs/heads/${name}`, ...stashRefs] };\n\t\t}\n\t\tcase undefined:\n\t\tcase 'push':\n\t\tcase 'save':\n\t\tcase 'pop':\n\t\t\treturn { changes: stashIndexChanges, refs: stashRefs };\n\t\tcase 'drop':\n\t\tcase 'clear':\n\t\tcase 'store':\n\t\t\treturn { changes: stashChanges, refs: stashRefs };\n\t\tcase 'apply':\n\t\t\treturn { changes: indexChanges };\n\t\tdefault:\n\t\t\t// A bare `stash` with options is a push\n\t\t\treturn subcommand.startsWith('-') ? { changes: stashIndexChanges, refs: stashRefs } : undefined;\n\t}\n}\n\n/** A `reset` given paths, or `-p`, restores index entries and moves no ref */\nfunction isPathspecReset(args: readonly string[]): boolean {\n\tconst dashDash = args.indexOf('--');\n\tif (dashDash >= 0 && dashDash < args.length - 1) return true;\n\n\treturn args.some(\n\t\targ =>\n\t\t\targ === '-p' ||\n\t\t\targ === '--patch' ||\n\t\t\targ === '--pathspec-from-file' ||\n\t\t\targ.startsWith('--pathspec-from-file='),\n\t);\n}\n\nconst falseConfigValues: ReadonlySet<string> = new Set(['false', 'no', 'off', '0', '']);\n\n/**\n * The `rebase` options that take the refs it writes out of argv's hands: the update-refs list was fixed when the\n * rebase started, whatever this argv says, an interactive or `--exec` todo list can write any ref, and `--update-refs`\n * spelled any other way than in full turns update-refs on\n */\nconst unprovableRebaseOptions: readonly string[] = [\n\t'--continue',\n\t'--skip',\n\t'--edit-todo',\n\t'--interactive',\n\t'--exec',\n\t'--update-refs',\n];\n\n/**\n * Whether `arg` is one of {@link unprovableRebaseOptions}, `-i` or `-x`, however git lets it be written: any unique\n * prefix of a long option, before any `=<value>` (`--cont`, `--update-ref`, `--exe=make`), and short ones bundled\n * (`-ri`, `-xmake`)\n */\nfunction isUnprovableRebaseOption(arg: string): boolean {\n\tif (arg.startsWith('--')) {\n\t\tconst name = arg.split('=', 1)[0];\n\t\treturn name.length > 2 && unprovableRebaseOptions.some(o => o.startsWith(name));\n\t}\n\treturn arg.length > 1 && arg.startsWith('-') && /[ix]/.test(arg.slice(1));\n}\n\n/**\n * Whether a `rebase` moves only the branch being rebased. Update-refs would rewrite every branch in the rebased range,\n * so it must be provably off: the last of `--update-refs`/`--no-update-refs`, else the last `-c rebase.updateRefs`\n * before the verb. An interactive or `--exec` rebase can write any ref from its todo list. Git writes the listed refs\n * only when the rebase finishes, so an abort or quit moves none.\n */\nfunction isHeadBranchRebase(command: LeadingCommand): boolean {\n\tlet off: boolean | undefined;\n\tfor (const arg of command.rest) {\n\t\tif (arg === '--' || arg === '--end-of-options') break;\n\n\t\tif (arg === '--abort' || arg === '--quit') return true;\n\n\t\tif (arg === '--no-update-refs') {\n\t\t\toff = true;\n\t\t} else if (arg === '--update-refs') {\n\t\t\toff = false;\n\t\t} else if (isUnprovableRebaseOption(arg)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (off != null) return off;\n\n\tfor (const config of command.configs ?? []) {\n\t\tconst separator = config.indexOf('=');\n\t\tconst key = separator < 0 ? config : config.slice(0, separator);\n\t\tif (key.toLowerCase() !== 'rebase.updaterefs') continue;\n\n\t\t// A bare `-c key` is git's `true`\n\t\toff = separator >= 0 && falseConfigValues.has(config.slice(separator + 1).toLowerCase());\n\t}\n\treturn off ?? false;\n}\n\n/** Verbs that move only the branch HEAD is on, or none from a detached HEAD */\nconst headBranchVerbs: ReadonlySet<string> = new Set(['commit', 'merge', 'cherry-pick', 'revert', 'am']);\n\n/**\n * What argv proves more precisely than {@link changesByVerb}: the refs a write moved, or fewer kinds. `undefined`\n * keeps the verb's table entry; `null` means the write moved nothing cached.\n */\nfunction getNamedChanges(command: LeadingCommand): NamedChanges | null | undefined {\n\tswitch (command.verb) {\n\t\tcase 'update-ref':\n\t\t\treturn getUpdateRefChanges(command.rest);\n\t\tcase 'branch':\n\t\t\treturn getBranchChanges(command.rest);\n\t\tcase 'tag':\n\t\t\treturn getTagChanges(command.rest);\n\t\tcase 'worktree':\n\t\t\treturn getWorktreeChanges(command.rest);\n\t\tcase 'checkout':\n\t\tcase 'switch':\n\t\t\treturn getCheckoutChanges(command.verb, command.rest);\n\t\tcase 'stash':\n\t\t\treturn getStashChanges(command.subcommand, command.rest);\n\t\tcase 'reset':\n\t\t\tif (isPathspecReset(command.rest)) return { changes: indexChanges };\n\n\t\t\treturn { changes: changesByVerb.reset, movesHeadBranch: true };\n\t\tcase 'rebase':\n\t\t\tif (!isHeadBranchRebase(command)) return undefined;\n\n\t\t\treturn { changes: changesByVerb.rebase, movesHeadBranch: true };\n\t\tdefault:\n\t\t\tif (!headBranchVerbs.has(command.verb)) return undefined;\n\n\t\t\treturn { changes: changesByVerb[command.verb], movesHeadBranch: true };\n\t}\n}\n\n/**\n * Classifies a raw git argv for the notification `git.run`'s `notify: 'infer'` applies after the run\n * settles. Returns `undefined` for a command with nothing to announce — read-only, object-only, or a write to a\n * ref nothing cached reads — otherwise the {@link RepositoryChange} kinds it announces, the refs it names when argv\n * proves them, the `-C` re-scope target (if any), and which of those kinds every worktree sees.\n */\nexport function getChangesForCommand(args: readonly string[]): CommandChanges | undefined {\n\tconst command = leadingCommand(args);\n\tif (command.readOnly || objectOnlyVerbs.has(command.verb)) return undefined;\n\n\tconst named = getNamedChanges(command);\n\tif (named === null) return undefined;\n\n\tlet changes = named?.changes;\n\tif (changes == null) {\n\t\tif (command.verb === 'worktree') {\n\t\t\tchanges = worktreeChanges;\n\t\t} else if (command.verb === 'branch' && hasOption(command.rest, branchConfigOptions)) {\n\t\t\tchanges = branchConfigChanges;\n\t\t} else {\n\t\t\tchanges = changesByVerb[command.verb] ?? emptyChanges;\n\t\t}\n\t}\n\treturn {\n\t\t...named,\n\t\tchanges: changes,\n\t\tpathOverride: command.pathOverride,\n\t\tsharedChanges: changes.filter(c => worktreeSharedChanges.has(c)),\n\t};\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,gCAAgB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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B,IAAI,CAAC,CAAC;CAChE;AACD"}
1
+ {"version":3,"file":"commandClassifier.js","names":[],"sources":["../../../../git-cli/src/exec/commandClassifier.ts"],"sourcesContent":["import { isAbsolute, join } from 'node:path';\nimport type { RepositoryChange } from '@gitlens/git/models/repository.js';\nimport { getRefChangeKind } from '@gitlens/git/watching/changeEvent.js';\n\n/**\n * Verbs that never move a ref, the index or the working tree, so a raw run needs no notification.\n * Anything not listed is treated as a mutation: a needless notification costs a full cache eviction, a\n * missed one serves stale state. Object-writing plumbing (`hash-object -w`, `mktree`, `commit-tree`,\n * `write-tree`) is listed too: it only adds loose objects nothing cached observes.\n */\nconst readOnlyVerbs = new Set([\n\t'annotate',\n\t'archive',\n\t'blame',\n\t'cat-file',\n\t'check-attr',\n\t'check-ignore',\n\t'check-mailmap',\n\t'check-ref-format',\n\t'cherry',\n\t'commit-tree',\n\t'count-objects',\n\t'describe',\n\t'diff',\n\t'diff-files',\n\t'diff-index',\n\t'diff-tree',\n\t'for-each-ref',\n\t'fsck',\n\t'grep',\n\t'hash-object',\n\t'help',\n\t'log',\n\t'ls-files',\n\t// Asks a remote what it has; nothing local moves.\n\t'ls-remote',\n\t'ls-tree',\n\t'merge-base',\n\t'merge-tree',\n\t'mktree',\n\t'name-rev',\n\t'patch-id',\n\t'range-diff',\n\t'rev-list',\n\t'rev-parse',\n\t'shortlog',\n\t'show',\n\t'show-branch',\n\t'show-ref',\n\t'status',\n\t'var',\n\t'verify-commit',\n\t'verify-pack',\n\t'verify-tag',\n\t'version',\n\t'whatchanged',\n\t'write-tree',\n]);\n\nconst reflogWriteSubcommands: ReadonlySet<string> = new Set(['expire', 'delete', 'drop']);\n\n/**\n * Sub-commands of otherwise-mutating verbs that only list. `''` is the bare verb, which lists for `branch`,\n * `tag`, `remote` and `notes`; `branch -v` and every `tag` filter imply git's own list mode.\n */\nconst readOnlySubcommands: Readonly<Record<string, ReadonlySet<string>>> = {\n\tbranch: new Set([\n\t\t'',\n\t\t'-l',\n\t\t'--list',\n\t\t'--show-current',\n\t\t'-a',\n\t\t'-r',\n\t\t'-v',\n\t\t'-vv',\n\t\t'--verbose',\n\t\t'--contains',\n\t\t'--no-contains',\n\t\t'--merged',\n\t\t'--no-merged',\n\t\t'--points-at',\n\t]),\n\tconfig: new Set(['get', 'list']),\n\tnotes: new Set(['', 'list', 'show', 'get-ref']),\n\t// `stash create` writes a commit object and prints it; no ref moves\n\tstash: new Set(['list', 'show', 'create']),\n\ttag: new Set([\n\t\t'',\n\t\t'-l',\n\t\t'--list',\n\t\t'-n',\n\t\t'-v',\n\t\t'--verify',\n\t\t'--contains',\n\t\t'--no-contains',\n\t\t'--merged',\n\t\t'--no-merged',\n\t\t'--points-at',\n\t]),\n\tworktree: new Set(['list']),\n\tremote: new Set(['', '-v', 'get-url', 'show']),\n};\n\n/**\n * Options that make an argv write whatever else it contains, checked across the whole argv rather than\n * only its first token: `branch -r -d origin/x` leads with a listing flag and still deletes.\n */\nconst writeOptions: Readonly<Record<string, readonly string[]>> = {\n\tbranch: [\n\t\t'-d',\n\t\t'-D',\n\t\t'--delete',\n\t\t'-m',\n\t\t'-M',\n\t\t'--move',\n\t\t'-c',\n\t\t'-C',\n\t\t'--copy',\n\t\t'-f',\n\t\t'--force',\n\t\t'-t',\n\t\t'--track',\n\t\t'--no-track',\n\t\t'-u',\n\t\t'--set-upstream-to',\n\t\t'--unset-upstream',\n\t\t'--edit-description',\n\t],\n\tconfig: [\n\t\t'--add',\n\t\t'--replace-all',\n\t\t'--unset',\n\t\t'--unset-all',\n\t\t'--rename-section',\n\t\t'--remove-section',\n\t\t'-e',\n\t\t'--edit',\n\t],\n};\n\nconst configReadOptions = new Set([\n\t'--get',\n\t'--get-all',\n\t'--get-regexp',\n\t'--get-urlmatch',\n\t'--get-color',\n\t'--get-colorbool',\n\t'--list',\n\t'-l',\n]);\n\nfunction hasWriteOption(verb: string, rest: readonly string[]): boolean {\n\tconst options = writeOptions[verb];\n\tif (options == null) return false;\n\treturn hasOption(rest, options);\n}\n\nfunction hasOption(rest: readonly string[], options: readonly string[]): boolean {\n\treturn rest.some(arg => options.some(opt => arg === opt || arg.startsWith(`${opt}=`)));\n}\n\n/**\n * `config <key>` with nothing after the key is git's own read form, as is any `--get*`/`--list`. `config edit`\n * (git 2.46's subcommand form of `--edit`) also has a single non-flag argument but writes.\n */\nfunction isConfigRead(rest: readonly string[]): boolean {\n\tif (rest[0] === 'edit') return false;\n\tif (rest.some(arg => configReadOptions.has(arg))) return true;\n\n\treturn rest.filter(arg => !arg.startsWith('-')).length === 1;\n}\n\n/** Global options whose value is the next argument, so the verb scan must skip both. */\nconst globalOptionsWithValue = new Set([\n\t'-c',\n\t'--config-env',\n\t'--exec-path',\n\t'--git-dir',\n\t'--namespace',\n\t'--super-prefix',\n\t'--work-tree',\n]);\n\nexport interface LeadingCommand {\n\tverb: string;\n\treadOnly: boolean;\n\t/** The first token after the verb, unresolved — used for subcommand-shaped decisions (`worktree add`). */\n\tsubcommand?: string;\n\t/** Every token after the verb */\n\trest: readonly string[];\n\t/** The `-C <path>` target when the caller re-scopes the command to another working tree. */\n\tpathOverride?: string;\n\t/** Each `-c <key>[=<value>]` given before the verb, in order */\n\tconfigs?: readonly string[];\n}\n\n/**\n * Skips the global options (`-c key=val`, `-C path`) git accepts before the verb to find it, and notes a\n * `-C` re-scope so notification targets that tree.\n */\nexport function leadingCommand(args: readonly string[]): LeadingCommand {\n\tlet pathOverride: string | undefined;\n\tlet configs: string[] | undefined;\n\tlet i = 0;\n\twhile (i < args.length) {\n\t\tconst arg = args[i];\n\t\tif (arg === '-C') {\n\t\t\t// git applies each `-C` relative to the one before it\n\t\t\tconst path = args[i + 1];\n\t\t\tif (path != null) {\n\t\t\t\tpathOverride = pathOverride == null || isAbsolute(path) ? path : join(pathOverride, path);\n\t\t\t}\n\t\t\ti += 2;\n\n\t\t\tcontinue;\n\t\t}\n\t\tif (globalOptionsWithValue.has(arg)) {\n\t\t\tif (arg === '-c' && args[i + 1] != null) {\n\t\t\t\t(configs ??= []).push(args[i + 1]);\n\t\t\t}\n\t\t\ti += 2;\n\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg.startsWith('-')) {\n\t\t\ti += 1;\n\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tconst verb = args[i] ?? '';\n\tconst rest = args.slice(i + 1);\n\tconst readOnly =\n\t\t!hasWriteOption(verb, rest) &&\n\t\t(readOnlyVerbs.has(verb) ||\n\t\t\t(readOnlySubcommands[verb]?.has(rest[0] ?? '') ?? false) ||\n\t\t\t(verb === 'config' && isConfigRead(rest)) ||\n\t\t\t// Every `reflog` form reads (bare, `<ref>`, `show`, `list`, `exists`) except the three that rewrite\n\t\t\t// it. Base-branch detection answers \"none\" unless a branch's reflog has exactly one creation entry,\n\t\t\t// so a rewrite can make a cached \"none\" derivable; no change kind names a reflog, so it resets all.\n\t\t\t(verb === 'reflog' && !reflogWriteSubcommands.has(rest[0] ?? '')) ||\n\t\t\t// A bare `symbolic-ref <name>` reads; a second non-flag argument, or a delete, writes.\n\t\t\t(verb === 'symbolic-ref' &&\n\t\t\t\t!rest.includes('-d') &&\n\t\t\t\t!rest.includes('--delete') &&\n\t\t\t\trest.filter(a => !a.startsWith('-')).length < 2));\n\n\treturn {\n\t\tverb: verb,\n\t\treadOnly: readOnly,\n\t\tsubcommand: rest[0],\n\t\trest: rest,\n\t\tpathOverride: pathOverride,\n\t\tconfigs: configs,\n\t};\n}\n\n/**\n * The change kinds every worktree sharing a `.git` sees: its refs, stash, worktree list, the HEADs of the worktrees\n * it lists (`worktreeHead`, which every other worktree's watcher reports too) and config. The rest a classified verb\n * announces — the tree's own HEAD, the index, a paused operation, FETCH_HEAD — belong to the one tree the command ran\n * in, so a `-C`-scoped write tells the caller's own `cwd` only this subset of what it changed.\n */\nexport const worktreeSharedChanges: ReadonlySet<RepositoryChange> = new Set([\n\t'heads',\n\t'tags',\n\t'stash',\n\t'remotes',\n\t'worktrees',\n\t'worktreeHead',\n\t'config',\n]);\n\n/**\n * Verbs whose effect is confined to the object store that nothing cached observes — repacking or pruning\n * `.git/objects` changes no cached read (branches, refs, status, worktrees, …). `init` and `clone` create a\n * repository rather than mutate a registered one, so there is nothing yet registered to notify.\n */\nconst objectOnlyVerbs = new Set([\n\t'gc',\n\t'repack',\n\t'prune',\n\t'maintenance',\n\t'commit-graph',\n\t'multi-pack-index',\n\t'init',\n\t'clone',\n]);\n\n/**\n * The {@link RepositoryChange} kinds each mutating verb announces. A worktree subcommand other than a\n * listing is handled separately (see {@link getChangesForCommand}), and any verb absent from both this\n * table and {@link objectOnlyVerbs} announces `[]` — the conservative default for an unclassified\n * mutation: the caller still learns something changed, just not what. An entry covers at least what the\n * verb's typed mutator announces; `update-ref` and `symbolic-ref` name every kind their target ref could be.\n * {@link getNamedChanges} narrows the forms whose argv proves what moved, which can announce less: the typed\n * checkout announces `heads` for any target, but a `--detach` or full-SHA checkout moves only this tree's HEAD,\n * no shared ref.\n * The kinds decide which caches the announcement resets, so a verb that can start or end a paused operation\n * names `pausedOp`: `commit` concludes a merge, cherry-pick or revert, `reset` aborts one, and `am` runs in\n * `rebase-apply`.\n */\nconst changesByVerb: Readonly<Record<string, readonly RepositoryChange[]>> = {\n\tcommit: ['head', 'heads', 'index', 'pausedOp'],\n\tam: ['head', 'heads', 'index', 'pausedOp'],\n\tbisect: ['head', 'index', 'worktrees', 'worktreeHead'],\n\tcheckout: ['head', 'heads', 'index', 'worktrees', 'worktreeHead'],\n\tswitch: ['head', 'heads', 'index', 'worktrees', 'worktreeHead'],\n\treset: ['head', 'heads', 'index', 'pausedOp'],\n\tmerge: ['head', 'heads', 'index', 'pausedOp', 'merge'],\n\trebase: ['head', 'heads', 'index', 'pausedOp', 'rebase', 'worktrees', 'worktreeHead'],\n\t'cherry-pick': ['head', 'heads', 'index', 'pausedOp', 'cherryPick'],\n\trevert: ['head', 'heads', 'index', 'pausedOp', 'revert'],\n\tpull: ['head', 'heads', 'index', 'remotes', 'tags', 'lastFetched', 'pausedOp', 'merge', 'rebase'],\n\tadd: ['index'],\n\trm: ['index'],\n\tmv: ['index'],\n\trestore: ['index'],\n\tapply: ['index'],\n\t'read-tree': ['index'],\n\t'update-index': ['index'],\n\tclean: ['index'],\n\tstash: ['stash', 'index'],\n\t'update-ref': ['head', 'heads', 'remotes', 'tags', 'stash'],\n\tbranch: ['heads', 'remotes'],\n\t'symbolic-ref': ['head', 'heads', 'remotes', 'tags'],\n\t'pack-refs': ['heads', 'remotes', 'tags'],\n\ttag: ['tags'],\n\t// A refspec can write a local branch (`fetch origin main:main`), which only the typed fetch parses for\n\tfetch: ['heads', 'remotes', 'tags', 'lastFetched'],\n\tpush: ['remotes'],\n\tremote: ['remotes', 'config'],\n\tconfig: ['config', 'heads', 'remotes'],\n\tnotes: ['heads'],\n};\n\n/**\n * `branch` options that write `.git/config`: a rename, copy or delete moves or drops the branch's section, and the\n * rest set or clear its upstream or description. A plain create (or `-f`) writes tracking only from a remote-tracking\n * start point, which the `.git/config` watcher reports.\n */\nconst branchConfigOptions: readonly string[] = [\n\t'-d',\n\t'-D',\n\t'--delete',\n\t'-m',\n\t'-M',\n\t'--move',\n\t'-c',\n\t'-C',\n\t'--copy',\n\t'-t',\n\t'--track',\n\t'-u',\n\t'--set-upstream-to',\n\t'--unset-upstream',\n\t'--edit-description',\n];\nconst branchConfigChanges: readonly RepositoryChange[] = ['config', 'heads', 'remotes'];\n\n/**\n * Whether creating a branch from `startPoint` may write its tracking to `.git/config`, as git's default\n * `branch.autoSetupMerge=true` does from a remote-tracking start point. Only a name holding a `/` can be one, so a\n * local name with a `/` counts too. The `.git/config` watcher reports what this misses, such as\n * `branch.autoSetupMerge=always`.\n */\nexport function mayWriteTracking(startPoint: string | undefined, noTracking: boolean | undefined): boolean {\n\tif (noTracking || !startPoint) return false;\n\tif (startPoint.startsWith('refs/')) return startPoint.startsWith('refs/remotes/');\n\n\treturn startPoint.includes('/');\n}\n\nconst worktreeChanges: readonly RepositoryChange[] = ['worktrees', 'worktreeHead', 'heads'];\nconst emptyChanges: readonly RepositoryChange[] = [];\n\nexport interface CommandChanges {\n\tchanges: readonly RepositoryChange[];\n\t/** The `-C <path>` target when the caller re-scoped the command to another working tree. */\n\tpathOverride?: string;\n\t/** The subset of {@link changes} every worktree sharing the same `.git` sees, not just the tree the command ran in. */\n\tsharedChanges: readonly RepositoryChange[];\n\t/**\n\t * The full ref names the command creates, moves or deletes, when its argv proves them. A ref kind in\n\t * {@link changes} with a name of its kind here is fully described by those names, as `repository.onChanged`'s\n\t * `refs` are; a ref kind with none stays unnamed.\n\t */\n\trefs?: readonly string[];\n\t/** The command's `config` change touches only the `branch.<name>` sections of the local branches {@link refs} names */\n\tconfigConfinedToRefs?: boolean;\n\t/**\n\t * The command moves only the branch HEAD is on, or no branch when HEAD is detached, so `git.run` reads HEAD\n\t * before and after the run to name it.\n\t */\n\tmovesHeadBranch?: boolean;\n\t/**\n\t * The paths, as argv spells them, of the worktrees a `worktree add`, `remove`, `lock`, `unlock` or `move` acts on: a\n\t * move's source, then its destination. Unset when argv doesn't name them unambiguously.\n\t */\n\tworktreePaths?: readonly string[];\n}\n\ntype NamedChanges = Omit<CommandChanges, 'pathOverride' | 'sharedChanges' | 'worktreePaths'>;\n\nconst configHeadsChanges: readonly RepositoryChange[] = ['config', 'heads'];\nconst headsChanges: readonly RepositoryChange[] = ['heads'];\nconst remotesChanges: readonly RepositoryChange[] = ['remotes'];\nconst tagsChanges: readonly RepositoryChange[] = ['tags'];\nconst stashChanges: readonly RepositoryChange[] = ['stash'];\nconst stashIndexChanges: readonly RepositoryChange[] = ['stash', 'index'];\nconst stashBranchChanges: readonly RepositoryChange[] = [\n\t'head',\n\t'heads',\n\t'index',\n\t'stash',\n\t'worktrees',\n\t'worktreeHead',\n];\nconst indexChanges: readonly RepositoryChange[] = ['index'];\nconst headHeadsChanges: readonly RepositoryChange[] = ['head', 'heads'];\n// A checkout, rebase, bisect or `stash branch` rewrites the tree's HEAD file, which every other worktree's watcher\n// reports as `worktreeHead`: the `worktrees` and `worktreeHead` kinds reach them as shared, so that report is the\n// write's own\nconst headIndexChanges: readonly RepositoryChange[] = ['head', 'index', 'worktrees', 'worktreeHead'];\nconst checkoutChanges: readonly RepositoryChange[] = ['head', 'heads', 'index', 'worktrees', 'worktreeHead'];\nconst checkoutTrackingChanges: readonly RepositoryChange[] = [\n\t'config',\n\t'head',\n\t'heads',\n\t'index',\n\t'worktrees',\n\t'worktreeHead',\n];\nconst worktreeOnlyChanges: readonly RepositoryChange[] = ['worktrees'];\nconst worktreeHeadChanges: readonly RepositoryChange[] = ['worktrees', 'worktreeHead'];\nconst worktreeTrackingChanges: readonly RepositoryChange[] = ['config', 'worktrees', 'worktreeHead', 'heads'];\n\nconst stashRefs: readonly string[] = ['refs/stash'];\n\n/** A full object name, which `checkout` and `worktree add` never DWIM into a new branch */\nconst fullShaRegex = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i;\n\n/**\n * Whether a branch name in argv is the branch it names. Git expands `@{-<n>}` (and `@`) wherever it takes a branch\n * name, `branch -d @{-1}` deleting the previous branch, and no ref name can hold `@{` or be `@`\n */\nfunction isLiteralBranchName(name: string): boolean {\n\treturn name !== '@' && !name.includes('@{');\n}\n\ninterface ParsedArgs {\n\t/** Each option in argv order, with its value when it takes one */\n\toptions: readonly (readonly [name: string, value: string | undefined])[];\n\t/** The non-option arguments, including those after `--` */\n\tpositionals: readonly string[];\n\t/** Where `--` fell in {@link positionals}, for the verbs that take pathspecs after it */\n\tdashDash?: number;\n}\n\n/**\n * Splits a verb's arguments by its own option table, since one letter means different things to different verbs\n * (`-m` moves, merges or sets a message). An option outside the table returns `undefined` rather than a guess at\n * whether it takes a value. A valued option accepts `--opt=<v>`, `--opt <v>`, `-o <v>` and `-o<v>`.\n */\nfunction parseArgs(\n\targs: readonly string[],\n\tflags: ReadonlySet<string>,\n\tvalued: ReadonlySet<string>,\n): ParsedArgs | undefined {\n\tconst options: [string, string | undefined][] = [];\n\tconst positionals: string[] = [];\n\tlet dashDash: number | undefined;\n\tlet optionsEnded = false;\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\t\t// Still a pathspec separator after `--end-of-options`, as `checkout` and `reset` read it\n\t\tif (arg === '--' && dashDash == null) {\n\t\t\tdashDash = positionals.length;\n\t\t\toptionsEnded = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (optionsEnded || arg === '-' || !arg.startsWith('-')) {\n\t\t\tpositionals.push(arg);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === '--end-of-options') {\n\t\t\toptionsEnded = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flags.has(arg)) {\n\t\t\toptions.push([arg, undefined]);\n\t\t\tcontinue;\n\t\t}\n\t\tif (valued.has(arg)) {\n\t\t\tconst value = args[i + 1];\n\t\t\tif (value == null) return undefined;\n\n\t\t\toptions.push([arg, value]);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst long = arg.startsWith('--');\n\t\tconst name = long ? arg.split('=', 1)[0] : arg.slice(0, 2);\n\t\tif (name === arg || !valued.has(name)) return undefined;\n\n\t\toptions.push([name, arg.slice(long ? name.length + 1 : name.length)]);\n\t}\n\treturn { options: options, positionals: positionals, dashDash: dashDash };\n}\n\nfunction hasParsedOption(parsed: ParsedArgs, ...names: string[]): boolean {\n\treturn parsed.options.some(([option]) => names.includes(option));\n}\n\nconst updateRefFlags: ReadonlySet<string> = new Set(['-d', '--delete', '--no-deref', '--create-reflog']);\nconst updateRefValued: ReadonlySet<string> = new Set(['-m', '--message']);\n\n/**\n * `update-ref` moves the one ref it names, or the ref a symbolic one points to without `--no-deref`, so `HEAD` and a\n * remote's `HEAD` stay unnamed. `null` means a ref outside the namespaces core reads, which the typed\n * `updateReference` doesn't announce either. `git log --all` (graph, search, contributors) does walk such a ref when\n * it points at a commit, and argv can't tell that from a blob ref, so a row it adds or drops can stay stale until the\n * next heads change: the trade the typed write makes not to refresh every worktree on each bookkeeping write. A packed\n * ref's delete rewrites `packed-refs`, which the watcher still reports.\n */\nfunction getUpdateRefChanges(args: readonly string[]): NamedChanges | null | undefined {\n\tconst parsed = parseArgs(args, updateRefFlags, updateRefValued);\n\tif (parsed == null) return undefined;\n\n\tconst [ref] = parsed.positionals;\n\tif (!ref) return undefined;\n\tif (ref === 'HEAD') return { changes: headHeadsChanges };\n\tif (!ref.startsWith('refs/')) return undefined;\n\tif (ref.endsWith('/HEAD') && !hasParsedOption(parsed, '--no-deref')) return undefined;\n\n\tconst kind = getRefChangeKind(ref);\n\tif (kind != null) return { changes: [kind], refs: [ref] };\n\t// The watcher reports `refs/replace` as heads, and `notes` announces heads too\n\tif (ref.startsWith('refs/replace/') || ref.startsWith('refs/notes/')) return { changes: headsChanges };\n\n\treturn null;\n}\n\nconst branchFlags: ReadonlySet<string> = new Set([\n\t'-f',\n\t'--force',\n\t'--no-track',\n\t'-d',\n\t'-D',\n\t'--delete',\n\t'-m',\n\t'-M',\n\t'--move',\n\t'-c',\n\t'-C',\n\t'--copy',\n\t'-r',\n\t'--remotes',\n\t'-q',\n\t'--quiet',\n\t'--create-reflog',\n]);\nconst noValuedOptions: ReadonlySet<string> = new Set();\n\n/**\n * The create, delete, rename and copy forms of `branch` name every branch they write. A delete removes a local\n * branch's `branch.<name>` section and a rename or copy moves it; a create writes it only for tracking.\n */\nfunction getBranchChanges(args: readonly string[]): NamedChanges | undefined {\n\tconst parsed = parseArgs(args, branchFlags, noValuedOptions);\n\tif (parsed == null) return undefined;\n\n\tlet mode: 'delete' | 'move' | undefined;\n\tlet remote = false;\n\tlet noTrack = false;\n\tfor (const [option] of parsed.options) {\n\t\tswitch (option) {\n\t\t\tcase '-d':\n\t\t\tcase '-D':\n\t\t\tcase '--delete':\n\t\t\t\tif (mode === 'move') return undefined;\n\n\t\t\t\tmode = 'delete';\n\t\t\t\tbreak;\n\t\t\tcase '-m':\n\t\t\tcase '-M':\n\t\t\tcase '--move':\n\t\t\tcase '-c':\n\t\t\tcase '-C':\n\t\t\tcase '--copy':\n\t\t\t\tif (mode === 'delete') return undefined;\n\n\t\t\t\tmode = 'move';\n\t\t\t\tbreak;\n\t\t\tcase '-r':\n\t\t\tcase '--remotes':\n\t\t\t\tremote = true;\n\t\t\t\tbreak;\n\t\t\tcase '--no-track':\n\t\t\t\tnoTrack = true;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst names = parsed.positionals;\n\tif (mode === 'delete') {\n\t\tif (!names.length || !names.every(isLiteralBranchName)) return undefined;\n\t\tif (remote) return { changes: remotesChanges, refs: names.map(n => `refs/remotes/${n}`) };\n\n\t\treturn { changes: configHeadsChanges, refs: names.map(n => `refs/heads/${n}`), configConfinedToRefs: true };\n\t}\n\tif (remote) return undefined;\n\n\tif (mode === 'move') {\n\t\t// With one name, git renames or copies the current branch, which argv doesn't name\n\t\tif (names.length !== 2 || !names.every(isLiteralBranchName)) return undefined;\n\n\t\treturn { changes: configHeadsChanges, refs: names.map(n => `refs/heads/${n}`), configConfinedToRefs: true };\n\t}\n\n\tif ((names.length !== 1 && names.length !== 2) || !isLiteralBranchName(names[0])) return undefined;\n\n\tconst refs = [`refs/heads/${names[0]}`];\n\tif (mayWriteTracking(names[1], noTrack)) {\n\t\treturn { changes: configHeadsChanges, refs: refs, configConfinedToRefs: true };\n\t}\n\treturn { changes: headsChanges, refs: refs };\n}\n\nconst tagFlags: ReadonlySet<string> = new Set([\n\t'-f',\n\t'--force',\n\t'-d',\n\t'--delete',\n\t'-a',\n\t'--annotate',\n\t'-s',\n\t'--sign',\n\t'--no-sign',\n\t'-e',\n\t'--edit',\n\t'--create-reflog',\n]);\nconst tagValued: ReadonlySet<string> = new Set(['-m', '--message', '-F', '--file', '-u', '--local-user', '--cleanup']);\n\nfunction getTagChanges(args: readonly string[]): NamedChanges | undefined {\n\tconst parsed = parseArgs(args, tagFlags, tagValued);\n\tif (parsed == null) return undefined;\n\n\tconst names = parsed.positionals;\n\tif (hasParsedOption(parsed, '-d', '--delete')) {\n\t\tif (!names.length) return undefined;\n\n\t\treturn { changes: tagsChanges, refs: names.map(n => `refs/tags/${n}`) };\n\t}\n\tif (names.length !== 1 && names.length !== 2) return undefined;\n\n\treturn { changes: tagsChanges, refs: [`refs/tags/${names[0]}`] };\n}\n\n/** The `worktree` subcommands besides `add` and `list` (none writes a branch) that delete a worktree's HEAD */\nconst worktreeHeadSubcommands: ReadonlySet<string> = new Set(['remove', 'prune']);\n/** The rest, which touch no worktree's HEAD */\nconst worktreeEditSubcommands: ReadonlySet<string> = new Set(['lock', 'unlock', 'move', 'repair']);\nconst worktreeAddFlags: ReadonlySet<string> = new Set([\n\t'-f',\n\t'--force',\n\t'-d',\n\t'--detach',\n\t'--checkout',\n\t'--no-checkout',\n\t'--lock',\n\t'-q',\n\t'--quiet',\n\t'--track',\n\t'--no-track',\n\t'--guess-remote',\n\t'--no-guess-remote',\n\t'--orphan',\n]);\nconst worktreeAddValued: ReadonlySet<string> = new Set(['-b', '-B', '--reason']);\n\n/**\n * `worktree add` is the only subcommand that can create a branch: the `-b`/`-B` one it names or, without either, one\n * git DWIMs from a short commit-ish (or from the path, given none), which argv can't name. A detached or full-SHA add\n * creates none.\n */\nfunction getWorktreeChanges(args: readonly string[]): NamedChanges | undefined {\n\tconst [subcommand, ...rest] = args;\n\tif (subcommand != null && worktreeEditSubcommands.has(subcommand)) return { changes: worktreeOnlyChanges };\n\tif (subcommand != null && worktreeHeadSubcommands.has(subcommand)) return { changes: worktreeHeadChanges };\n\tif (subcommand !== 'add') return undefined;\n\n\tconst parsed = parseArgs(rest, worktreeAddFlags, worktreeAddValued);\n\tif (parsed == null) return undefined;\n\n\tlet branch: string | undefined;\n\tlet detach = false;\n\tlet orphan = false;\n\tlet track: boolean | undefined;\n\tfor (const [option, value] of parsed.options) {\n\t\tswitch (option) {\n\t\t\tcase '-b':\n\t\t\tcase '-B':\n\t\t\t\tbranch = value;\n\t\t\t\tbreak;\n\t\t\tcase '-d':\n\t\t\tcase '--detach':\n\t\t\t\tdetach = true;\n\t\t\t\tbreak;\n\t\t\tcase '--orphan':\n\t\t\t\torphan = true;\n\t\t\t\tbreak;\n\t\t\tcase '--track':\n\t\t\t\ttrack = true;\n\t\t\t\tbreak;\n\t\t\tcase '--no-track':\n\t\t\t\ttrack = false;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst [path, commitish, ...extra] = parsed.positionals;\n\tif (orphan || path == null || extra.length) return undefined;\n\n\tif (branch) {\n\t\tif (!isLiteralBranchName(branch)) return undefined;\n\n\t\tconst refs = [`refs/heads/${branch}`];\n\t\t// An explicit `--track` writes tracking from a local start point too. Git may also write\n\t\t// `extensions.relativeWorktrees` (under `worktree.useRelativePaths`), which nothing a worktree shows reads, so\n\t\t// the change is still claimed confined: unlike the typed add, a raw run can't evict the config cache unannounced\n\t\tif (track === true || mayWriteTracking(commitish, track === false)) {\n\t\t\treturn { changes: worktreeTrackingChanges, refs: refs, configConfinedToRefs: true };\n\t\t}\n\t\treturn { changes: worktreeChanges, refs: refs };\n\t}\n\tif (detach || (commitish != null && fullShaRegex.test(commitish))) return { changes: worktreeHeadChanges };\n\n\treturn undefined;\n}\n\nconst noOptions: ReadonlySet<string> = new Set();\nconst worktreeForceFlags: ReadonlySet<string> = new Set(['-f', '--force']);\nconst worktreeLockValued: ReadonlySet<string> = new Set(['--reason']);\n\n/** The `worktree` subcommands that act on worktrees argv names: their option tables and how many positionals they take */\nconst worktreePathSubcommands: Readonly<\n\tRecord<string, readonly [flags: ReadonlySet<string>, valued: ReadonlySet<string>, min: number, max: number]>\n> = {\n\tadd: [worktreeAddFlags, worktreeAddValued, 1, 2],\n\tremove: [worktreeForceFlags, noOptions, 1, 1],\n\tlock: [noOptions, worktreeLockValued, 1, 1],\n\tunlock: [noOptions, noOptions, 1, 1],\n\tmove: [worktreeForceFlags, noOptions, 2, 2],\n};\n\n/** See {@link CommandChanges.worktreePaths}; an `add`'s second positional is its commit-ish, not a path */\nfunction getWorktreePaths(args: readonly string[]): readonly string[] | undefined {\n\tconst [subcommand, ...rest] = args;\n\tconst spec = subcommand != null ? worktreePathSubcommands[subcommand] : undefined;\n\tif (spec == null) return undefined;\n\n\tconst [flags, valued, min, max] = spec;\n\tconst positionals = parseArgs(rest, flags, valued)?.positionals;\n\tif (positionals == null || positionals.length < min || positionals.length > max) return undefined;\n\n\treturn subcommand === 'move' ? positionals : positionals.slice(0, 1);\n}\n\nconst checkoutFlags: ReadonlySet<string> = new Set([\n\t'-q',\n\t'--quiet',\n\t'-f',\n\t'--force',\n\t'--detach',\n\t'--no-track',\n\t'-m',\n\t'--merge',\n\t'--progress',\n\t'--no-progress',\n\t'--ignore-other-worktrees',\n\t'--overwrite-ignore',\n\t'--no-overwrite-ignore',\n\t'--recurse-submodules',\n\t'--no-recurse-submodules',\n]);\nconst checkoutValued: ReadonlySet<string> = new Set(['-b', '-B']);\nconst switchFlags: ReadonlySet<string> = new Set([...checkoutFlags, '-d', '--discard-changes']);\nconst switchValued: ReadonlySet<string> = new Set(['-c', '-C', '--create', '--force-create']);\n\n/**\n * `checkout`/`switch` moves no existing branch, so the only shared ref it writes is one it creates: the `-b`/`-c` one\n * it names, or the one git DWIMs from a remote branch named like its lone argument. A detached or full-SHA checkout\n * creates none, and a pathspec checkout writes only the index and working tree.\n */\nfunction getCheckoutChanges(verb: 'checkout' | 'switch', args: readonly string[]): NamedChanges | undefined {\n\tconst parsed =\n\t\tverb === 'switch' ? parseArgs(args, switchFlags, switchValued) : parseArgs(args, checkoutFlags, checkoutValued);\n\tif (parsed == null) return undefined;\n\n\tlet branch: string | undefined;\n\tlet detach = false;\n\tlet noTrack = false;\n\tfor (const [option, value] of parsed.options) {\n\t\tif (value != null) {\n\t\t\tbranch = value;\n\t\t} else if (option === '-d' || option === '--detach') {\n\t\t\tdetach = true;\n\t\t} else if (option === '--no-track') {\n\t\t\tnoTrack = true;\n\t\t}\n\t}\n\n\tconst { positionals, dashDash } = parsed;\n\tconst revs = dashDash == null ? positionals : positionals.slice(0, dashDash);\n\tconst hasPaths = dashDash != null && dashDash < positionals.length;\n\tif (branch != null) {\n\t\tif (hasPaths || revs.length > 1 || !isLiteralBranchName(branch)) return undefined;\n\n\t\tconst refs = [`refs/heads/${branch}`];\n\t\tif (mayWriteTracking(revs[0], noTrack)) {\n\t\t\treturn { changes: checkoutTrackingChanges, refs: refs, configConfinedToRefs: true };\n\t\t}\n\t\treturn { changes: checkoutChanges, refs: refs };\n\t}\n\tif (hasPaths) return verb === 'checkout' ? { changes: indexChanges } : undefined;\n\tif (revs.length > 1) return undefined;\n\tif (detach) return { changes: headIndexChanges };\n\n\tconst [rev] = revs;\n\tif (rev == null || rev === '-' || rev.startsWith('@{-')) return undefined;\n\tif (fullShaRegex.test(rev)) return { changes: headIndexChanges };\n\n\t// A path, an existing ref, or a branch git DWIMs from a remote branch, tracking it from its own config section\n\treturn { changes: checkoutTrackingChanges, refs: [`refs/heads/${rev}`], configConfinedToRefs: true };\n}\n\n/**\n * A stash write moves only `refs/stash` (or its reflog, the rest of the list), save `branch`, which also creates the\n * branch it names from a commit and checks it out; `apply` moves no ref\n */\nfunction getStashChanges(subcommand: string | undefined, rest: readonly string[]): NamedChanges | undefined {\n\tswitch (subcommand) {\n\t\tcase 'branch': {\n\t\t\tconst name = rest[1];\n\t\t\tif (!name || name.startsWith('-') || !isLiteralBranchName(name)) return undefined;\n\n\t\t\treturn { changes: stashBranchChanges, refs: [`refs/heads/${name}`, ...stashRefs] };\n\t\t}\n\t\tcase undefined:\n\t\tcase 'push':\n\t\tcase 'save':\n\t\tcase 'pop':\n\t\t\treturn { changes: stashIndexChanges, refs: stashRefs };\n\t\tcase 'drop':\n\t\tcase 'clear':\n\t\tcase 'store':\n\t\t\treturn { changes: stashChanges, refs: stashRefs };\n\t\tcase 'apply':\n\t\t\treturn { changes: indexChanges };\n\t\tdefault:\n\t\t\t// A bare `stash` with options is a push\n\t\t\treturn subcommand.startsWith('-') ? { changes: stashIndexChanges, refs: stashRefs } : undefined;\n\t}\n}\n\n/** A `reset` given paths, or `-p`, restores index entries and moves no ref */\nfunction isPathspecReset(args: readonly string[]): boolean {\n\tconst dashDash = args.indexOf('--');\n\tif (dashDash >= 0 && dashDash < args.length - 1) return true;\n\n\treturn args.some(\n\t\targ =>\n\t\t\targ === '-p' ||\n\t\t\targ === '--patch' ||\n\t\t\targ === '--pathspec-from-file' ||\n\t\t\targ.startsWith('--pathspec-from-file='),\n\t);\n}\n\nconst falseConfigValues: ReadonlySet<string> = new Set(['false', 'no', 'off', '0', '']);\n\n/**\n * The `rebase` options that take the refs it writes out of argv's hands: the update-refs list was fixed when the\n * rebase started, whatever this argv says, an interactive or `--exec` todo list can write any ref, and `--update-refs`\n * spelled any other way than in full turns update-refs on\n */\nconst unprovableRebaseOptions: readonly string[] = [\n\t'--continue',\n\t'--skip',\n\t'--edit-todo',\n\t'--interactive',\n\t'--exec',\n\t'--update-refs',\n];\n\n/**\n * Whether `arg` is one of {@link unprovableRebaseOptions}, `-i` or `-x`, however git lets it be written: any unique\n * prefix of a long option, before any `=<value>` (`--cont`, `--update-ref`, `--exe=make`), and short ones bundled\n * (`-ri`, `-xmake`)\n */\nfunction isUnprovableRebaseOption(arg: string): boolean {\n\tif (arg.startsWith('--')) {\n\t\tconst name = arg.split('=', 1)[0];\n\t\treturn name.length > 2 && unprovableRebaseOptions.some(o => o.startsWith(name));\n\t}\n\treturn arg.length > 1 && arg.startsWith('-') && /[ix]/.test(arg.slice(1));\n}\n\n/**\n * Whether a `rebase` moves only the branch being rebased. Update-refs would rewrite every branch in the rebased range,\n * so it must be provably off: the last of `--update-refs`/`--no-update-refs`, else the last `-c rebase.updateRefs`\n * before the verb. An interactive or `--exec` rebase can write any ref from its todo list. Git writes the listed refs\n * only when the rebase finishes, so an abort or quit moves none.\n */\nfunction isHeadBranchRebase(command: LeadingCommand): boolean {\n\tlet off: boolean | undefined;\n\tfor (const arg of command.rest) {\n\t\tif (arg === '--' || arg === '--end-of-options') break;\n\n\t\tif (arg === '--abort' || arg === '--quit') return true;\n\n\t\tif (arg === '--no-update-refs') {\n\t\t\toff = true;\n\t\t} else if (arg === '--update-refs') {\n\t\t\toff = false;\n\t\t} else if (isUnprovableRebaseOption(arg)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (off != null) return off;\n\n\tfor (const config of command.configs ?? []) {\n\t\tconst separator = config.indexOf('=');\n\t\tconst key = separator < 0 ? config : config.slice(0, separator);\n\t\tif (key.toLowerCase() !== 'rebase.updaterefs') continue;\n\n\t\t// A bare `-c key` is git's `true`\n\t\toff = separator >= 0 && falseConfigValues.has(config.slice(separator + 1).toLowerCase());\n\t}\n\treturn off ?? false;\n}\n\n/** Verbs that move only the branch HEAD is on, or none from a detached HEAD */\nconst headBranchVerbs: ReadonlySet<string> = new Set(['commit', 'merge', 'cherry-pick', 'revert', 'am']);\n\n/**\n * What argv proves more precisely than {@link changesByVerb}: the refs a write moved, or fewer kinds. `undefined`\n * keeps the verb's table entry; `null` means the write moved nothing cached.\n */\nfunction getNamedChanges(command: LeadingCommand): NamedChanges | null | undefined {\n\tswitch (command.verb) {\n\t\tcase 'update-ref':\n\t\t\treturn getUpdateRefChanges(command.rest);\n\t\tcase 'branch':\n\t\t\treturn getBranchChanges(command.rest);\n\t\tcase 'tag':\n\t\t\treturn getTagChanges(command.rest);\n\t\tcase 'worktree':\n\t\t\treturn getWorktreeChanges(command.rest);\n\t\tcase 'checkout':\n\t\tcase 'switch':\n\t\t\treturn getCheckoutChanges(command.verb, command.rest);\n\t\tcase 'stash':\n\t\t\treturn getStashChanges(command.subcommand, command.rest);\n\t\tcase 'reset':\n\t\t\tif (isPathspecReset(command.rest)) return { changes: indexChanges };\n\n\t\t\treturn { changes: changesByVerb.reset, movesHeadBranch: true };\n\t\tcase 'rebase':\n\t\t\tif (!isHeadBranchRebase(command)) return undefined;\n\n\t\t\treturn { changes: changesByVerb.rebase, movesHeadBranch: true };\n\t\tdefault:\n\t\t\tif (!headBranchVerbs.has(command.verb)) return undefined;\n\n\t\t\treturn { changes: changesByVerb[command.verb], movesHeadBranch: true };\n\t}\n}\n\n/**\n * Classifies a raw git argv for the notification `git.run`'s `notify: 'infer'` applies after the run\n * settles. Returns `undefined` for a command with nothing to announce — read-only, object-only, or a write to a\n * ref nothing cached reads — otherwise the {@link RepositoryChange} kinds it announces, the refs it names when argv\n * proves them, the `-C` re-scope target (if any), and which of those kinds every worktree sees.\n */\nexport function getChangesForCommand(args: readonly string[]): CommandChanges | undefined {\n\tconst command = leadingCommand(args);\n\tif (command.readOnly || objectOnlyVerbs.has(command.verb)) return undefined;\n\n\tconst named = getNamedChanges(command);\n\tif (named === null) return undefined;\n\n\tlet changes = named?.changes;\n\tif (changes == null) {\n\t\tif (command.verb === 'worktree') {\n\t\t\tchanges = worktreeChanges;\n\t\t} else if (command.verb === 'branch' && hasOption(command.rest, branchConfigOptions)) {\n\t\t\tchanges = branchConfigChanges;\n\t\t} else {\n\t\t\tchanges = changesByVerb[command.verb] ?? emptyChanges;\n\t\t}\n\t}\n\tconst result: CommandChanges = {\n\t\t...named,\n\t\tchanges: changes,\n\t\tpathOverride: command.pathOverride,\n\t\tsharedChanges: changes.filter(c => worktreeSharedChanges.has(c)),\n\t};\n\tif (command.verb === 'worktree') {\n\t\tconst worktreePaths = getWorktreePaths(command.rest);\n\t\tif (worktreePaths != null) {\n\t\t\tresult.worktreePaths = worktreePaths;\n\t\t}\n\t}\n\treturn result;\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,gCAAgB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAED,MAAM,yCAA8C,IAAI,IAAI;CAAC;CAAU;CAAU;AAAM,CAAC;;;;;AAMxF,MAAM,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EAAE,SAAS,aAAa;GAElE,OAAO;IAAE,SAAS,cAAc;IAAO,iBAAiB;GAAK;EAC9D,KAAK;GACJ,IAAI,CAAC,mBAAmB,OAAO,GAAG,OAAO,KAAA;GAEzC,OAAO;IAAE,SAAS,cAAc;IAAQ,iBAAiB;GAAK;EAC/D;GACC,IAAI,CAAC,gBAAgB,IAAI,QAAQ,IAAI,GAAG,OAAO,KAAA;GAE/C,OAAO;IAAE,SAAS,cAAc,QAAQ;IAAO,iBAAiB;GAAK;CACvE;AACD;;;;;;;AAQA,SAAgB,qBAAqB,MAAqD;CACzF,MAAM,UAAU,eAAe,IAAI;CACnC,IAAI,QAAQ,YAAY,gBAAgB,IAAI,QAAQ,IAAI,GAAG,OAAO,KAAA;CAElE,MAAM,QAAQ,gBAAgB,OAAO;CACrC,IAAI,UAAU,MAAM,OAAO,KAAA;CAE3B,IAAI,UAAU,OAAO;CACrB,IAAI,WAAW,MAAM;EACpB,IAAI,QAAQ,SAAS,YACpB,UAAU;OACJ,IAAI,QAAQ,SAAS,YAAY,UAAU,QAAQ,MAAM,mBAAmB,GAClF,UAAU;OAEV,UAAU,cAAc,QAAQ,SAAS;CAE3C;CACA,MAAM,SAAyB;EAC9B,GAAG;EACM;EACT,cAAc,QAAQ;EACtB,eAAe,QAAQ,QAAO,MAAK,sBAAsB,IAAI,CAAC,CAAC;CAChE;CACA,IAAI,QAAQ,SAAS,YAAY;EAChC,MAAM,gBAAgB,iBAAiB,QAAQ,IAAI;EACnD,IAAI,iBAAiB,MACpB,OAAO,gBAAgB;CAEzB;CACA,OAAO;AACR"}
@@ -262,6 +262,8 @@ export declare class Git {
262
262
  private _changeNotifier;
263
263
  /** Bound via {@link bindHeadReader}; reads HEAD around a `notify: 'infer'` run that moves only HEAD's branch */
264
264
  private _headReader;
265
+ /** Bound via {@link bindIgnoredWorktreeRootsReader}; read before a `notify: 'infer'` worktree write */
266
+ private _ignoredWorktreeRootsReader;
265
267
  /** The classifier behind `notify: 'infer'` — a field only so tests can substitute it */
266
268
  private readonly _classify;
267
269
  constructor(_locator: () => Promise<GitLocation>, options?: GitOptions);
@@ -283,6 +285,16 @@ export declare class Git {
283
285
  * `undefined` when HEAD can't be read. With nothing bound, such a run announces its branch move unnamed.
284
286
  */
285
287
  bindHeadReader(fn: (path: string) => Promise<HeadState>): void;
288
+ /**
289
+ * Binds the reader a `notify: 'infer'` {@link run} of a worktree write calls on the tree it runs in: the absolute
290
+ * folders, under that repository's common git dir, whose worktrees the host has core ignore. No worktree list shows
291
+ * one, so its add, remove, lock, unlock or move announces no `worktrees` change. Each folder comes in every spelling
292
+ * a path may take (as the host spells the git dir, and resolved through symlinks); a path spelled through some other
293
+ * symlink keeps the change. It runs git at most once per repository (for a common git dir its files don't show),
294
+ * resolves `[]` (or `undefined`) when nothing is ignored, and rejects when the folders can't be read, which keeps the
295
+ * change. With nothing bound, every worktree write announces `worktrees`.
296
+ */
297
+ bindIgnoredWorktreeRootsReader(fn: (path: string) => Promise<readonly string[] | undefined>): void;
286
298
  /**
287
299
  * Returns the base environment for git commands. Cached to avoid spreading
288
300
  * process.env (30-100+ keys) on every call. Includes static options.env and
@@ -332,6 +344,14 @@ export declare class Git {
332
344
  private prepareNotify;
333
345
  /** Announces what {@link prepareNotify} worked out, once the run has settled */
334
346
  private applyNotify;
347
+ /**
348
+ * `command` without its `worktrees` and `worktreeHead` changes when every worktree it acts on lies under a folder
349
+ * whose worktrees are ignored, read before the run while the tree it runs in surely exists; `undefined` when nothing
350
+ * else is left to announce, since announcing `[]` would reset everything. Git first matches an argument against the
351
+ * trailing path components of every worktree, so a relative one may name a worktree outside those folders whatever
352
+ * it resolves to, and keeps the change.
353
+ */
354
+ private withoutIgnoredWorktrees;
335
355
  /** HEAD of `path` through the {@link bindHeadReader bound} reader, or `undefined` when it can't be read */
336
356
  private readHead;
337
357
  private resolveNotifyPath;
@@ -30,6 +30,13 @@ const runHookFailures = /* @__PURE__ */ new WeakSet();
30
30
  function isRunHookFailure(ex) {
31
31
  return typeof ex === "object" && ex != null && runHookFailures.has(ex);
32
32
  }
33
+ function notifySpawned(listeners) {
34
+ for (const listener of listeners) try {
35
+ listener();
36
+ } catch (ex) {
37
+ _logger.error(ex, "GitRunOptions.onSpawn");
38
+ }
39
+ }
33
40
  /**
34
41
  * Splits `paths` into `:(literal)` pathspec batches that each fit the command-line length limit after `prefix`, so a
35
42
  * folder named like a glob (`[id]/`) doesn't match its siblings.
@@ -453,6 +460,8 @@ var Git = class {
453
460
  _changeNotifier;
454
461
  /** Bound via {@link bindHeadReader}; reads HEAD around a `notify: 'infer'` run that moves only HEAD's branch */
455
462
  _headReader;
463
+ /** Bound via {@link bindIgnoredWorktreeRootsReader}; read before a `notify: 'infer'` worktree write */
464
+ _ignoredWorktreeRootsReader;
456
465
  /** The classifier behind `notify: 'infer'` — a field only so tests can substitute it */
457
466
  _classify = getChangesForCommand;
458
467
  constructor(_locator, options = {}) {
@@ -483,6 +492,18 @@ var Git = class {
483
492
  this._headReader = fn;
484
493
  }
485
494
  /**
495
+ * Binds the reader a `notify: 'infer'` {@link run} of a worktree write calls on the tree it runs in: the absolute
496
+ * folders, under that repository's common git dir, whose worktrees the host has core ignore. No worktree list shows
497
+ * one, so its add, remove, lock, unlock or move announces no `worktrees` change. Each folder comes in every spelling
498
+ * a path may take (as the host spells the git dir, and resolved through symlinks); a path spelled through some other
499
+ * symlink keeps the change. It runs git at most once per repository (for a common git dir its files don't show),
500
+ * resolves `[]` (or `undefined`) when nothing is ignored, and rejects when the folders can't be read, which keeps the
501
+ * change. With nothing bound, every worktree write announces `worktrees`.
502
+ */
503
+ bindIgnoredWorktreeRootsReader(fn) {
504
+ this._ignoredWorktreeRootsReader = fn;
505
+ }
506
+ /**
486
507
  * Returns the base environment for git commands. Cached to avoid spreading
487
508
  * process.env (30-100+ keys) on every call. Includes static options.env and
488
509
  * GCM/LC_ALL vars but NOT dynamic getEnvironment() or per-call env overrides.
@@ -638,8 +659,12 @@ var Git = class {
638
659
  pathOverride: leadingCommand(argv).pathOverride,
639
660
  changes: notify
640
661
  };
641
- const command = this._classify(argv);
662
+ let command = this._classify(argv);
642
663
  if (command == null) return void 0;
664
+ if (command.worktreePaths != null && command.changes.includes("worktrees")) {
665
+ command = await this.withoutIgnoredWorktrees(command, command.worktreePaths, this.resolveNotifyPath(options.cwd, command.pathOverride));
666
+ if (command == null) return void 0;
667
+ }
643
668
  const headBefore = command.movesHeadBranch && this._headReader != null ? await this.readHead(this.resolveNotifyPath(options.cwd, command.pathOverride)) : void 0;
644
669
  return {
645
670
  cwd: options.cwd,
@@ -681,6 +706,30 @@ var Git = class {
681
706
  }
682
707
  notifier([ranIn], changes, void 0, named);
683
708
  }
709
+ /**
710
+ * `command` without its `worktrees` and `worktreeHead` changes when every worktree it acts on lies under a folder
711
+ * whose worktrees are ignored, read before the run while the tree it runs in surely exists; `undefined` when nothing
712
+ * else is left to announce, since announcing `[]` would reset everything. Git first matches an argument against the
713
+ * trailing path components of every worktree, so a relative one may name a worktree outside those folders whatever
714
+ * it resolves to, and keeps the change.
715
+ */
716
+ async withoutIgnoredWorktrees(command, worktreePaths, ranIn) {
717
+ const reader = this._ignoredWorktreeRootsReader;
718
+ if (reader == null || !worktreePaths.every((p) => isAbsolute$1(p))) return command;
719
+ let roots;
720
+ try {
721
+ roots = await reader(ranIn);
722
+ } catch {}
723
+ if (!roots?.length) return command;
724
+ if (!worktreePaths.map((p) => normalizePath(resolve(ranIn, p))).every((p) => roots.some((root) => isDescendant(p, root)))) return command;
725
+ const changes = command.changes.filter((c) => c !== "worktrees" && c !== "worktreeHead");
726
+ if (!changes.length) return void 0;
727
+ return {
728
+ ...command,
729
+ changes,
730
+ sharedChanges: command.sharedChanges.filter((c) => c !== "worktrees" && c !== "worktreeHead")
731
+ };
732
+ }
684
733
  /** HEAD of `path` through the {@link bindHeadReader bound} reader, or `undefined` when it can't be read */
685
734
  async readHead(path) {
686
735
  try {
@@ -696,7 +745,7 @@ var Git = class {
696
745
  const start = hrtime();
697
746
  const startEpochMs = Date.now();
698
747
  gitCommand = `[${options.cwd}] ${gitCommand}`;
699
- const { beforeIndexLockRetry, cancellation, configs, correlationKey, errors: errorHandling, encoding, expectedExitCodes, runLocally: _, selfMaintenance, slownessCategory, ...opts } = options;
748
+ const { beforeIndexLockRetry, cancellation, configs, correlationKey, onSpawn, errors: errorHandling, encoding, expectedExitCodes, runLocally: _, selfMaintenance, slownessCategory, ...opts } = options;
700
749
  const runTimeout = opts.timeout ?? this.options.gitTimeout ?? 6e4;
701
750
  const runOpts = {
702
751
  ...opts,
@@ -712,15 +761,19 @@ var Git = class {
712
761
  let execStart;
713
762
  let hookFailure;
714
763
  let waiting;
715
- let promise = this.pendingCommands.get(cacheKey)?.promise;
716
- if (promise == null) {
764
+ let promise;
765
+ const pending = this.pendingCommands.get(cacheKey);
766
+ if (pending == null) {
717
767
  waiting = false;
718
768
  const deferred = defer();
719
769
  promise = deferred.promise;
720
- this.pendingCommands.set(cacheKey, {
770
+ const command = {
721
771
  cwd: options.cwd,
722
- promise
723
- });
772
+ promise,
773
+ spawned: false,
774
+ spawnListeners: onSpawn != null ? [onSpawn] : []
775
+ };
776
+ this.pendingCommands.set(cacheKey, command);
724
777
  const writesIndex = isIndexWriteCommand(args);
725
778
  const checkoutKey = writesIndex && options.cwd != null && runOpts.env?.GIT_INDEX_FILE == null ? this.resolveNotifyPath(options.cwd, leadingCommand(args).pathOverride) : void 0;
726
779
  args.unshift("-c", "core.quotepath=false", "-c", "color.ui=false", ...configs ?? emptyArray);
@@ -730,6 +783,10 @@ var Git = class {
730
783
  const gitPath = await this.path();
731
784
  const spawnQueued = () => this._queue.run(priority, () => {
732
785
  execStart = hrtime();
786
+ if (!command.spawned) {
787
+ command.spawned = true;
788
+ notifySpawned(command.spawnListeners.splice(0));
789
+ }
733
790
  return this._runSpawn(gitPath, args, encoding ?? "utf8", runOpts);
734
791
  }, cancellation);
735
792
  const beforeRetry = beforeIndexLockRetry != null ? async (lockError) => {
@@ -746,6 +803,11 @@ var Git = class {
746
803
  }).catch(() => {});
747
804
  } else {
748
805
  waiting = true;
806
+ promise = pending.promise;
807
+ if (onSpawn != null) {
808
+ if (pending.spawned) notifySpawned([onSpawn]);
809
+ else pending.spawnListeners.push(onSpawn);
810
+ }
749
811
  _logger.trace(`${formatLoggableScopeBlock("GIT")} ${gitCommand} \u00b7 awaiting existing call...`);
750
812
  }
751
813
  this.beginActiveCommand();