@statewalker/vcs-commands 0.14.0 → 0.15.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 (265) hide show
  1. package/dist/commands/add-command.d.ts.map +1 -1
  2. package/dist/commands/add-patch/patch-backend.d.ts +1 -1
  3. package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
  4. package/dist/commands/archive/remote-archive-command.d.ts +4 -1
  5. package/dist/commands/archive/remote-archive-command.d.ts.map +1 -1
  6. package/dist/commands/branch-command.d.ts +14 -2
  7. package/dist/commands/branch-command.d.ts.map +1 -1
  8. package/dist/commands/cat-file/batch-format.d.ts +8 -12
  9. package/dist/commands/cat-file/batch-format.d.ts.map +1 -1
  10. package/dist/commands/cat-file/cat-file-command.d.ts +39 -5
  11. package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
  12. package/dist/commands/check-ignore-command.d.ts.map +1 -1
  13. package/dist/commands/checkout-command.d.ts +4 -0
  14. package/dist/commands/checkout-command.d.ts.map +1 -1
  15. package/dist/commands/checkout-paths.d.ts +9 -0
  16. package/dist/commands/checkout-paths.d.ts.map +1 -1
  17. package/dist/commands/cherry-pick-command.d.ts +3 -0
  18. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  19. package/dist/commands/clean-interactive.d.ts +0 -9
  20. package/dist/commands/clean-interactive.d.ts.map +1 -1
  21. package/dist/commands/clone-command.d.ts +2 -0
  22. package/dist/commands/clone-command.d.ts.map +1 -1
  23. package/dist/commands/column/column-config.d.ts +23 -0
  24. package/dist/commands/column/column-config.d.ts.map +1 -0
  25. package/dist/commands/column/column-layout.d.ts +129 -0
  26. package/dist/commands/column/column-layout.d.ts.map +1 -0
  27. package/dist/commands/column/index.d.ts +3 -0
  28. package/dist/commands/column/index.d.ts.map +1 -0
  29. package/dist/commands/column-command.d.ts +59 -0
  30. package/dist/commands/column-command.d.ts.map +1 -0
  31. package/dist/commands/comment-char-config.d.ts +15 -0
  32. package/dist/commands/comment-char-config.d.ts.map +1 -1
  33. package/dist/commands/commit-command.d.ts +21 -2
  34. package/dist/commands/commit-command.d.ts.map +1 -1
  35. package/dist/commands/config-command.d.ts +12 -0
  36. package/dist/commands/config-command.d.ts.map +1 -1
  37. package/dist/commands/credential-helper.d.ts +214 -0
  38. package/dist/commands/credential-helper.d.ts.map +1 -0
  39. package/dist/commands/default-branch.d.ts +17 -1
  40. package/dist/commands/default-branch.d.ts.map +1 -1
  41. package/dist/commands/diff-color-config.d.ts +4 -0
  42. package/dist/commands/diff-color-config.d.ts.map +1 -1
  43. package/dist/commands/diff-command.d.ts +12 -0
  44. package/dist/commands/diff-command.d.ts.map +1 -1
  45. package/dist/commands/fast-export/fast-export-command.d.ts +89 -2
  46. package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -1
  47. package/dist/commands/fast-export/fast-import-command.d.ts +113 -8
  48. package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -1
  49. package/dist/commands/fast-export/fast-stream-support.d.ts +0 -9
  50. package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -1
  51. package/dist/commands/fetch-command.d.ts +21 -0
  52. package/dist/commands/fetch-command.d.ts.map +1 -1
  53. package/dist/commands/git-hooks.d.ts +28 -0
  54. package/dist/commands/git-hooks.d.ts.map +1 -1
  55. package/dist/commands/history-command.d.ts +173 -7
  56. package/dist/commands/history-command.d.ts.map +1 -1
  57. package/dist/commands/index-host.d.ts +19 -0
  58. package/dist/commands/index-host.d.ts.map +1 -1
  59. package/dist/commands/index-refresh.d.ts +36 -0
  60. package/dist/commands/index-refresh.d.ts.map +1 -0
  61. package/dist/commands/index.d.ts +9 -0
  62. package/dist/commands/index.d.ts.map +1 -1
  63. package/dist/commands/index.js +7 -6
  64. package/dist/commands/init-command.d.ts +20 -0
  65. package/dist/commands/init-command.d.ts.map +1 -1
  66. package/dist/commands/local-transport.d.ts +29 -1
  67. package/dist/commands/local-transport.d.ts.map +1 -1
  68. package/dist/commands/log-command.d.ts +7 -0
  69. package/dist/commands/log-command.d.ts.map +1 -1
  70. package/dist/commands/log-output.d.ts +11 -0
  71. package/dist/commands/log-output.d.ts.map +1 -1
  72. package/dist/commands/maintenance-schedule-command.d.ts +122 -0
  73. package/dist/commands/maintenance-schedule-command.d.ts.map +1 -0
  74. package/dist/commands/merge-command.d.ts +2 -0
  75. package/dist/commands/merge-command.d.ts.map +1 -1
  76. package/dist/commands/merge-index-command.d.ts +42 -0
  77. package/dist/commands/merge-index-command.d.ts.map +1 -0
  78. package/dist/commands/merge-one-file.d.ts +129 -0
  79. package/dist/commands/merge-one-file.d.ts.map +1 -0
  80. package/dist/commands/merge-support.d.ts +21 -2
  81. package/dist/commands/merge-support.d.ts.map +1 -1
  82. package/dist/commands/object-disk-info.d.ts +35 -0
  83. package/dist/commands/object-disk-info.d.ts.map +1 -0
  84. package/dist/commands/octopus-merge.d.ts +3 -3
  85. package/dist/commands/octopus-merge.d.ts.map +1 -1
  86. package/dist/commands/promisor-remote.d.ts.map +1 -1
  87. package/dist/commands/pull-command.d.ts +55 -7
  88. package/dist/commands/pull-command.d.ts.map +1 -1
  89. package/dist/commands/push-command.d.ts +18 -1
  90. package/dist/commands/push-command.d.ts.map +1 -1
  91. package/dist/commands/range-diff/range-diff-command.d.ts +37 -1
  92. package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -1
  93. package/dist/commands/rebase-command.d.ts +13 -1
  94. package/dist/commands/rebase-command.d.ts.map +1 -1
  95. package/dist/commands/ref-filter/for-each-ref-command.d.ts +3 -2
  96. package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -1
  97. package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -1
  98. package/dist/commands/ref-filter/ref-format.d.ts +26 -1
  99. package/dist/commands/ref-filter/ref-format.d.ts.map +1 -1
  100. package/dist/commands/ref-filter/ref-listing-command.d.ts +9 -0
  101. package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -1
  102. package/dist/commands/remote-transport.d.ts +27 -0
  103. package/dist/commands/remote-transport.d.ts.map +1 -1
  104. package/dist/commands/repack-command.d.ts +18 -2
  105. package/dist/commands/repack-command.d.ts.map +1 -1
  106. package/dist/commands/repo-command.d.ts +2 -7
  107. package/dist/commands/repo-command.d.ts.map +1 -1
  108. package/dist/commands/reset-command.d.ts +4 -1
  109. package/dist/commands/reset-command.d.ts.map +1 -1
  110. package/dist/commands/restore-command.d.ts.map +1 -1
  111. package/dist/commands/rev-list-command.d.ts +65 -0
  112. package/dist/commands/rev-list-command.d.ts.map +1 -1
  113. package/dist/commands/revert-command.d.ts +3 -0
  114. package/dist/commands/revert-command.d.ts.map +1 -1
  115. package/dist/commands/revision-filenames.d.ts.map +1 -1
  116. package/dist/commands/revision-range.d.ts +17 -0
  117. package/dist/commands/revision-range.d.ts.map +1 -1
  118. package/dist/commands/revision-resolver.d.ts +12 -0
  119. package/dist/commands/revision-resolver.d.ts.map +1 -1
  120. package/dist/commands/serve-repository.d.ts +17 -1
  121. package/dist/commands/serve-repository.d.ts.map +1 -1
  122. package/dist/commands/served-lazy-fetch.d.ts +61 -0
  123. package/dist/commands/served-lazy-fetch.d.ts.map +1 -0
  124. package/dist/commands/signing.d.ts +10 -4
  125. package/dist/commands/signing.d.ts.map +1 -1
  126. package/dist/commands/status-color-config.d.ts +33 -0
  127. package/dist/commands/status-color-config.d.ts.map +1 -0
  128. package/dist/commands/status-command.d.ts +15 -0
  129. package/dist/commands/status-command.d.ts.map +1 -1
  130. package/dist/commands/status-format.d.ts +46 -4
  131. package/dist/commands/status-format.d.ts.map +1 -1
  132. package/dist/commands/tag-command.d.ts +15 -1
  133. package/dist/commands/tag-command.d.ts.map +1 -1
  134. package/dist/commands/tree-restore.d.ts +14 -0
  135. package/dist/commands/tree-restore.d.ts.map +1 -1
  136. package/dist/commands/verify-command.d.ts +22 -2
  137. package/dist/commands/verify-command.d.ts.map +1 -1
  138. package/dist/commands/worktree-add-command.d.ts.map +1 -1
  139. package/dist/commands/worktree-overwrite-checks.d.ts +31 -6
  140. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
  141. package/dist/{commands-C9M78Chn.js → commands-DT3VEv50.js} +14879 -16703
  142. package/dist/errors/commit-errors.d.ts +23 -3
  143. package/dist/errors/commit-errors.d.ts.map +1 -1
  144. package/dist/errors/git-api-error.d.ts +6 -0
  145. package/dist/errors/git-api-error.d.ts.map +1 -1
  146. package/dist/errors/index.js +30 -4
  147. package/dist/{fsck-C4US3l0B.js → fsck-BZ508Elg.js} +1 -1
  148. package/dist/git-command.d.ts +33 -1
  149. package/dist/git-command.d.ts.map +1 -1
  150. package/dist/git.d.ts +104 -1
  151. package/dist/git.d.ts.map +1 -1
  152. package/dist/index.js +8 -7
  153. package/dist/{remote-transport-C43eykfK.js → local-transport-D98U6p4d.js} +184 -683
  154. package/dist/{maintenance-run-command-CoJFKr2p.js → maintenance-run-command-DZFnbnbo.js} +2285 -79
  155. package/dist/remote-config/remote-config-store.d.ts +6 -0
  156. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  157. package/dist/remote-transport-zvSqwpOB.js +4865 -0
  158. package/dist/results/cherry-pick-result.d.ts +4 -3
  159. package/dist/results/cherry-pick-result.d.ts.map +1 -1
  160. package/dist/results/diff-output.d.ts +7 -0
  161. package/dist/results/diff-output.d.ts.map +1 -1
  162. package/dist/results/diff-words.d.ts +14 -3
  163. package/dist/results/diff-words.d.ts.map +1 -1
  164. package/dist/results/index.js +1 -1
  165. package/dist/results/line-prefix-sink.d.ts +50 -0
  166. package/dist/results/line-prefix-sink.d.ts.map +1 -0
  167. package/dist/results/merge-result.d.ts +4 -3
  168. package/dist/results/merge-result.d.ts.map +1 -1
  169. package/dist/results/rebase-result.d.ts +5 -0
  170. package/dist/results/rebase-result.d.ts.map +1 -1
  171. package/dist/results/revert-result.d.ts +4 -3
  172. package/dist/results/revert-result.d.ts.map +1 -1
  173. package/dist/{results-B0CWLCAp.js → results-rF81cQse.js} +1425 -202
  174. package/dist/transport-command.d.ts +10 -0
  175. package/dist/transport-command.d.ts.map +1 -1
  176. package/package.json +12 -12
  177. package/src/commands/add-command.ts +15 -2
  178. package/src/commands/add-patch/patch-backend.ts +6 -44
  179. package/src/commands/archive/remote-archive-command.ts +10 -3
  180. package/src/commands/branch-command.ts +57 -4
  181. package/src/commands/cat-file/batch-format.ts +17 -18
  182. package/src/commands/cat-file/cat-file-command.ts +181 -15
  183. package/src/commands/check-ignore-command.ts +61 -17
  184. package/src/commands/checkout-command.ts +149 -21
  185. package/src/commands/checkout-index-command.ts +2 -1
  186. package/src/commands/checkout-paths.ts +13 -0
  187. package/src/commands/cherry-pick-command.ts +9 -0
  188. package/src/commands/clean-interactive.ts +20 -74
  189. package/src/commands/clone-command.ts +13 -0
  190. package/src/commands/column/column-config.ts +63 -0
  191. package/src/commands/column/column-layout.ts +396 -0
  192. package/src/commands/column/index.ts +2 -0
  193. package/src/commands/column-command.ts +171 -0
  194. package/src/commands/comment-char-config.ts +42 -0
  195. package/src/commands/commit-command.ts +61 -21
  196. package/src/commands/config-command.ts +28 -0
  197. package/src/commands/credential-helper.ts +807 -0
  198. package/src/commands/default-branch.ts +38 -0
  199. package/src/commands/diff-color-config.ts +23 -10
  200. package/src/commands/diff-command.ts +25 -2
  201. package/src/commands/fast-export/fast-export-command.ts +661 -35
  202. package/src/commands/fast-export/fast-import-command.ts +694 -94
  203. package/src/commands/fast-export/fast-stream-support.ts +18 -1
  204. package/src/commands/fetch-command.ts +103 -14
  205. package/src/commands/git-hooks.ts +85 -0
  206. package/src/commands/history-command.ts +952 -20
  207. package/src/commands/index-host.ts +51 -0
  208. package/src/commands/index-refresh.ts +121 -0
  209. package/src/commands/index.ts +9 -0
  210. package/src/commands/init-command.ts +34 -1
  211. package/src/commands/legacy-remotes.ts +4 -20
  212. package/src/commands/local-transport.ts +130 -9
  213. package/src/commands/log-command.ts +39 -1
  214. package/src/commands/log-output.ts +31 -4
  215. package/src/commands/maintenance-schedule-command.ts +418 -0
  216. package/src/commands/merge-command.ts +10 -0
  217. package/src/commands/merge-index-command.ts +202 -0
  218. package/src/commands/merge-one-file.ts +451 -0
  219. package/src/commands/merge-support.ts +127 -11
  220. package/src/commands/object-disk-info.ts +169 -0
  221. package/src/commands/octopus-merge.ts +37 -128
  222. package/src/commands/promisor-remote.ts +14 -3
  223. package/src/commands/pull-command.ts +173 -27
  224. package/src/commands/push-command.ts +50 -5
  225. package/src/commands/range-diff/range-diff-command.ts +86 -3
  226. package/src/commands/rebase-command.ts +46 -1
  227. package/src/commands/ref-filter/for-each-ref-command.ts +4 -3
  228. package/src/commands/ref-filter/ref-filter.ts +59 -4
  229. package/src/commands/ref-filter/ref-format.ts +83 -10
  230. package/src/commands/ref-filter/ref-listing-command.ts +30 -0
  231. package/src/commands/remote-command.ts +2 -2
  232. package/src/commands/remote-transport.ts +66 -3
  233. package/src/commands/repack-command.ts +75 -9
  234. package/src/commands/repo-command.ts +6 -70
  235. package/src/commands/reset-command.ts +11 -1
  236. package/src/commands/restore-command.ts +1 -0
  237. package/src/commands/rev-list-command.ts +205 -3
  238. package/src/commands/revert-command.ts +9 -0
  239. package/src/commands/revision-filenames.ts +32 -4
  240. package/src/commands/revision-range.ts +2 -2
  241. package/src/commands/revision-resolver.ts +21 -1
  242. package/src/commands/serve-repository.ts +34 -8
  243. package/src/commands/served-lazy-fetch.ts +164 -0
  244. package/src/commands/signing.ts +18 -10
  245. package/src/commands/status-color-config.ts +92 -0
  246. package/src/commands/status-command.ts +50 -2
  247. package/src/commands/status-format.ts +198 -50
  248. package/src/commands/tag-command.ts +57 -2
  249. package/src/commands/tree-restore.ts +17 -0
  250. package/src/commands/verify-command.ts +84 -12
  251. package/src/commands/worktree-add-command.ts +2 -0
  252. package/src/commands/worktree-overwrite-checks.ts +75 -14
  253. package/src/errors/commit-errors.ts +31 -3
  254. package/src/errors/git-api-error.ts +7 -0
  255. package/src/git-command.ts +105 -4
  256. package/src/git.ts +153 -0
  257. package/src/remote-config/remote-config-store.ts +16 -0
  258. package/src/results/cherry-pick-result.ts +4 -3
  259. package/src/results/diff-output.ts +8 -0
  260. package/src/results/diff-words.ts +160 -32
  261. package/src/results/line-prefix-sink.ts +102 -0
  262. package/src/results/merge-result.ts +4 -3
  263. package/src/results/rebase-result.ts +5 -0
  264. package/src/results/revert-result.ts +4 -3
  265. package/src/transport-command.ts +48 -2
@@ -1,7 +1,7 @@
1
1
  import { AddFailedError, BranchUsedByWorktreeError, EmptyTreeEntryNameError, GitApiError, HookFailedError, IncompatibleOptionsError, InvalidArgumentError, InvalidConfigError, InvalidPathError, MissingArgumentError, NoFilepatternError, NoHeadError, NotACommitError, NotImplementedError, RefNotFoundError, ResetRefusedError, RevisionError, StashApplyFailedError, StoreNotAvailableError, WorktreeError, WorktreesUnsupportedError } from "./errors/index.js";
2
2
  import { DEFAULT_ABBREV_LENGTH, DEFAULT_BIG_FILE_THRESHOLD, EMPTY_BLOB_ID, EMPTY_TREE_ID, FileMode, InvalidTreeEntryNameError, MINIMUM_ABBREV_LENGTH, ObjectFilterError, TreeEntryCursor, autoAbbrevLength, bloomFilterContains, bloomKey, canonTreeMode, collectCommitBytes, collectTreeBytes, commitFromBytes, compareTreeEntries, countAheadBehind, createMemoryHistory, createReplacedBlobs, createReplacedCommits, createReplacedTags, createReplacedTrees, findAbbrevLengths, formatPersonIdent, graftFileBaseDir, graftFileReader, hasReplacements, historyWithoutLazyFetch, isSymbolicRef, isValidRefName, isValidWorktreePath, listObjectsWithPrefix, loadObjectReplacements, objectFormatOf, overlayMethods, parseCoreAbbrev, parseGraphCommit, parseObjectFilter, probeBlob, protectHFSDefault, replacementOf } from "@statewalker/vcs-core";
3
3
  import { compareGitPaths, decodeGitPath, encodeGitPath, foldAsciiCase, gitCharWidth, gitCharWidthAt, gitStrWidth, parseGitBool, parseGitInt, unquoteGitPath } from "@statewalker/vcs-utils/encoding";
4
- import { AttributesResolver, DIR_HIDE_EMPTY_DIRECTORIES, DIR_SHOW_IGNORED_TOO, DIR_SHOW_IGNORED_TOO_MODE_MATCHING, DIR_SHOW_OTHER_DIRECTORIES, DeleteStagingEntry, FsmonitorState, IndexChangedError, IndexPathLookup, MergeStage, UpdateStagingEntry, applyStatUpdate, attributesIndexOf, attributesSourceSetting, basicStatMatches, cacheTreeFullyValid, cacheTreeOfTree, clearSkipWorktreeFromPresentFiles, collectChunks, compareWithWorktree, compareWithWorktreeStat, copyCacheTree, createIndexTree, createUntrackedTree, createWorktreeTree, entryStatOf, excludeFileOid, expandUserPath, findUntrackedFiles, flattenTree, getStageState, getWorktreeEntries, hasTrackedChanges, invalidateCacheTreeAgainstIndex, invalidateCacheTreeForIntentToAdd, invalidateCacheTreePath, invalidateGitignore, invalidateUntrackedPath, isCleanByStat, isIndexUnborn, modeFromWorktree, newUntrackedCache, newUntrackedCacheDir, parseSharedRepository, parseSparseCheckoutPatterns, readCleanContent, readConvertedContent, readTreeAttributesFile, refreshIndexStats, refreshableEntries, resolveAttributesSource, scanIndex, scanUntracked, smudgeContent, statDataOf, statUpdateOf, storeWorktreeFile as storeWorktreeFile$1, unreadableDirectoryWarning, untrackedCacheIdent, untrackedCacheIdentIs, untrackedIndexPredicates, updateCacheTree, walkUntrackedScanHost, wholeSeconds, wildmatch, wildmatchBytes, withWorktreeEntries, worktreeEntryChunks, xdgConfigPath, zeroStatData } from "@statewalker/vcs-working-tree";
4
+ import { AttributesResolver, DIR_HIDE_EMPTY_DIRECTORIES, DIR_SHOW_IGNORED_TOO, DIR_SHOW_IGNORED_TOO_MODE_MATCHING, DIR_SHOW_OTHER_DIRECTORIES, DeleteStagingEntry, FilterDriverError, FsmonitorState, IndexChangedError, IndexPathLookup, MergeStage, UpdateStagingEntry, applyStatUpdate, attributesIndexOf, attributesSourceSetting, basicStatMatches, cacheTreeFullyValid, cacheTreeOfTree, clearSkipWorktreeFromPresentFiles, collectChunks, compareWithWorktree, compareWithWorktreeStat, copyCacheTree, createIndexTree, createUntrackedTree, createWorktreeTree, entryStatOf, excludeFileOid, expandUserPath, findUntrackedFiles, flattenTree, getStageState, getWorktreeEntries, hasTrackedChanges, invalidateCacheTreeAgainstIndex, invalidateCacheTreeForIntentToAdd, invalidateCacheTreePath, invalidateGitignore, invalidateUntrackedPath, isCleanByStat, isIndexUnborn, modeFromWorktree, newUntrackedCache, newUntrackedCacheDir, parseSharedRepository, parseSparseCheckoutPatterns, readCleanContent, readConvertedContent, readTreeAttributesFile, refreshIndexStats, refreshableEntries, resolveAttributesSource, scanIndex, scanUntracked, smudgeContent, statDataOf, statUpdateOf, storeWorktreeFile as storeWorktreeFile$1, unreadableDirectoryWarning, untrackedCacheIdent, untrackedCacheIdentIs, untrackedIndexPredicates, updateCacheTree, walkUntrackedScanHost, wholeSeconds, wildmatch, wildmatchBytes, withWorktreeEntries, worktreeEntryChunks, xdgConfigPath, zeroStatData } from "@statewalker/vcs-working-tree";
5
5
  import { BUILTIN_FUNCNAME_PATTERNS, BUILTIN_FUNCNAME_PATTERNS_2_43, BUILTIN_WORD_REGEXES, BUILTIN_WORD_REGEXES_2_43, ByteSink, OrderedMap, PosixRegexError, RawText, SHA1_OBJECT_FORMAT, SHA256_OBJECT_FORMAT, XDF_IGNORE_WHITESPACE, XDF_IGNORE_WHITESPACE_CHANGE, XDF_WHITESPACE_FLAGS, approxidateCareful, approxidateCareful as approxidateCareful$1, bytesToHex, compilePosixRegex, compressBlockPako, createInflater, createSha1, createSha256, decodeGitBinaryDelta, diffLineCounts, formatHunkHeader, formatRfc2822Date, isNullObjectId, isUrlNormalizeError, localTimezoneOffset, mergeLines, normalizeUrl, nullObjectIdLike, objectFormatByHexLength, parseGitBool as parseGitBool$1, parseGitDate, parseGitInt as parseGitInt$1, startProgress, unifiedDiffHunks, urlMatchedEntries, userdiffFindFunction, userdiffWordRegex, whitespaceFlags, writeHunks, xdiffHunks, xdlHashRecord, xdlIsSpace, xdlRecmatch } from "@statewalker/vcs-utils";
6
6
  import { duplexOverPort } from "@statewalker/webrun-rpc";
7
7
  import { joinPath as joinPath$1, sharedRepositoryOf, withReadOnlyObjectFiles, withSharedPerm } from "@statewalker/vcs-utils/files";
@@ -582,6 +582,15 @@ var RemoteConfigStore = class RemoteConfigStore {
582
582
  this.config.set(key, values[0]);
583
583
  for (const value of values.slice(1)) this.config.add(key, value);
584
584
  }
585
+ /**
586
+ * Sets every value of a config variable as git's pattern edits change them (`git config
587
+ * <key> <new> <pattern>`, `--unset-all <key> <pattern>`): the values kept stay where they
588
+ * are, a replaced value is written on its line, the removed ones are unset.
589
+ */
590
+ editValues(key, values) {
591
+ if (this.config.editValues) this.config.editValues(key, values);
592
+ else this.setValues(key, values);
593
+ }
585
594
  /** Flush to the backing file, if the config has one. */
586
595
  async save() {
587
596
  await this.config.save?.();
@@ -1067,6 +1076,51 @@ function checkAutoCommentChar(workingCopy) {
1067
1076
  const lines = autoCommentCharLines(workingCopy, "removed");
1068
1077
  if (lines) throw new AutoCommentCharRemovedError(lines);
1069
1078
  }
1079
+ /**
1080
+ * The working copies inside a call of one of the five commands that warn (commit, merge,
1081
+ * rebase, revert, cherry-pick), with how deep: git's `GIT_AUTO_COMMENT_CHAR_CONFIG_WARNING_GIVEN`,
1082
+ * set once the warning was given so that the commands a command runs (`merge --continue`'s
1083
+ * `git commit`, a rebase step's) do not repeat it.
1084
+ */
1085
+ const warningScopes = /* @__PURE__ */ new WeakMap();
1086
+ /**
1087
+ * Enters a call of a command that warns of a deprecated `auto` comment character (git
1088
+ * 2.5x's `warn_on_auto_comment_char`): the warning's lines when this call is the outermost
1089
+ * one on `workingCopy`, git 2.43 compatibility is off and no git 3.0 is asked for (it dies
1090
+ * instead, {@link checkAutoCommentChar}); `leave` ends the call.
1091
+ *
1092
+ * ```typescript
1093
+ * const { lines, leave } = enterAutoCommentCharWarning(workingCopy, "2.56");
1094
+ * // lines: ["warning: Support for 'core.commentChar=auto' is deprecated ...", "hint:", ...]
1095
+ * ```
1096
+ */
1097
+ function enterAutoCommentCharWarning(workingCopy, compatibility) {
1098
+ const depth = warningScopes.get(workingCopy) ?? 0;
1099
+ warningScopes.set(workingCopy, depth + 1);
1100
+ const leave = () => {
1101
+ const now = (warningScopes.get(workingCopy) ?? 1) - 1;
1102
+ if (now <= 0) warningScopes.delete(workingCopy);
1103
+ else warningScopes.set(workingCopy, now);
1104
+ };
1105
+ if (depth > 0 || compatibility === "2.43") return {
1106
+ lines: void 0,
1107
+ leave
1108
+ };
1109
+ if (hostEnvironmentOf(workingCopy)?.breakingChanges) return {
1110
+ lines: void 0,
1111
+ leave
1112
+ };
1113
+ let lines;
1114
+ try {
1115
+ lines = autoCommentCharLines(workingCopy, "deprecated");
1116
+ } catch {
1117
+ lines = void 0;
1118
+ }
1119
+ return {
1120
+ lines,
1121
+ leave
1122
+ };
1123
+ }
1070
1124
  function headline(kind, key) {
1071
1125
  return kind === "removed" ? `fatal: Support for '${key}=auto' has been removed in Git 3.0` : `warning: Support for '${key}=auto' is deprecated and will be removed in Git 3.0`;
1072
1126
  }
@@ -2742,6 +2796,90 @@ var HookSession = class HookSession {
2742
2796
  };
2743
2797
  }
2744
2798
  /**
2799
+ * A credential helper as credential.c's `run_credential_helper` starts it: `command` (the
2800
+ * helper and its operation, `git credential-store get`) through the shell (`use_shell`) in
2801
+ * the directory git runs in, `stdin` written to it, its stdout kept (read only for `get`),
2802
+ * its stderr git's. Undefined without a runner or a layout (no helper runs); an exit code of
2803
+ * 127 when the runner fails to start it.
2804
+ */
2805
+ async runCredentialHelper(command, stdin) {
2806
+ const runner = this.runner;
2807
+ if (!runner) return void 0;
2808
+ const layout = await this.host.layout();
2809
+ if (!layout) return void 0;
2810
+ const { invocation } = this.invocationOf(layout, "credential-helper", {
2811
+ kind: "configured",
2812
+ name: "credential-helper",
2813
+ command
2814
+ }, {
2815
+ keepStdout: true,
2816
+ prefix: false,
2817
+ stdin
2818
+ });
2819
+ let outcome;
2820
+ try {
2821
+ outcome = await runner.run(invocation);
2822
+ } catch {
2823
+ outcome = void 0;
2824
+ }
2825
+ if (!outcome) return {
2826
+ exitCode: 127,
2827
+ stdout: /* @__PURE__ */ new Uint8Array(0),
2828
+ stderr: /* @__PURE__ */ new Uint8Array(0)
2829
+ };
2830
+ return {
2831
+ exitCode: outcome.exitCode,
2832
+ stdout: outcome.stdout,
2833
+ stderr: outcome.stderr
2834
+ };
2835
+ }
2836
+ /**
2837
+ * Runs a program git starts from an argv without a shell (run-command.c with `use_shell =
2838
+ * 0`, as `pipe_command` runs `gpg.ssh.defaultKeyCommand`): `argv[0]` as `execvp` runs it
2839
+ * (a word with a `/` is a path from the directory git runs in, any other is looked up in
2840
+ * `PATH`; no `~` or variable expansion), the arguments verbatim, stdin closed, git's own
2841
+ * variables with nothing removed. Its exit code and output; `startError` is the line git
2842
+ * prints when it cannot start the program (`error: cannot run <word>: <reason>` for a word
2843
+ * it looks up in `PATH`, `fatal: cannot exec '<path>': <reason>` for a path), the program
2844
+ * then counting as failed (exit code 127). Undefined without a runner or a layout.
2845
+ */
2846
+ async runArgv(name, argv) {
2847
+ const runner = this.runner;
2848
+ if (!runner) return void 0;
2849
+ const layout = await this.host.layout();
2850
+ if (!layout) return void 0;
2851
+ const [program = "", ...args] = argv;
2852
+ const { invocation } = this.invocationOf(layout, name, {
2853
+ kind: "configured",
2854
+ name,
2855
+ command: program
2856
+ }, {
2857
+ args,
2858
+ keepStdout: true
2859
+ });
2860
+ delete invocation.command;
2861
+ invocation.argv = true;
2862
+ let outcome;
2863
+ let failure;
2864
+ try {
2865
+ outcome = await runner.run(invocation);
2866
+ } catch (error) {
2867
+ failure = String(error?.message ?? error);
2868
+ }
2869
+ failure = outcome ? outcome.startFailure : failure ?? "No such file or directory";
2870
+ if (failure !== void 0) return {
2871
+ exitCode: 127,
2872
+ stdout: "",
2873
+ stderr: "",
2874
+ startError: program.includes("/") ? `fatal: cannot exec '${program}': ${failure}` : `error: cannot run ${program}: No such file or directory`
2875
+ };
2876
+ return {
2877
+ exitCode: outcome?.exitCode ?? 127,
2878
+ stdout: decoder$3.decode(outcome?.stdout ?? /* @__PURE__ */ new Uint8Array(0)),
2879
+ stderr: decoder$3.decode(outcome?.stderr ?? /* @__PURE__ */ new Uint8Array(0))
2880
+ };
2881
+ }
2882
+ /**
2745
2883
  * A program git runs through the shell with variables of its own (diff.c's
2746
2884
  * `run_external_diff`: `use_shell`, the worktree's top as its directory, its stdout git's):
2747
2885
  * its exit code and output as bytes; undefined without a runner or a layout, an exit code
@@ -3600,7 +3738,11 @@ async function writePlan(worktree, blobs, plan, operation, options) {
3600
3738
  ...attributes ? { attributes } : {},
3601
3739
  createParents: true,
3602
3740
  ...options.replaceInTheWay ? { replaceInTheWay: true } : {},
3603
- ...options.discardUntracked ? { discardUntracked: true } : {}
3741
+ ...options.discardUntracked ? { discardUntracked: true } : {},
3742
+ metadata: {
3743
+ ...options.metadata,
3744
+ blob: objectId
3745
+ }
3604
3746
  });
3605
3747
  options.progress?.tick();
3606
3748
  }
@@ -3677,7 +3819,8 @@ async function checkoutFreshTree(target, treeId, operation) {
3677
3819
  await writeTreeRestorePlan(worktree, blobs, plan, operation, {
3678
3820
  symlinks: target.symlinks,
3679
3821
  gitlinks: true,
3680
- progress
3822
+ progress,
3823
+ ...target.metadata ? { metadata: target.metadata } : {}
3681
3824
  });
3682
3825
  progress.stop();
3683
3826
  await staging.readTree(trees, treeId);
@@ -3706,24 +3849,27 @@ async function checkoutFreshTree(target, treeId, operation) {
3706
3849
  /**
3707
3850
  * Whether the worktree file at `path` no longer holds the index entry (git's
3708
3851
  * `verify_uptodate`): changed content, type, or executable bit where the worktree shows it.
3709
- * A missing file is no local change, but one beneath a symbolically linked directory is. With `indexTime` (the index file's mtime, as the
3710
- * caller's index was last read or written: git's `istate->timestamp`), a stat that matches
3711
- * as git's `ie_match_stat` compares it, on an entry older than the index (not racy),
3712
- * settles it without reading the file, as in git; a racy entry is read. A caller that
3713
- * rewrites the index where git does (`write_index_as_tree`) passes the new file's time.
3852
+ * A missing file is no local change, but one beneath a symbolically linked directory or a
3853
+ * file is. With `indexTime` (the index file's mtime, as the caller's index was last read or
3854
+ * written: git's `istate->timestamp`), a stat that matches as git's `ie_match_stat` compares
3855
+ * it, on an entry older than the index (not racy), settles it without reading the file, as
3856
+ * in git; a racy entry is read. A caller that rewrites the index where git does
3857
+ * (`write_index_as_tree`) passes the new file's time.
3714
3858
  */
3715
3859
  async function worktreeDiffers(worktree, path, entry, trust, indexTime) {
3716
3860
  const current = await worktree.getEntry(path);
3717
- if (!current) return entry.mode !== FileMode.GITLINK && await beneathSymlink(worktree, path);
3861
+ if (!current) return entry.mode !== FileMode.GITLINK && await leadingPathBlocked(worktree, path);
3718
3862
  return differsFrom(worktree, path, entry, current, trust, indexTime);
3719
3863
  }
3720
- /** Whether a leading directory of `path` is a symbolic link. */
3721
- async function beneathSymlink(worktree, path) {
3864
+ /**
3865
+ * Whether `path` is missing for another reason than ENOENT: a leading directory of it is a
3866
+ * symbolic link, or a file (ENOTDIR).
3867
+ */
3868
+ async function leadingPathBlocked(worktree, path) {
3722
3869
  for (let k = path.indexOf("/"); k > 0; k = path.indexOf("/", k + 1)) {
3723
3870
  const entry = await worktree.getEntry(path.slice(0, k)).catch(() => void 0);
3724
3871
  if (!entry) return false;
3725
- if (entry.mode === FileMode.SYMLINK) return true;
3726
- if (!entry.isDirectory) return false;
3872
+ if (entry.mode === FileMode.SYMLINK || !entry.isDirectory) return true;
3727
3873
  }
3728
3874
  return false;
3729
3875
  }
@@ -3991,11 +4137,11 @@ function overwriteMessage(action, found) {
3991
4137
  * before overwriting or removing its file: `ie_match_stat` with `CE_MATCH_IGNORE_VALID`, so
3992
4138
  * a stat that no longer matches is a change (the content is not compared), and a matching
3993
4139
  * one on a racy entry has its content checked. A missing file is no change, but one
3994
- * beneath a symbolically linked directory is.
4140
+ * beneath a symbolically linked directory or a file is.
3995
4141
  */
3996
4142
  async function flaggedEntryDiffers(worktree, path, entry, trust, indexTime, stat) {
3997
4143
  const current = stat === void 0 ? await worktree.getEntry(path) : stat;
3998
- if (!current) return entry.mode !== FileMode.GITLINK && await beneathSymlink(worktree, path);
4144
+ if (!current) return entry.mode !== FileMode.GITLINK && await leadingPathBlocked(worktree, path);
3999
4145
  if (current.isDirectory) return entry.mode !== FileMode.GITLINK;
4000
4146
  if (entry.mode === FileMode.GITLINK) return false;
4001
4147
  if (entry.intentToAdd) return true;
@@ -4014,6 +4160,50 @@ async function entryNotUptodate(worktree, path, entry, trust, indexTime) {
4014
4160
  if (e.assumeValid || e.skipWorktree) return flaggedEntryDiffers(worktree, path, e, trust, indexTime);
4015
4161
  return worktreeDiffers(worktree, path, entry, trust, indexTime);
4016
4162
  }
4163
+ /**
4164
+ * git's `verify_clean_subdirectory` for a two-way switch that finds a directory at `path`
4165
+ * where it writes a new file or deletes one the index lacks (`verify_absent`): the stage-0
4166
+ * index entries below it are checked in index order (`verify_uptodate`), and each clean one
4167
+ * is taken out of the switch (removed with its file, its own path then merged as if the
4168
+ * index lacked it). The first local change stops the check: the switch refuses it.
4169
+ *
4170
+ * @param taken entries taken out so far (added to)
4171
+ * @returns the entries taken by this call, or the entry whose local change refuses
4172
+ */
4173
+ async function takeCleanSubdirectory(worktree, path, index, taken, trust, indexTime) {
4174
+ const below = [...index.keys()].filter((p) => p.startsWith(`${path}/`) && !taken.has(p));
4175
+ below.sort(compareGitPaths);
4176
+ const out = [];
4177
+ for (const p of below) {
4178
+ if (await entryNotUptodate(worktree, p, index.get(p), trust, indexTime)) return {
4179
+ taken: out,
4180
+ notUptodate: p
4181
+ };
4182
+ taken.add(p);
4183
+ out.push(p);
4184
+ }
4185
+ return { taken: out };
4186
+ }
4187
+ /**
4188
+ * The first leading directory of `path` that is a file or a link in the worktree (git's
4189
+ * `check_leading_path`), whose removal a switch deleting `path` must check too.
4190
+ */
4191
+ async function leadingFileOf(worktree, path) {
4192
+ for (let k = path.indexOf("/"); k > 0; k = path.indexOf("/", k + 1)) {
4193
+ const entry = await worktree.getEntry(path.slice(0, k));
4194
+ if (!entry) return void 0;
4195
+ if (!entry.isDirectory) return path.slice(0, k);
4196
+ }
4197
+ }
4198
+ /**
4199
+ * Whether a leading directory of `path` was refused: git's traverse_trees never enters the
4200
+ * subtree of a path whose merge failed, so nothing below it is checked or reported.
4201
+ */
4202
+ function belowRefused(path, refused) {
4203
+ if (refused.size === 0) return false;
4204
+ for (let k = path.indexOf("/"); k > 0; k = path.indexOf("/", k + 1)) if (refused.has(path.slice(0, k))) return true;
4205
+ return false;
4206
+ }
4017
4207
  /** Links followed in one path at most before it is given up (POSIX `ELOOP`). */
4018
4208
  const MAX_LINKS$1 = 40;
4019
4209
  /**
@@ -4912,6 +5102,43 @@ function versionOrigin(config) {
4912
5102
  return;
4913
5103
  }
4914
5104
  }
5105
+ /**
5106
+ * `index.recordEndOfIndexEntries`, `index.recordOffsetTable` and `index.threads` as git's
5107
+ * `do_write_index` reads them: two booleans and git's `git_config_get_index_threads` (a
5108
+ * boolean or an integer: true is 0, threads by the entries and processors; false is 1, none),
5109
+ * with the processors online (`online_cpus`, `navigator.hardwareConcurrency`). A value git
5110
+ * cannot parse (it dies) is left unset.
5111
+ *
5112
+ * @example
5113
+ * ```typescript
5114
+ * indexOffsetSettingsOf((key) => (key === "index.threads" ? "true" : undefined));
5115
+ * // { threads: 0, onlineCpus: 8 }
5116
+ * ```
5117
+ */
5118
+ function indexOffsetSettingsOf(value) {
5119
+ const out = {};
5120
+ const eoie = parseGitBool$1(value("index.recordEndOfIndexEntries"));
5121
+ if (eoie !== void 0) out.recordEndOfIndexEntries = eoie;
5122
+ const ieot = parseGitBool$1(value("index.recordOffsetTable"));
5123
+ if (ieot !== void 0) out.recordOffsetTable = ieot;
5124
+ const threads = value("index.threads");
5125
+ if (threads !== void 0) {
5126
+ const lower = threads.toLowerCase();
5127
+ if (lower === "" || lower === "false" || lower === "no" || lower === "off") out.threads = 1;
5128
+ else if (lower === "true" || lower === "yes" || lower === "on") out.threads = 0;
5129
+ else {
5130
+ const n = parseGitInt$1(threads);
5131
+ if (n !== void 0) out.threads = n;
5132
+ }
5133
+ if (out.threads === 0) out.onlineCpus = onlineCpus();
5134
+ }
5135
+ return out;
5136
+ }
5137
+ /** git's `online_cpus`: the processors the runtime reports, else 1. */
5138
+ function onlineCpus() {
5139
+ const cpus = globalThis.navigator?.hardwareConcurrency;
5140
+ return typeof cpus === "number" && cpus > 0 ? cpus : 1;
5141
+ }
4915
5142
  /** The settings of the next write of `staging`, from the working copy's configuration. */
4916
5143
  async function indexSettingsOf(workingCopy, staging) {
4917
5144
  const settings = { unpackTrees: peekIndexUpdate(staging).workdir };
@@ -4928,6 +5155,7 @@ async function indexSettingsOf(workingCopy, staging) {
4928
5155
  const manyFilesOn = manyFiles === void 0 ? false : parseGitBool$1(manyFiles) ?? false;
4929
5156
  const skipHash = configValueOf(config, "index.skipHash");
4930
5157
  if (skipHash === void 0 ? manyFilesOn : parseGitBool$1(skipHash) ?? manyFilesOn) settings.skipHash = true;
5158
+ Object.assign(settings, indexOffsetSettingsOf((key) => configValueOf(config, key)));
4931
5159
  if (fsmonitorModeOf(configValueOf(config, "core.fsmonitor")).kind === "disabled") settings.fsmonitor = false;
4932
5160
  const environment = hostEnvironmentOf(workingCopy);
4933
5161
  const configured = configValueOf(config, "index.version");
@@ -5050,10 +5278,14 @@ function isValidBranchName$1(name) {
5050
5278
  * {@link NewRepositoryConfig}); without one, from the protected configuration (system,
5051
5279
  * global, command line, `gitdir:` conditions false). Without either, nothing is configured.
5052
5280
  *
5281
+ * The hint follows `options.compatibility` (default: the hook runner's, else 2.56): git 2.43
5282
+ * calls `advise()` with its own text, whatever `advice.defaultBranchName` says, 2.5x
5283
+ * `advise_if_enabled()`; `options.quiet` (`git init -q`) gives none in every version.
5284
+ *
5053
5285
  * @throws InvalidDefaultBranchError when `init.defaultBranch` names no valid branch (empty too)
5054
5286
  * @throws MissingDefaultBranchValueError when `init.defaultBranch` has no value
5055
5287
  */
5056
- async function defaultInitialBranch(environment, repositoryConfig) {
5288
+ async function defaultInitialBranch(environment, repositoryConfig, options = {}) {
5057
5289
  const config = repositoryConfig ? repositoryConfig.listWithOrigin().map((e) => ({
5058
5290
  ...e,
5059
5291
  value: e.text
@@ -5066,12 +5298,35 @@ async function defaultInitialBranch(environment, repositoryConfig) {
5066
5298
  return { name: configured.value };
5067
5299
  }
5068
5300
  const name = environment?.breakingChanges ? "main" : "master";
5301
+ if (options.quiet) return { name };
5302
+ if ((options.compatibility ?? environment?.hookRunner?.compatibility ?? "2.56") === "2.43" && !environment?.breakingChanges) return {
5303
+ name,
5304
+ hint: defaultBranchHint243(name)
5305
+ };
5069
5306
  const advice = last("advice.defaultbranchname");
5070
5307
  return advice === void 0 || parseGitBool$1(advice.value ?? "true") !== false ? {
5071
5308
  name,
5072
5309
  hint: defaultBranchHint(name, environment?.breakingChanges)
5073
5310
  } : { name };
5074
5311
  }
5312
+ /**
5313
+ * git 2.43's `default_branch_name_advice`, as its `advise()` prints it (an empty line is
5314
+ * `hint: `, with its space; no "Disable this message" line).
5315
+ */
5316
+ function defaultBranchHint243(name) {
5317
+ return [
5318
+ `Using '${name}' as the name for the initial branch. This default branch name`,
5319
+ "is subject to change. To configure the initial branch name to use in all",
5320
+ "of your new repositories, which will suppress this warning, call:",
5321
+ "",
5322
+ " git config --global init.defaultBranch <name>",
5323
+ "",
5324
+ "Names commonly chosen instead of 'master' are 'main', 'trunk' and",
5325
+ "'development'. The just-created branch can be renamed via this command:",
5326
+ "",
5327
+ " git branch -m <name>"
5328
+ ].map((line) => `hint: ${line}`);
5329
+ }
5075
5330
  /** git's `default_branch_name_advice` (2.5x, or 3.0), as `advise_if_enabled` prints it. */
5076
5331
  function defaultBranchHint(name, breakingChanges) {
5077
5332
  return `${breakingChanges ? `Using '${name}' as the name for the initial branch since Git 3.0.\nIf you expected Git to create 'master', the just-created
@@ -5386,28 +5641,17 @@ function defaultBranchName(store, compatibility) {
5386
5641
  const configured = store.value("init.defaultBranch");
5387
5642
  if (configured !== void 0 && configured !== "") return { name: configured };
5388
5643
  const name = "master";
5644
+ if (compatibility === "2.43") return {
5645
+ name,
5646
+ hint: defaultBranchHint243(name).join("\n")
5647
+ };
5389
5648
  const advice = store.value("advice.defaultBranchName");
5390
5649
  if (advice !== void 0 && parseGitBool$1(advice) === false) return { name };
5391
5650
  return {
5392
5651
  name,
5393
- hint: (compatibility === "2.43" ? defaultBranchHint243(name) : defaultBranchHint(name, false)).join("\n")
5652
+ hint: defaultBranchHint(name, false).join("\n")
5394
5653
  };
5395
5654
  }
5396
- /** git 2.43's `default_branch_name_advice` (an empty line is `hint: `, with its space). */
5397
- function defaultBranchHint243(name) {
5398
- return [
5399
- `Using '${name}' as the name for the initial branch. This default branch name`,
5400
- "is subject to change. To configure the initial branch name to use in all",
5401
- "of your new repositories, which will suppress this warning, call:",
5402
- "",
5403
- " git config --global init.defaultBranch <name>",
5404
- "",
5405
- "Names commonly chosen instead of 'master' are 'main', 'trunk' and",
5406
- "'development'. The just-created branch can be renamed via this command:",
5407
- "",
5408
- " git branch -m <name>"
5409
- ].map((line) => `hint: ${line}`);
5410
- }
5411
5655
  /**
5412
5656
  * A file of the common git directory as text, or undefined when it is not a regular file
5413
5657
  * (absent, a directory: `fopen_or_warn` reads nothing from either).
@@ -6420,7 +6664,7 @@ function createPromisorFetcher(workingCopy, options = {}) {
6420
6664
  const history = historyWithoutLazyFetch(workingCopy.history);
6421
6665
  const compatibility = compatibilityOf();
6422
6666
  const run = async () => {
6423
- const { fetchFsckOf } = await import("./fsck-C4US3l0B.js").then((n) => n.t);
6667
+ const { fetchFsckOf } = await import("./fsck-BZ508Elg.js").then((n) => n.t);
6424
6668
  const environment = hostEnvironmentOf(workingCopy);
6425
6669
  const fsckWarnings = [];
6426
6670
  const unpackLimit = unpackLimitOf({ getAll: (key) => config.values(key) }, "fetch");
@@ -6434,7 +6678,8 @@ function createPromisorFetcher(workingCopy, options = {}) {
6434
6678
  home: environment.home
6435
6679
  } : {}
6436
6680
  });
6437
- const { prepareRemote, protocolVersionOf, withRemoteUploadPack } = await import("./remote-transport-C43eykfK.js").then((n) => n.s);
6681
+ const { localLazyFetchOf, prepareRemote, protocolVersionOf, withRemoteUploadPack } = await import("./remote-transport-zvSqwpOB.js").then((n) => n.c);
6682
+ const { remoteHookSession } = await import("./local-transport-D98U6p4d.js").then((n) => n.r);
6438
6683
  await withRemoteUploadPack(await prepareRemote(workingCopy, url, options.transports ?? createDefaultTransports()), {
6439
6684
  ...options.credentials ? { credentials: options.credentials } : {},
6440
6685
  ...options.headers ? { headers: options.headers } : {},
@@ -6450,7 +6695,15 @@ function createPromisorFetcher(workingCopy, options = {}) {
6450
6695
  onWarning: options.warningCallback
6451
6696
  } : settings;
6452
6697
  },
6453
- ...options.credentialHelper ? { credentialHelper: options.credentialHelper } : {}
6698
+ ...options.credentialHelper ? { credentialHelper: options.credentialHelper } : {},
6699
+ localHooks: (remote) => remoteHookSession(workingCopy, remote, { localPush: true }),
6700
+ ...environment?.namespace ? { namespace: environment.namespace } : {},
6701
+ ...localLazyFetchOf(environment, {
6702
+ transports: options.transports ?? createDefaultTransports(),
6703
+ ...options.credentialHelper ? { credentialHelper: options.credentialHelper } : {},
6704
+ ...options.timeout !== void 0 ? { timeout: options.timeout } : {},
6705
+ ...options.warningCallback ? { warningCallback: options.warningCallback } : {}
6706
+ })
6454
6707
  }, async (connection) => {
6455
6708
  try {
6456
6709
  await fetchPromisedObjects(connection, {
@@ -8111,6 +8364,88 @@ function coloredHunkHeader(line, c) {
8111
8364
  return hunkHeader(line, c).done();
8112
8365
  }
8113
8366
  //#endregion
8367
+ //#region src/results/line-prefix-sink.ts
8368
+ /**
8369
+ * Where diff.c's `diff_line_prefix` (the graph's padding under `log --graph`) goes in a diff
8370
+ * output: a sink recording a position before every line pushed to it, except in the bytes a
8371
+ * writer marks as placing the prefix itself (git's word diff writes it only where
8372
+ * `fn_out_diff_words_write_helper` and `color_words_output_graph_prefix` put it). The log
8373
+ * inserts the prefix afterwards ({@link insertLinePrefix}), once its graph has printed the
8374
+ * commit's header and the padding is known.
8375
+ *
8376
+ * @example
8377
+ * ```typescript
8378
+ * const sink = new LinePrefixSink();
8379
+ * sink.text("diff --git a/f b/f\n");
8380
+ * sink.push(markLinePrefix(encodeGitPath("-old\n"), { before: 0, own: true }));
8381
+ * insertLinePrefix(sink.bytes(), sink.points, encodeGitPath("| ")); // "| diff --git a/f b/f\n-old\n"
8382
+ * ```
8383
+ *
8384
+ * Marks follow the chunk itself (a `WeakMap` of arrays), so they survive a sink that holds
8385
+ * chunks before passing them on unchanged (`MovedLineBuffer`), but not one that joins them.
8386
+ *
8387
+ * @module
8388
+ */
8389
+ const MARKS = /* @__PURE__ */ new WeakMap();
8390
+ /**
8391
+ * Marks `bytes` for a {@link LinePrefixSink}. The mark belongs to the array object: mark a
8392
+ * view of its own (`bytes.subarray(0)`) for each push of shared bytes.
8393
+ */
8394
+ function markLinePrefix(bytes, mark) {
8395
+ MARKS.set(bytes, mark);
8396
+ return bytes;
8397
+ }
8398
+ /** A byte sink recording where the line prefix goes: each line start, marked chunks aside */
8399
+ var LinePrefixSink = class extends ByteSink {
8400
+ /** The offsets in the output where a prefix goes, ascending (one offset may repeat) */
8401
+ points = [];
8402
+ offset = 0;
8403
+ atLineStart = true;
8404
+ /**
8405
+ * A prefix at the current end of the output, written straight to the file (diff.c's
8406
+ * `fputs(line_prefix)`): ahead of what a `MovedLineBuffer` still holds
8407
+ */
8408
+ addPoint() {
8409
+ this.points.push(this.offset);
8410
+ }
8411
+ push(bytes) {
8412
+ if (bytes.length === 0) return;
8413
+ const mark = MARKS.get(bytes);
8414
+ for (let i = 0; i < (mark?.before ?? 0); i++) this.points.push(this.offset);
8415
+ if (mark?.own) {
8416
+ super.push(bytes);
8417
+ this.offset += bytes.length;
8418
+ this.atLineStart = true;
8419
+ return;
8420
+ }
8421
+ super.push(bytes);
8422
+ let at = 0;
8423
+ while (at < bytes.length) {
8424
+ if (this.atLineStart) this.points.push(this.offset + at);
8425
+ const nl = bytes.indexOf(10, at);
8426
+ this.atLineStart = nl >= 0;
8427
+ at = nl < 0 ? bytes.length : nl + 1;
8428
+ }
8429
+ this.offset += bytes.length;
8430
+ }
8431
+ };
8432
+ /** `bytes` with `prefix` inserted at each of `points` (ascending offsets) */
8433
+ function insertLinePrefix(bytes, points, prefix) {
8434
+ if (points.length === 0 || prefix.length === 0) return bytes;
8435
+ const out = new Uint8Array(bytes.length + points.length * prefix.length);
8436
+ let size = 0;
8437
+ let from = 0;
8438
+ for (const point of points) {
8439
+ out.set(bytes.subarray(from, point), size);
8440
+ size += point - from;
8441
+ out.set(prefix, size);
8442
+ size += prefix.length;
8443
+ from = point;
8444
+ }
8445
+ out.set(bytes.subarray(from), size);
8446
+ return out;
8447
+ }
8448
+ //#endregion
8114
8449
  //#region src/results/diff-words.ts
8115
8450
  /**
8116
8451
  * git's word diff (diff.c's `diff_words_*` and `fn_out_diff_words_*`): `--word-diff=plain`,
@@ -8132,9 +8467,13 @@ function coloredHunkHeader(line, c) {
8132
8467
  * mode, one `-`/`+`/` ` line per piece with `~` for each newline in porcelain mode. Context
8133
8468
  * lines are printed without their sign (porcelain: with it, followed by `~`).
8134
8469
  *
8135
- * Not reproduced: under `log --graph` git writes the graph's line prefix in word mode only
8136
- * where a word hunk starts on a new line or a piece's text has a newline, so porcelain lines
8137
- * (and some plain or color lines) go without it; `git log` prefixes every line of ours.
8470
+ * Under `log --graph` (`linePrefix`, diff.c's `diff_line_prefix`) hunk headers and context
8471
+ * lines start with the prefix as usual, but the word diff places it itself, as git does: where
8472
+ * a word hunk starts on a new line (`color_words_output_graph_prefix`) and after each newline
8473
+ * inside a piece's text (`fn_out_diff_words_write_helper`); porcelain's `~` lines and most of
8474
+ * its `-`/`+` lines go without it. Its chunks are marked for the `LinePrefixSink` the output
8475
+ * goes through, which records where the prefix goes. A word hunk's prefix is git's `fputs`,
8476
+ * which bypasses `--color-moved`'s buffer: it lands at the start of the patch there.
8138
8477
  *
8139
8478
  * @module
8140
8479
  */
@@ -8219,25 +8558,75 @@ var Pieces = class {
8219
8558
  * Prints the piece as `DIFF_SYMBOL_WORD_DIFF` does (`fprintf("%.*s")`): up to its first NUL
8220
8559
  * byte, whatever follows (suffix, reset, newline) dropped with it
8221
8560
  */
8222
- flushTo(sink) {
8561
+ flushTo(sink, prefix) {
8562
+ const out = (b) => prefix ? prefix.push(sink, b) : sink.push(b);
8223
8563
  for (const p of this.parts) {
8224
8564
  const nul = p.indexOf(0);
8225
8565
  if (nul < 0) {
8226
- sink.push(p);
8566
+ out(p);
8227
8567
  continue;
8228
8568
  }
8229
- if (nul > 0) sink.push(p.subarray(0, nul));
8569
+ if (nul > 0) out(p.subarray(0, nul));
8230
8570
  break;
8231
8571
  }
8232
8572
  this.parts = [];
8233
8573
  }
8234
8574
  };
8235
- /** `fn_out_diff_words_write_helper`: `text` as pieces of `el`, `newline` for each LF */
8236
- function writeHelper(sink, el, newline, text) {
8575
+ /**
8576
+ * The line prefixes the word diff writes (`DIFF_SYMBOL_WORD_DIFF`s of `diff_line_prefix`),
8577
+ * each attached to the next chunk it pushes
8578
+ */
8579
+ var Prefixes = class {
8580
+ direct;
8581
+ pending = 0;
8582
+ constructor(direct) {
8583
+ this.direct = direct;
8584
+ }
8585
+ /** A prefix before whatever is pushed next */
8586
+ add() {
8587
+ this.pending++;
8588
+ }
8589
+ /**
8590
+ * A prefix `fputs` writes to the file (`fn_out_diff_words_aux`): ahead of the symbols
8591
+ * `--color-moved` buffers, else where it stands
8592
+ */
8593
+ addDirect() {
8594
+ if (this.direct) this.direct.addPoint();
8595
+ else this.add();
8596
+ }
8597
+ /** `bytes`, written by the word diff (no prefix inside it), after the pending prefixes */
8598
+ push(sink, bytes) {
8599
+ if (bytes.length === 0) return;
8600
+ sink.push(markLinePrefix(bytes.subarray(0), {
8601
+ before: this.pending,
8602
+ own: true
8603
+ }));
8604
+ this.pending = 0;
8605
+ }
8606
+ /**
8607
+ * `bytes` printed through `emit_line_0` (a context line, a hunk header: the prefix at each
8608
+ * line start as usual), after the pending prefixes
8609
+ */
8610
+ pushLine(sink, bytes) {
8611
+ if (bytes.length === 0) return;
8612
+ sink.push(this.pending > 0 ? markLinePrefix(bytes.subarray(0), {
8613
+ before: this.pending,
8614
+ own: false
8615
+ }) : bytes);
8616
+ this.pending = 0;
8617
+ }
8618
+ };
8619
+ /**
8620
+ * `fn_out_diff_words_write_helper`: `text` as pieces of `el`, `newline` for each LF, the line
8621
+ * prefix (when placed) before each piece after a newline
8622
+ */
8623
+ function writeHelper(sink, el, newline, text, prefix) {
8237
8624
  const sb = new Pieces();
8625
+ let print = false;
8238
8626
  let at = 0;
8239
8627
  let count = text.length;
8240
8628
  while (count > 0) {
8629
+ if (print) prefix?.add();
8241
8630
  const nl = text.subarray(at, at + count).indexOf(NEWLINE$1);
8242
8631
  if (nl !== 0) {
8243
8632
  const colored = el.color !== void 0 && el.color !== "";
@@ -8251,9 +8640,10 @@ function writeHelper(sink, el, newline, text) {
8251
8640
  sb.bytes(newline);
8252
8641
  count -= nl + 1;
8253
8642
  at += nl + 1;
8254
- if (count > 0) sb.flushTo(sink);
8643
+ print = true;
8644
+ if (count > 0) sb.flushTo(sink, prefix);
8255
8645
  }
8256
- sb.flushTo(sink);
8646
+ sb.flushTo(sink, prefix);
8257
8647
  }
8258
8648
  /** `find_word_boundaries`: the next word at or after `begin`, or undefined */
8259
8649
  function findWord(text, regex, start) {
@@ -8304,12 +8694,18 @@ function fillWords(text, regex) {
8304
8694
  var WordDiffState = class {
8305
8695
  sink;
8306
8696
  regex;
8697
+ prefix;
8307
8698
  minus = [];
8308
8699
  plus = [];
8309
8700
  style;
8310
- constructor(sink, regex, mode, colors) {
8701
+ /** `diff_words_data.current_plus`, an offset into the added text */
8702
+ currentPlus = 0;
8703
+ /** `diff_words_data.last_minus` */
8704
+ lastMinus = 0;
8705
+ constructor(sink, regex, mode, colors, prefix) {
8311
8706
  this.sink = sink;
8312
8707
  this.regex = regex;
8708
+ this.prefix = prefix;
8313
8709
  this.style = styleOf(mode, colors);
8314
8710
  }
8315
8711
  /** `diff_words_append`: a line without its sign, its LF included */
@@ -8320,6 +8716,17 @@ var WordDiffState = class {
8320
8716
  flush() {
8321
8717
  if (this.minus.length > 0 || this.plus.length > 0) this.show();
8322
8718
  }
8719
+ /** The line prefix as its own `DIFF_SYMBOL_WORD_DIFF` */
8720
+ writePrefix() {
8721
+ this.prefix?.add();
8722
+ }
8723
+ /**
8724
+ * `color_words_output_graph_prefix`: at the first hunk when it starts the added text, or
8725
+ * where the added text printed so far ends with a newline
8726
+ */
8727
+ prefixDue(plus) {
8728
+ return this.lastMinus === 0 && this.currentPlus === 0 || this.currentPlus > 0 && plus[this.currentPlus - 1] === NEWLINE$1;
8729
+ }
8323
8730
  /** `diff_words_show` */
8324
8731
  show() {
8325
8732
  const minus = concat$4(this.minus);
@@ -8327,11 +8734,14 @@ var WordDiffState = class {
8327
8734
  this.minus = [];
8328
8735
  this.plus = [];
8329
8736
  const style = this.style;
8737
+ const prefix = this.prefix;
8330
8738
  if (plus.length === 0) {
8331
- writeHelper(this.sink, style.oldWord, style.newline, minus);
8739
+ this.writePrefix();
8740
+ writeHelper(this.sink, style.oldWord, style.newline, minus, prefix);
8332
8741
  return;
8333
8742
  }
8334
- let currentPlus = 0;
8743
+ this.currentPlus = 0;
8744
+ this.lastMinus = 0;
8335
8745
  const mw = fillWords(minus, this.regex);
8336
8746
  const pw = fillWords(plus, this.regex);
8337
8747
  for (const change of xdiffHunks(mw.lines, pw.lines)) {
@@ -8339,12 +8749,18 @@ var WordDiffState = class {
8339
8749
  const plusFirst = change.chg2 ? change.i2 + 1 : change.i2;
8340
8750
  const [minusBegin, minusEnd] = span(mw.orig, minusFirst, change.chg1);
8341
8751
  const [plusBegin, plusEnd] = span(pw.orig, plusFirst, change.chg2);
8342
- if (currentPlus !== plusBegin) writeHelper(this.sink, style.ctx, style.newline, plus.subarray(currentPlus, plusBegin));
8343
- if (minusBegin !== minusEnd) writeHelper(this.sink, style.oldWord, style.newline, minus.subarray(minusBegin, minusEnd));
8344
- if (plusBegin !== plusEnd) writeHelper(this.sink, style.newWord, style.newline, plus.subarray(plusBegin, plusEnd));
8345
- currentPlus = plusEnd;
8752
+ if (this.prefixDue(plus)) this.prefix?.addDirect();
8753
+ const currentPlus = this.currentPlus;
8754
+ if (currentPlus !== plusBegin) writeHelper(this.sink, style.ctx, style.newline, plus.subarray(currentPlus, plusBegin), prefix);
8755
+ if (minusBegin !== minusEnd) writeHelper(this.sink, style.oldWord, style.newline, minus.subarray(minusBegin, minusEnd), prefix);
8756
+ if (plusBegin !== plusEnd) writeHelper(this.sink, style.newWord, style.newline, plus.subarray(plusBegin, plusEnd), prefix);
8757
+ this.currentPlus = plusEnd;
8758
+ this.lastMinus = minusFirst;
8759
+ }
8760
+ if (this.currentPlus !== plus.length) {
8761
+ if (this.prefixDue(plus)) this.writePrefix();
8762
+ writeHelper(this.sink, style.ctx, style.newline, plus.subarray(this.currentPlus), prefix);
8346
8763
  }
8347
- if (currentPlus !== plus.length) writeHelper(this.sink, style.ctx, style.newline, plus.subarray(currentPlus));
8348
8764
  }
8349
8765
  };
8350
8766
  /** The text a hunk of words covers: from its first word's start to its last word's end */
@@ -8368,19 +8784,17 @@ function concat$4(parts) {
8368
8784
  return out;
8369
8785
  }
8370
8786
  /** diff.c's `emit_line_0` without a sign: `set` before the text, the reset after it */
8371
- function emitLine(sink, set, reset, line) {
8787
+ function emitLine(set, reset, line) {
8372
8788
  let len = line.length;
8373
- const hasNewline = len > 0 && line[len - 1] === NEWLINE$1;
8374
- if (hasNewline) len--;
8375
- const hasCr = len > 0 && line[len - 1] === 13;
8376
- if (hasCr) len--;
8377
- if (len > 0) {
8378
- if (set) sink.push(enc$1(set));
8379
- sink.push(line.subarray(0, len));
8380
- if (reset) sink.push(enc$1(reset));
8381
- }
8382
- if (hasCr) sink.push(Uint8Array.of(13));
8383
- if (hasNewline) sink.push(Uint8Array.of(NEWLINE$1));
8789
+ if (len > 0 && line[len - 1] === NEWLINE$1) len--;
8790
+ if (len > 0 && line[len - 1] === 13) len--;
8791
+ if (len === 0 || !set && !reset) return line;
8792
+ return concat$4([
8793
+ enc$1(set),
8794
+ line.subarray(0, len),
8795
+ enc$1(reset),
8796
+ line.subarray(len)
8797
+ ]);
8384
8798
  }
8385
8799
  /**
8386
8800
  * The hunks of a text pair as diff.c's `fn_out_consume` prints them under `--word-diff`:
@@ -8391,12 +8805,15 @@ function emitLine(sink, set, reset, line) {
8391
8805
  */
8392
8806
  function writeWordDiffHunks(sink, hunks, options) {
8393
8807
  const colors = options.colors;
8394
- const state = new WordDiffState(sink, options.regex, options.mode, colors);
8808
+ const outer = options.linePrefix;
8809
+ const prefix = outer ? new Prefixes(sink === outer || sink instanceof MovedLineBuffer ? outer : void 0) : void 0;
8810
+ const state = new WordDiffState(sink, options.regex, options.mode, colors, prefix);
8811
+ const emit = (bytes) => prefix ? prefix.pushLine(sink, bytes) : sink.push(bytes);
8395
8812
  const context = colors?.context ?? "";
8396
8813
  const reset = colors?.reset ?? "";
8397
8814
  for (const hunk of hunks) {
8398
8815
  state.flush();
8399
- sink.push(colors ? coloredHunkHeader(hunk.header, colors) : hunk.header);
8816
+ emit(colors ? coloredHunkHeader(hunk.header, colors) : hunk.header);
8400
8817
  for (const line of hunk.lines) {
8401
8818
  const bytes = line.bytes;
8402
8819
  const text = bytes.length > 0 && bytes[bytes.length - 1] !== NEWLINE$1 ? withNewline$1(bytes) : bytes;
@@ -8406,9 +8823,10 @@ function writeWordDiffHunks(sink, hunks, options) {
8406
8823
  }
8407
8824
  state.flush();
8408
8825
  if (options.mode === "porcelain") {
8409
- emitLine(sink, context, reset, concat$4([Uint8Array.of(32), text]));
8410
- sink.push(TILDE_LINE);
8411
- } else emitLine(sink, context, reset, text);
8826
+ emit(emitLine(context, reset, concat$4([Uint8Array.of(32), text])));
8827
+ if (prefix) prefix.push(sink, TILDE_LINE.slice());
8828
+ else sink.push(TILDE_LINE);
8829
+ } else emit(emitLine(context, reset, text));
8412
8830
  }
8413
8831
  }
8414
8832
  state.flush();
@@ -8978,7 +9396,8 @@ async function builtinDiff(sink, pair, options, absentPath, report) {
8978
9396
  writeWordDiffHunks(sink, coloredHunksOf(result), {
8979
9397
  mode: wordDiff,
8980
9398
  ...pattern !== void 0 ? { regex: compileWordRegex(pattern) } : {},
8981
- ...colors ? { colors } : {}
9399
+ ...colors ? { colors } : {},
9400
+ ...options.linePrefix ? { linePrefix: options.linePrefix } : {}
8982
9401
  });
8983
9402
  return;
8984
9403
  }
@@ -12646,11 +13065,29 @@ async function parseRevisionAndPathArgs(resolver, args, files, options) {
12646
13065
  const revisions = dashdash < 0 ? args : args.slice(0, dashdash);
12647
13066
  const paths = dashdash < 0 ? [] : args.slice(dashdash + 1);
12648
13067
  let not = false;
12649
- for (const [i, arg] of revisions.entries()) {
12650
- if (arg === "--not") {
13068
+ let endOfOptions = false;
13069
+ const state = {
13070
+ excludes: [],
13071
+ inputGiven: false,
13072
+ stdinPaths: []
13073
+ };
13074
+ for (let i = 0; i < revisions.length; i++) {
13075
+ const arg = revisions[i];
13076
+ if (!endOfOptions && arg === "--not") {
12651
13077
  not = !not;
12652
13078
  continue;
12653
13079
  }
13080
+ if (!endOfOptions && arg === "--end-of-options") {
13081
+ endOfOptions = true;
13082
+ continue;
13083
+ }
13084
+ if (!endOfOptions && arg.startsWith("--")) {
13085
+ const taken = await handleRefOption(revisions, i, not, options, state, entries);
13086
+ if (taken > 0) {
13087
+ i += taken - 1;
13088
+ continue;
13089
+ }
13090
+ }
12654
13091
  const handled = await handleRevisionArg(resolver, arg, not, options, entries, dashdash >= 0);
12655
13092
  if (handled === false) {
12656
13093
  if (dashdash >= 0 || arg.startsWith("^")) throw new RevisionError(arg, [...resolver.warnings, `fatal: bad revision '${arg}'`].join("\n"));
@@ -12658,6 +13095,7 @@ async function parseRevisionAndPathArgs(resolver, args, files, options) {
12658
13095
  return {
12659
13096
  entries,
12660
13097
  warnings: resolver.warnings,
13098
+ inputGiven: state.inputGiven || entries.length > 0,
12661
13099
  paths: [...revisions.slice(i), ...paths]
12662
13100
  };
12663
13101
  }
@@ -12669,6 +13107,7 @@ async function parseRevisionAndPathArgs(resolver, args, files, options) {
12669
13107
  return {
12670
13108
  entries,
12671
13109
  warnings: resolver.warnings,
13110
+ inputGiven: state.inputGiven || entries.length > 0,
12672
13111
  paths
12673
13112
  };
12674
13113
  }
@@ -13144,6 +13583,12 @@ var RevisionResolver = class {
13144
13583
  * name that read no entry (`S_IFINVALID`), `<rev>:` (the tree itself) included
13145
13584
  */
13146
13585
  lastMode;
13586
+ /**
13587
+ * The path the last {@link resolve} read an entry at (git's `GET_OID_RECORD_PATH`
13588
+ * `object_context.path`: `<rev>:<path>`'s and `:<path>`'s path from the top, "" for
13589
+ * `<rev>:`); undefined for a name that reads no path
13590
+ */
13591
+ lastPath;
13147
13592
  config;
13148
13593
  disambiguateChecked = false;
13149
13594
  /**
@@ -13174,8 +13619,12 @@ var RevisionResolver = class {
13174
13619
  async resolve(name, options = {}) {
13175
13620
  this.checkDisambiguateConfig(name);
13176
13621
  this.lastMode = void 0;
13622
+ this.lastPath = void 0;
13177
13623
  const direct = await this.oid1(name, options);
13178
- if (direct !== void 0) return direct;
13624
+ if (direct !== void 0) {
13625
+ if (options.requirePath) this.die(name, `fatal: <object>:<path> required, only <object> '${name}' given`);
13626
+ return direct;
13627
+ }
13179
13628
  if (name.startsWith(":")) {
13180
13629
  if (!options.onlyToDie && name.length > 2 && name[1] === "/") return this.oneline(name.slice(2), await this.allRefCommits());
13181
13630
  let stage = 0;
@@ -13185,6 +13634,7 @@ var RevisionResolver = class {
13185
13634
  path = name.slice(3);
13186
13635
  }
13187
13636
  const resolved = this.relativePath(path, name);
13637
+ this.lastPath = resolved;
13188
13638
  const found = await this.indexEntry(resolved, stage);
13189
13639
  if (found === void 0 && options.onlyToDie && name.length > 1 && name[1] !== "/") await this.diagnoseIndexPath(name, stage, resolved);
13190
13640
  return found;
@@ -13207,6 +13657,7 @@ var RevisionResolver = class {
13207
13657
  return;
13208
13658
  }
13209
13659
  const filename = this.relativePath(name.slice(i + 1), name);
13660
+ this.lastPath = filename;
13210
13661
  const tree = await this.peelToType(treeish, "tree");
13211
13662
  const found = tree === void 0 ? void 0 : await this.treeEntry(tree, filename);
13212
13663
  if (found === void 0 && options.onlyToDie) await this.diagnoseTreePath(name, objectName, tree, filename);
@@ -14278,8 +14729,9 @@ function splitCmdline(line) {
14278
14729
  * `commit_tree_extended` / `add_header_signature` do. `commit -S` and `tag -s`/`-u` sign (the
14279
14730
  * tag's signature appended to its message, builtin/tag.c's `do_sign`), and so do the
14280
14731
  * commands that write commits for the user: rebase, cherry-pick, revert, merge and am
14281
- * (statewalker/statewalker-root#319, each through {@link signCommit}); push certificates
14282
- * still refuse.
14732
+ * (statewalker/statewalker-root#319, each through {@link signCommit}). `push --signed` signs
14733
+ * its push certificate too (send-pack's `generate_push_cert`): `PushCommand`'s push
14734
+ * certificate signer hands the certificate to {@link signPayload}.
14283
14735
  *
14284
14736
  * Without a signer every request to sign fails as native git fails when its signing program
14285
14737
  * cannot sign (gpg-interface.c `sign_buffer_gpg`: `error: gpg failed to sign the data:` with
@@ -14646,11 +15098,14 @@ function isLiteralSshKey(key) {
14646
15098
  async function defaultSshSigningKey(command, sign, host) {
14647
15099
  const argv = splitCmdline(command);
14648
15100
  if (typeof argv === "string") throw new SigningFailedError(`fatal: malformed build-time gpg.ssh.defaultKeyCommand: ${argv}`, sign, 128);
14649
- const [program = "", ...args] = argv;
15101
+ const program = argv[0] ?? "";
14650
15102
  const messages = [];
14651
15103
  let ran;
14652
15104
  if (program === "") messages.push("error: cannot run : No such file or directory");
14653
- else ran = await host?.runShellCommand("gpg.ssh.defaultKeyCommand", program, args);
15105
+ else {
15106
+ ran = await host?.runArgv("gpg.ssh.defaultKeyCommand", argv);
15107
+ if (ran?.startError !== void 0) messages.push(ran.startError);
15108
+ }
14654
15109
  const stdout = ran?.stdout ?? "";
14655
15110
  const stderr = ran?.stderr ?? "";
14656
15111
  if (ran?.exitCode === 0) {
@@ -14878,6 +15333,69 @@ var GitCommand = class {
14878
15333
  const promisor = promisorOf(workingCopy);
14879
15334
  if (promisor && !promisor.fetcher) promisor.setFetcher(createPromisorFetcher(workingCopy));
14880
15335
  this.releaseHooksAfterCalls();
15336
+ this.warnOfAutoCommentChar();
15337
+ this.holdFilterProcessesDuringCalls();
15338
+ }
15339
+ /**
15340
+ * Each entry point keeps the worktree's long-running filter processes
15341
+ * (`filter.<driver>.process`) running until it ends, then shuts them down (unless an outer
15342
+ * call still holds them): git starts such a process once per command run and stops it at
15343
+ * its exit, whatever the number of files filtered.
15344
+ */
15345
+ holdFilterProcessesDuringCalls() {
15346
+ this.aroundEntryPoints(() => {
15347
+ let worktree;
15348
+ try {
15349
+ worktree = this._workingCopy.worktree;
15350
+ } catch {
15351
+ return;
15352
+ }
15353
+ return worktree?.contentFilter?.holdProcesses?.();
15354
+ });
15355
+ }
15356
+ /**
15357
+ * The entry points that give git 2.5x's `core.commentChar=auto` deprecation warning (the
15358
+ * commands setting `warn_on_auto_comment_char`: commit, merge, rebase, revert,
15359
+ * cherry-pick); none by default.
15360
+ */
15361
+ autoCommentCharWarningEntryPoints() {
15362
+ return [];
15363
+ }
15364
+ /** The git version whose rules this command follows (default the hook runner's). */
15365
+ gitCompatibility() {
15366
+ return this.hooks.compatibility;
15367
+ }
15368
+ /**
15369
+ * Wraps {@link autoCommentCharWarningEntryPoints}: the warning's lines go in front of the
15370
+ * result's `warnings` (git prints them as the configuration is first read), or of a
15371
+ * {@link GitApiError}'s `warnings` when the call fails; an inner call (a command this one
15372
+ * runs) adds none, as git's children see `GIT_AUTO_COMMENT_CHAR_CONFIG_WARNING_GIVEN`.
15373
+ */
15374
+ warnOfAutoCommentChar() {
15375
+ const names = this.autoCommentCharWarningEntryPoints();
15376
+ if (names.length === 0) return;
15377
+ const self = this;
15378
+ for (const name of names) {
15379
+ const method = self[name];
15380
+ if (typeof method !== "function") continue;
15381
+ self[name] = async (...args) => {
15382
+ const { lines, leave } = enterAutoCommentCharWarning(this._workingCopy, this.gitCompatibility());
15383
+ try {
15384
+ const result = await method.apply(this, args);
15385
+ if (!lines || !result || typeof result !== "object") return result;
15386
+ const earlier = result.warnings ?? [];
15387
+ return {
15388
+ ...result,
15389
+ warnings: [...lines, ...earlier]
15390
+ };
15391
+ } catch (error) {
15392
+ if (lines && error instanceof GitApiError) error.warnings = [...lines, ...error.warnings ?? []];
15393
+ throw error;
15394
+ } finally {
15395
+ leave();
15396
+ }
15397
+ };
15398
+ }
14881
15399
  }
14882
15400
  /**
14883
15401
  * Each entry point of the command (`call`, `callText`, ...) puts back the ref store's
@@ -14918,11 +15436,11 @@ var GitCommand = class {
14918
15436
  try {
14919
15437
  result = method.apply(this, args);
14920
15438
  } catch (error) {
14921
- leave?.();
15439
+ Promise.resolve(leave?.()).catch(() => {});
14922
15440
  throw error;
14923
15441
  }
14924
15442
  if (leave && result && typeof result.finally === "function") return result.finally(leave);
14925
- leave?.();
15443
+ Promise.resolve(leave?.()).catch(() => {});
14926
15444
  return result;
14927
15445
  };
14928
15446
  }
@@ -15880,6 +16398,29 @@ var GitCommand = class {
15880
16398
  }
15881
16399
  }
15882
16400
  /**
16401
+ * git's checkout metadata (`init_checkout_metadata`) of a checkout of `name` (the revision
16402
+ * as given) at `id`: the ref the name names (`repo_dwim_ref`; with `fullRefsOnly` only one
16403
+ * under `refs/`, as `git reset` keeps it), and `id` peeled to its commit (else `id` as it
16404
+ * is: a tree). A long-running filter process is told them with each file's blob.
16405
+ */
16406
+ async checkoutRefOf(name, id, options = {}) {
16407
+ const resolver = this.revisionResolver();
16408
+ let ref;
16409
+ if (name !== void 0) {
16410
+ ref = (await resolver.dwimRef(name).catch(() => []))[0]?.ref;
16411
+ if (ref !== void 0 && options.fullRefsOnly && !ref.startsWith("refs/")) ref = void 0;
16412
+ }
16413
+ let treeish = id;
16414
+ if (id !== void 0) {
16415
+ const peeled = await resolver.peelTags(id).catch(() => void 0);
16416
+ if (peeled?.type === "commit") treeish = peeled.id;
16417
+ }
16418
+ return {
16419
+ ...ref !== void 0 ? { ref } : {},
16420
+ ...treeish ? { treeish } : {}
16421
+ };
16422
+ }
16423
+ /**
15883
16424
  * A resolver for git's revision syntax over this command's stores (see
15884
16425
  * {@link RevisionResolver}); its `warnings` hold what git would print.
15885
16426
  */
@@ -17733,16 +18274,43 @@ async function writeIndexAsTree(staging, trees, format, options = {}) {
17733
18274
  * directories of intent-to-add entries left invalid; nothing where the index has conflicts.
17734
18275
  * Sets the cache-tree the next `write` writes.
17735
18276
  */
17736
- async function updateIndexCacheTree(staging, trees, format) {
18277
+ async function updateIndexCacheTree(staging, trees, format, onClash) {
17737
18278
  if (!staging.getCacheTree || !staging.setCacheTree) return;
17738
18279
  if (await staging.hasConflicts()) return;
17739
18280
  const previous = staging.getCacheTree();
17740
18281
  if (previous && cacheTreeFullyValid(previous)) return;
18282
+ if (onClash) {
18283
+ const lines = verifyCacheLines(await indexEntryList(staging));
18284
+ if (lines.length > 0) {
18285
+ onClash(lines);
18286
+ return;
18287
+ }
18288
+ }
17741
18289
  const treeId = await staging.writeTree(trees);
17742
18290
  const cacheTree = await updateCacheTree(trees, treeId, previous, format);
17743
18291
  for (const entry of await indexEntryList(staging)) if (entry.intentToAdd) invalidateCacheTreeForIntentToAdd(cacheTree, entry.path);
17744
18292
  staging.setCacheTree(cacheTree);
17745
18293
  }
18294
+ /**
18295
+ * What git's `verify_cache` prints for an index of stage-0 entries holding a path and a path
18296
+ * below it: one "You have both" line per such neighbouring pair in index order, at most ten,
18297
+ * then "...".
18298
+ */
18299
+ function verifyCacheLines(entries) {
18300
+ const lines = [];
18301
+ for (let i = 0; i + 1 < entries.length; i++) {
18302
+ const name = entries[i].path;
18303
+ const next = entries[i + 1].path;
18304
+ if (next.length > name.length && next.startsWith(name) && next[name.length] === "/") {
18305
+ if (lines.length === 10) {
18306
+ lines.push("...");
18307
+ break;
18308
+ }
18309
+ lines.push(`You have both ${name} and ${next}`);
18310
+ }
18311
+ }
18312
+ return lines;
18313
+ }
17746
18314
  /** Every index entry in the index's order, at once where the staging can give them so. */
17747
18315
  async function indexEntryList(staging) {
17748
18316
  const list = staging.entryList?.();
@@ -17996,26 +18564,62 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
17996
18564
  const subs = options.submodules;
17997
18565
  /** Paths whose submodule checks replace the untracked-file checks (verify_absent_1) */
17998
18566
  const submodulePaths = /* @__PURE__ */ new Set();
18567
+ /**
18568
+ * Index entries git's verify_clean_subdirectory took out of the switch: the entries below a
18569
+ * directory that a new file replaces or a deletion removes (no index entry at the
18570
+ * directory's own path). Each is removed, and its own path merged as if the index lacked it.
18571
+ */
18572
+ const consumed = /* @__PURE__ */ new Set();
18573
+ /** Directories deleted_entry's verify_absent checks for untracked files */
18574
+ const absentDirs = [];
18575
+ /** Paths whose merge failed: traverse_trees enters no subtree of theirs */
18576
+ const refused = /* @__PURE__ */ new Set();
18577
+ /** The paths each refusal list holds (a path is listed once) */
18578
+ const listed = /* @__PURE__ */ new Map();
18579
+ const refuse = (list, path, at = path) => {
18580
+ let seen = listed.get(list);
18581
+ if (!seen) {
18582
+ seen = new Set(list);
18583
+ listed.set(list, seen);
18584
+ }
18585
+ if (!seen.has(at)) {
18586
+ seen.add(at);
18587
+ list.push(at);
18588
+ }
18589
+ refused.add(path);
18590
+ };
18591
+ /**
18592
+ * verify_absent of `path` (no index entry there) finding a directory: the clean index
18593
+ * entries below it are taken out, a local change refuses `path`. Whether it passed.
18594
+ */
18595
+ const cleanSubdirectory = async (path) => {
18596
+ const result = await takeCleanSubdirectory(checked, path, index, consumed, trust, indexTime);
18597
+ removes.push(...result.taken);
18598
+ if (result.notUptodate === void 0) return true;
18599
+ refuse(local, path, result.notUptodate);
18600
+ return false;
18601
+ };
17999
18602
  const paths = [.../* @__PURE__ */ new Set([...head.keys(), ...target.keys()])].sort();
18000
18603
  for (const path of paths) {
18604
+ if (belowRefused(path, refused)) continue;
18001
18605
  const h = head.get(path);
18002
18606
  const t = target.get(path);
18003
- const i = index.get(path);
18607
+ const i = consumed.has(path) ? void 0 : index.get(path);
18004
18608
  if (sameEntry$3(h, t) && !(options.initialCheckout && t && !i)) continue;
18005
18609
  if (i) {
18006
18610
  if (t && sameEntry$3(i, t)) continue;
18007
18611
  if (!sameEntry$3(i, h)) {
18008
- staged.push(path);
18612
+ refuse(staged, path);
18009
18613
  continue;
18010
18614
  }
18011
18615
  if (subs && checked && !quiet(path) && i.mode === FileMode.GITLINK) {
18012
18616
  if (!t && update && await subs.isSubmodule(path, i) && await subs.exists(path)) await subs.refuses(path, (h ?? i).objectId, null);
18013
- const refused = await subs.notUptodate(path, i);
18014
- if (refused) {
18015
- local.push(path);
18617
+ const notUptodate = await subs.notUptodate(path, i);
18618
+ if (notUptodate) {
18619
+ refuse(local, path);
18016
18620
  continue;
18017
18621
  }
18018
- if (refused === false) {
18622
+ if (notUptodate === false) {
18019
18623
  if (t && t.mode !== FileMode.GITLINK) await subs.fileReplacesRefuses(path, i);
18020
18624
  if (t) await subs.mergedRefuses(path, i, t);
18021
18625
  (t ? updates : removes).push(path);
@@ -18023,7 +18627,7 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
18023
18627
  }
18024
18628
  }
18025
18629
  if (checked && !quiet(path) && await entryNotUptodate(checked, path, i, trust, indexTime)) {
18026
- local.push(path);
18630
+ refuse(local, path);
18027
18631
  continue;
18028
18632
  }
18029
18633
  if (subs && t && !quiet(path)) await subs.mergedRefuses(path, i, t);
@@ -18032,7 +18636,7 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
18032
18636
  }
18033
18637
  if (t) {
18034
18638
  if (h && !options.initialCheckout) {
18035
- staged.push(path);
18639
+ refuse(staged, path);
18036
18640
  continue;
18037
18641
  }
18038
18642
  if (subs && !quiet(path)) {
@@ -18040,15 +18644,29 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
18040
18644
  if (absent !== void 0) submodulePaths.add(path);
18041
18645
  if (!absent) await subs.mergedRefuses(path, void 0, t);
18042
18646
  }
18647
+ if (worktree && !quiet(path) && t.mode !== FileMode.GITLINK) {
18648
+ if ((await worktree.getEntry(path))?.isDirectory && !await cleanSubdirectory(path)) continue;
18649
+ }
18043
18650
  updates.push(path);
18044
18651
  continue;
18045
18652
  }
18046
- if (worktree && await untrackedFileAt(worktree, path)) untrackedRemoved.push(path);
18653
+ if (!worktree || quiet(path)) continue;
18654
+ const there = await worktree.getEntry(path);
18655
+ if (there?.isDirectory) {
18656
+ if (h?.mode !== FileMode.GITLINK && await cleanSubdirectory(path)) absentDirs.push(path);
18657
+ continue;
18658
+ }
18659
+ if (there) {
18660
+ if (!consumed.has(path) && await untrackedFileAt(worktree, path)) refuse(untrackedRemoved, path);
18661
+ continue;
18662
+ }
18663
+ const leading = await leadingFileOf(worktree, path);
18664
+ if (leading !== void 0 && !(index.has(leading) && (consumed.has(leading) || removes.includes(leading))) && !await worktree.isIgnored(leading)) refuse(untrackedRemoved, path, leading);
18047
18665
  }
18048
18666
  const deleting = [...removes, ...local.filter((p) => !target.has(p))];
18049
18667
  const writing = new Set(updates.filter((p) => !sparse || sparse.writes(p)));
18050
18668
  const found = worktree ? await findInTheWay(worktree, {
18051
- writes: [...writing].filter((p) => !submodulePaths.has(p)),
18669
+ writes: [...[...writing].filter((p) => !submodulePaths.has(p)), ...absentDirs],
18052
18670
  removes: new Set(deleting),
18053
18671
  index,
18054
18672
  ...await restoreCaseOptions(worktree, ignoreCase),
@@ -18149,7 +18767,8 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
18149
18767
  direction: "checkout",
18150
18768
  index: attributesIndexOf(result)
18151
18769
  },
18152
- progress
18770
+ progress,
18771
+ ...options.metadata ? { metadata: options.metadata } : {}
18153
18772
  });
18154
18773
  }
18155
18774
  progress.stop();
@@ -27474,6 +28093,7 @@ var LogPrinter = class {
27474
28093
  const width = this.graph ? this.graph.getWidth() : 0;
27475
28094
  const diffOptions = {
27476
28095
  ...width ? { statWidth: 80 - width } : {},
28096
+ ...this.graph ? { linePrefix: true } : {},
27477
28097
  ...this.follow && this.followPath !== void 0 ? { follow: this.followPath } : {},
27478
28098
  ...this.options.fullDiff ? { fullDiff: true } : {},
27479
28099
  ...this.diffAbbrev()
@@ -27493,7 +28113,8 @@ var LogPrinter = class {
27493
28113
  this.out.text("\n");
27494
28114
  }
27495
28115
  }
27496
- this.out.bytes(prefixLines(result.bytes, this.padding()));
28116
+ const padding = this.padding();
28117
+ this.out.bytes(result.prefixPoints ? insertLinePrefix(result.bytes, result.prefixPoints, bytesOf$1(padding)) : prefixLines(result.bytes, padding));
27497
28118
  }
27498
28119
  /** combine-diff.c's diff_tree_combined for a merge */
27499
28120
  async combined(entry, log, dense) {
@@ -32573,6 +33194,26 @@ var LogCommand = class extends GitCommand {
32573
33194
  this.useBloomFilters = use;
32574
33195
  return this;
32575
33196
  }
33197
+ /**
33198
+ * fast-export.c's rewrite_commit over the walk just made: from `id`, the first commit along
33199
+ * first parents that is a merge, UNINTERESTING or not TREESAME (the commit a ref or tag of a
33200
+ * path-limited export is moved to); `null` when the line ends in TREESAME commits (git's
33201
+ * NULL: the ref is filtered to nothing). A commit the walk never met is its own answer.
33202
+ */
33203
+ rewriteCommit(id) {
33204
+ const t = this.lastWalk;
33205
+ let n = t?.find(id);
33206
+ if (t === void 0 || n === void 0) return id;
33207
+ for (;;) {
33208
+ const parents = t.parsed(n) ? t.parentList(n) : [];
33209
+ if (parents.length > 1) break;
33210
+ if (t.flag(n) & UNINTERESTING) break;
33211
+ if (!(t.flag(n) & TREESAME)) break;
33212
+ if (parents.length === 0) return null;
33213
+ n = parents[0];
33214
+ }
33215
+ return t.idOf(n);
33216
+ }
32576
33217
  /** What the path-limited walk did so far (see {@link LogPathStatistics}). */
32577
33218
  getStatistics() {
32578
33219
  return {
@@ -34226,6 +34867,7 @@ var LogCommand = class extends GitCommand {
34226
34867
  const diff = new DiffCommand(this._workingCopy);
34227
34868
  prepare?.(diff);
34228
34869
  diff.setOldTree(oldTree).setNewTree(newTree).setRotateStrict(false).setTreeWalk(this.treeWalk).shareReadsOf(this);
34870
+ if (options.linePrefix) diff.setLinePrefixPoints(true);
34229
34871
  if (this.colorSettings) diff.setColorSettings(this.colorSettings);
34230
34872
  diff.setOptions({
34231
34873
  ...this.diffOptions,
@@ -35203,6 +35845,15 @@ var RevTable = class {
35203
35845
  this.byId.set(id, n);
35204
35846
  return n;
35205
35847
  }
35848
+ /** The commit `id` when the table holds it (nothing is added). */
35849
+ find(id) {
35850
+ const known = this.byId.get(id);
35851
+ if (known !== void 0) return known;
35852
+ const pos = this.graph ? this.graph.position(id) : -1;
35853
+ if (pos < 0) return void 0;
35854
+ const n = this.byPos[pos] - 1;
35855
+ return n >= 0 ? n : void 0;
35856
+ }
35206
35857
  /** The commit at graph position `pos`, added when first met. */
35207
35858
  lookupPos(pos) {
35208
35859
  const byPos = this.byPos;
@@ -36488,7 +37139,7 @@ var SubmoduleUnpack = class SubmoduleUnpack {
36488
37139
  }
36489
37140
  async m() {
36490
37141
  if (this.loadedMover) return this.loadedMover;
36491
- this.moverLoad ??= import("./commands-C9M78Chn.js").then((n) => n.Vn).then((commands) => {
37142
+ this.moverLoad ??= import("./commands-DT3VEv50.js").then((n) => n.Pn).then((commands) => {
36492
37143
  this.commands = commands;
36493
37144
  this.loadedMover = new commands.SubmoduleHeadMover(this.workingCopy, this.superPrefix);
36494
37145
  return this.loadedMover;
@@ -37218,7 +37869,7 @@ var ResetCommand = class extends GitCommand {
37218
37869
  blobs: this.blobs,
37219
37870
  workingCopy: this.workingCopy,
37220
37871
  worktree
37221
- }, commit.tree, trackedBefore, keptOut, sparse, submodules, unchanged);
37872
+ }, commit.tree, trackedBefore, keptOut, sparse, submodules, unchanged, await this.checkoutRefOf(this.ref ?? "HEAD", targetId, { fullRefsOnly: true }));
37222
37873
  }
37223
37874
  /**
37224
37875
  * Reset staging area to match a tree.
@@ -37299,7 +37950,7 @@ var ResetCommand = class extends GitCommand {
37299
37950
  * patterns are written, nothing that stays outside is removed, and the files leaving the
37300
37951
  * checkout are unlinked first. Returns the paths written.
37301
37952
  */
37302
- async function restoreWorktreeHard(deps, treeId, trackedBefore, keptOut, sparse, submodules, unchanged) {
37953
+ async function restoreWorktreeHard(deps, treeId, trackedBefore, keptOut, sparse, submodules, unchanged, metadata) {
37303
37954
  const { trees, blobs, workingCopy, worktree } = deps;
37304
37955
  const subs = submodules?.unpack;
37305
37956
  const oldGitlink = (path) => {
@@ -37343,7 +37994,8 @@ async function restoreWorktreeHard(deps, treeId, trackedBefore, keptOut, sparse,
37343
37994
  await writeTreeRestorePlan(worktree, blobs, plan, RESET_HARD, {
37344
37995
  symlinks: worktreeModeTrust(workingCopy, worktree).symlinks,
37345
37996
  replaceInTheWay: true,
37346
- discardUntracked: true
37997
+ discardUntracked: true,
37998
+ ...metadata ? { metadata } : {}
37347
37999
  });
37348
38000
  if (subs) {
37349
38001
  subs.reload();
@@ -39635,7 +40287,7 @@ function parseColorSpec(spec) {
39635
40287
  return `\x1b[${parts.join(";")}m`;
39636
40288
  }
39637
40289
  /** The length of the ANSI color sequence at `at` (display_mode_esc_sequence_len); 0 if none. */
39638
- function escapeLength(text, at) {
40290
+ function escapeLength$1(text, at) {
39639
40291
  if (text[at] !== "\x1B" || text[at + 1] !== "[") return 0;
39640
40292
  let i = at + 2;
39641
40293
  while (i < text.length && /[0-9;]/.test(text[i])) i++;
@@ -39652,7 +40304,7 @@ function charWidth(cp) {
39652
40304
  function displayWidth(text) {
39653
40305
  let w = 0;
39654
40306
  for (let i = 0; i < text.length;) {
39655
- const esc = escapeLength(text, i);
40307
+ const esc = escapeLength$1(text, i);
39656
40308
  if (esc) {
39657
40309
  i += esc;
39658
40310
  continue;
@@ -39669,7 +40321,7 @@ function utf8Replace(text, pos, width, subst) {
39669
40321
  let w = 0;
39670
40322
  let replaced = false;
39671
40323
  for (let i = 0; i < text.length;) {
39672
- const esc = escapeLength(text, i);
40324
+ const esc = escapeLength$1(text, i);
39673
40325
  if (esc) {
39674
40326
  out += text.slice(i, i + esc);
39675
40327
  i += esc;
@@ -39717,10 +40369,10 @@ function wrapText(text, indent1, indent2, width) {
39717
40369
  }
39718
40370
  let i = 0;
39719
40371
  for (;;) {
39720
- let esc = escapeLength(text, i);
40372
+ let esc = escapeLength$1(text, i);
39721
40373
  while (esc) {
39722
40374
  i += esc;
39723
- esc = escapeLength(text, i);
40375
+ esc = escapeLength$1(text, i);
39724
40376
  }
39725
40377
  const c = text[i];
39726
40378
  if (c === void 0 || GIT_SPACE.test(c)) {
@@ -40242,7 +40894,7 @@ async function formatAndPad(fmt, at, st, cx) {
40242
40894
  if (sb[ch] !== "m") break;
40243
40895
  let q = ch - 1;
40244
40896
  while (q > 0 && ch - q < 10 && sb[q] !== "\x1B") q--;
40245
- if (sb[q] !== "\x1B" || ch + 1 - q !== escapeLength(sb, q)) break;
40897
+ if (sb[q] !== "\x1B" || ch + 1 - q !== escapeLength$1(sb, q)) break;
40246
40898
  local = sb.slice(q, ch + 1) + local;
40247
40899
  ch = q - 1;
40248
40900
  }
@@ -40594,11 +41246,11 @@ const DEFAULT_DECORATION_COLORS = Object.freeze({
40594
41246
  grafted: "\x1B[1;34m"
40595
41247
  });
40596
41248
  /** Where a variable was read, as git names it when it dies */
40597
- function where(key, file, line) {
41249
+ function badConfigVariableLine(key, file, line) {
40598
41250
  return file !== void 0 && line !== void 0 ? `fatal: bad config variable '${key}' in file '${file}' at line ${line}` : `fatal: unable to parse '${key}' from command-line config`;
40599
41251
  }
40600
41252
  /** color.c's `git_config_colorbool` (`undefined` for git's unknown) */
40601
- function colorBool(key, value) {
41253
+ function readColorBool(key, value) {
40602
41254
  if (value !== void 0) {
40603
41255
  const lower = value.toLowerCase();
40604
41256
  if (lower === "never" || lower === "always" || lower === "auto") return lower;
@@ -40637,33 +41289,33 @@ function readDiffColorSettings(workingCopy, options, uiConfig = true) {
40637
41289
  let wsErrorHighlight = WSEH_NEW;
40638
41290
  const entries = workingCopy.config ? RemoteConfigStore.from(workingCopy).allEntriesWithOrigin() ?? [] : [];
40639
41291
  for (const { key, text, file, line } of entries) {
40640
- const missing = () => new InvalidConfigError(key, `error: missing value for '${key}'\n${where(key, file, line)}`);
41292
+ const missing = () => new InvalidConfigError(key, `error: missing value for '${key}'\n${badConfigVariableLine(key, file, line)}`);
40641
41293
  if (key === "color.ui") {
40642
- if (uiConfig) ui = colorBool(key, text);
41294
+ if (uiConfig) ui = readColorBool(key, text);
40643
41295
  } else if (key === "diff.color" || key === "color.diff") {
40644
- if (uiConfig) diff = colorBool(key, text);
41296
+ if (uiConfig) diff = readColorBool(key, text);
40645
41297
  } else if (key === "diff.colormoved") {
40646
41298
  if (!uiConfig) continue;
40647
41299
  const mode = parseColorMoved(text);
40648
- if (mode === void 0) throw new InvalidConfigError(key, `${COLOR_MOVED_MODE_ERROR}\n${where(key, file, line)}`);
41300
+ if (mode === void 0) throw new InvalidConfigError(key, `${COLOR_MOVED_MODE_ERROR}\n${badConfigVariableLine(key, file, line)}`);
40649
41301
  colorMoved = mode;
40650
41302
  } else if (key === "diff.colormovedws") {
40651
41303
  if (!uiConfig) continue;
40652
41304
  if (text === void 0) throw missing();
40653
41305
  const parsed = parseColorMovedWs(text);
40654
- if (parsed.errors.length > 0) throw new InvalidConfigError(key, `${parsed.errors.join("\n")}\n${where(key, file, line)}`);
41306
+ if (parsed.errors.length > 0) throw new InvalidConfigError(key, `${parsed.errors.join("\n")}\n${badConfigVariableLine(key, file, line)}`);
40655
41307
  colorMovedWs = parsed.flags;
40656
41308
  } else if (key === "diff.wserrorhighlight") {
40657
41309
  if (text === void 0) throw missing();
40658
41310
  const val = parseWsErrorHighlight(text);
40659
- if (val === void 0) throw new InvalidConfigError(key, `error: unknown value for config '${key}': ${text}\n${where(key, file, line)}`);
41311
+ if (val === void 0) throw new InvalidConfigError(key, `error: unknown value for config '${key}': ${text}\n${badConfigVariableLine(key, file, line)}`);
40660
41312
  wsErrorHighlight = val;
40661
41313
  } else if (key.startsWith("diff.color.") || key.startsWith("color.diff.")) {
40662
41314
  const slot = diffColorSlotOf(key.slice(11));
40663
41315
  if (!slot) continue;
40664
41316
  if (text === void 0) throw missing();
40665
41317
  const color = parseGitColor(text, compatibility);
40666
- if (color === void 0) throw new InvalidConfigError(key, `error: invalid color value: ${text}\n${where(key, file, line)}`);
41318
+ if (color === void 0) throw new InvalidConfigError(key, `error: invalid color value: ${text}\n${badConfigVariableLine(key, file, line)}`);
40667
41319
  colors[slot] = color;
40668
41320
  } else if (key.startsWith("color.decorate.")) {
40669
41321
  const name = key.slice(15);
@@ -40671,7 +41323,7 @@ function readDiffColorSettings(workingCopy, options, uiConfig = true) {
40671
41323
  if (!slot) continue;
40672
41324
  if (text === void 0) throw missing();
40673
41325
  const color = parseGitColor(text, compatibility);
40674
- if (color === void 0) throw new InvalidConfigError(key, `error: invalid color value: ${text}\n${where(key, file, line)}`);
41326
+ if (color === void 0) throw new InvalidConfigError(key, `error: invalid color value: ${text}\n${badConfigVariableLine(key, file, line)}`);
40675
41327
  decorationColors[slot] = color;
40676
41328
  }
40677
41329
  }
@@ -41197,6 +41849,379 @@ function formatStatusPorcelain(status, version = 1, options = {}) {
41197
41849
  return lines.map((l) => `${l}${eol}`).join("");
41198
41850
  }
41199
41851
  //#endregion
41852
+ //#region src/commands/column/column-layout.ts
41853
+ /**
41854
+ * column.c: git's column layouts (`--column[=<options>]`, `column.ui`, `column.<command>`,
41855
+ * `git column`). The options are git's `colopts` bits: a layout (`column`, `row`, `plain`),
41856
+ * whether the layout is used (`always`, `never`, `auto`), `dense`, and whether `--column`
41857
+ * came from the command line.
41858
+ *
41859
+ * @example
41860
+ * ```typescript
41861
+ * let colopts = parseColumnMode(0, "column,dense");
41862
+ * colopts = finalizeColopts(colopts); // auto never lays out: no terminal
41863
+ * printColumns(["a", "b", "c"], colopts, { width: 19 });
41864
+ * // "a b c\n"
41865
+ * ```
41866
+ *
41867
+ * @module
41868
+ */
41869
+ /** The layout bits (`COL_LAYOUT_MASK`) */
41870
+ const COL_LAYOUT_MASK = 15;
41871
+ /** always, never or auto (`COL_ENABLE_MASK`) */
41872
+ const COL_ENABLE_MASK = 48;
41873
+ /** `--column` was given on the command line (`COL_PARSEOPT`) */
41874
+ const COL_PARSEOPT = 64;
41875
+ /** Shrink columns when possible, making space for more columns (`COL_DENSE`) */
41876
+ const COL_DENSE = 128;
41877
+ /** `never` */
41878
+ const COL_DISABLED = 0;
41879
+ /** `always` */
41880
+ const COL_ENABLED = 16;
41881
+ /** `auto` */
41882
+ const COL_AUTO = 32;
41883
+ /** Fill columns before rows */
41884
+ const COL_COLUMN = 0;
41885
+ /** Fill rows before columns */
41886
+ const COL_ROW = 1;
41887
+ /** One item per line */
41888
+ const COL_PLAIN = 15;
41889
+ /**
41890
+ * A column option git refuses (`error: unsupported option '<word>'` from `--column=<word>`,
41891
+ * exit 129) or a combination it dies on (`fatal: options '--column' and '--verbose' cannot be
41892
+ * used together`, exit 128). `message` holds git's stderr lines.
41893
+ */
41894
+ var ColumnOptionError = class extends GitApiError {
41895
+ exitCode;
41896
+ constructor(message, exitCode) {
41897
+ super(message);
41898
+ this.exitCode = exitCode;
41899
+ this.name = "ColumnOptionError";
41900
+ }
41901
+ };
41902
+ /** A word of a column mode git does not know (`parse_option`'s error). */
41903
+ var UnsupportedColumnOption = class extends Error {};
41904
+ const LAYOUT_SET = 1;
41905
+ const ENABLE_SET = 2;
41906
+ const OPTIONS = [
41907
+ {
41908
+ name: "always",
41909
+ value: 16,
41910
+ mask: 48
41911
+ },
41912
+ {
41913
+ name: "never",
41914
+ value: 0,
41915
+ mask: 48
41916
+ },
41917
+ {
41918
+ name: "auto",
41919
+ value: 32,
41920
+ mask: 48
41921
+ },
41922
+ {
41923
+ name: "plain",
41924
+ value: 15,
41925
+ mask: 15
41926
+ },
41927
+ {
41928
+ name: "column",
41929
+ value: 0,
41930
+ mask: 15
41931
+ },
41932
+ {
41933
+ name: "row",
41934
+ value: 1,
41935
+ mask: 15
41936
+ },
41937
+ {
41938
+ name: "dense",
41939
+ value: 128,
41940
+ mask: 0
41941
+ }
41942
+ ];
41943
+ /** parse_config: the words of `value` (separated by spaces and commas) applied to `colopts`. */
41944
+ function parseConfig(colopts, value) {
41945
+ let group = 0;
41946
+ let out = colopts;
41947
+ for (const word of value.split(/[ ,]+/)) {
41948
+ if (word === "") continue;
41949
+ let found = false;
41950
+ for (const opt of OPTIONS) {
41951
+ let name = word;
41952
+ let set = true;
41953
+ if (!opt.mask && name.length > 2 && name.startsWith("no")) {
41954
+ name = name.slice(2);
41955
+ set = false;
41956
+ }
41957
+ if (name !== opt.name) continue;
41958
+ if (opt.mask === 48) group |= ENABLE_SET;
41959
+ else if (opt.mask === 15) group |= LAYOUT_SET;
41960
+ if (opt.mask) out = out & ~opt.mask | opt.value;
41961
+ else out = set ? out | opt.value : out & ~opt.value;
41962
+ found = true;
41963
+ break;
41964
+ }
41965
+ if (!found) throw new UnsupportedColumnOption(word);
41966
+ }
41967
+ if (group & LAYOUT_SET && !(group & ENABLE_SET)) out = out & -49 | 16;
41968
+ return out;
41969
+ }
41970
+ /**
41971
+ * The words of a column mode (`column.ui`'s value, `--column=<options>`) applied to
41972
+ * `colopts`, as column.c's `parse_config`.
41973
+ *
41974
+ * @throws ColumnOptionError for a word git does not know (`error: unsupported option 'x'`,
41975
+ * exit 129 as parse-options gives it)
41976
+ */
41977
+ function parseColumnMode(colopts, value) {
41978
+ try {
41979
+ return parseConfig(colopts, value);
41980
+ } catch (error) {
41981
+ if (!(error instanceof UnsupportedColumnOption)) throw error;
41982
+ throw new ColumnOptionError(`error: unsupported option '${error.message}'`, 129);
41983
+ }
41984
+ }
41985
+ /**
41986
+ * parseopt_column_callback: `--column` (`true`), `--column=<options>` (a string) or
41987
+ * `--no-column` (`false`) applied to `colopts`. `--column` alone is `always`; the layout
41988
+ * read from the configuration stays.
41989
+ *
41990
+ * @throws ColumnOptionError for an option word git does not know (exit 129)
41991
+ */
41992
+ function applyColumnOption(colopts, option) {
41993
+ let out = (colopts | 64) & -49;
41994
+ if (option === false) return out;
41995
+ out |= 16;
41996
+ return typeof option === "string" ? parseColumnMode(out, option) : out;
41997
+ }
41998
+ /**
41999
+ * git_column_config over the configuration in its order: `column.ui` and
42000
+ * `column.<command>` applied to `colopts` (0 to start).
42001
+ *
42002
+ * @returns The options, or git's death on a bad value (`error: unsupported option 'x'`,
42003
+ * `error: invalid column.ui mode x`, then `fatal: bad config variable ...`; exit 128)
42004
+ */
42005
+ function readColumnConfig(entries, command, colopts = 0) {
42006
+ let out = colopts;
42007
+ for (const { key, value, file, line } of entries) {
42008
+ if (!key.startsWith("column.")) continue;
42009
+ const it = key.slice(7);
42010
+ if (it !== "ui" && (command === void 0 || it !== command)) continue;
42011
+ const fatal = file !== void 0 && line !== void 0 ? `fatal: bad config variable '${key}' in file '${file}' at line ${line}` : `fatal: unable to parse '${key}' from command-line config`;
42012
+ if (value === void 0) return {
42013
+ key,
42014
+ message: `error: missing value for '${key}'\n${fatal}`
42015
+ };
42016
+ try {
42017
+ out = parseConfig(out, value);
42018
+ } catch (error) {
42019
+ if (!(error instanceof UnsupportedColumnOption)) throw error;
42020
+ return {
42021
+ key,
42022
+ message: `error: unsupported option '${error.message}'\nerror: invalid column.${it} mode ${value}\n${fatal}`
42023
+ };
42024
+ }
42025
+ }
42026
+ return { colopts: out };
42027
+ }
42028
+ /** finalize_colopts: `auto` lays out only on a terminal (or a pager). */
42029
+ function finalizeColopts(colopts, terminal = false) {
42030
+ if ((colopts & 48) !== 32) return colopts;
42031
+ return colopts & -49 | (terminal ? 16 : 0);
42032
+ }
42033
+ /** column_active: the layout is used. */
42034
+ function columnActive(colopts) {
42035
+ return (colopts & 48) === 16;
42036
+ }
42037
+ /** explicitly_enable_column: `--column` given on the command line and active. */
42038
+ function explicitlyEnableColumn(colopts) {
42039
+ return (colopts & 64) !== 0 && columnActive(colopts);
42040
+ }
42041
+ /**
42042
+ * term_columns: `$COLUMNS` read as `atoi` when positive, else 80 (no terminal is asked).
42043
+ *
42044
+ * @param columns `$COLUMNS` as the environment gives it
42045
+ */
42046
+ function termColumns(columns) {
42047
+ if (columns === void 0) return 80;
42048
+ const n = Number.parseInt(columns.trimStart(), 10);
42049
+ return Number.isFinite(n) && n > 0 && n <= 2147483647 ? n : 80;
42050
+ }
42051
+ /** The byte length of a string as git holds it (`strlen`). */
42052
+ const byteLength = (s) => encodeGitPath(s).length;
42053
+ /** display_mode_esc_sequence_len: `ESC [ <digits and ;> m`, else 0. */
42054
+ function escapeLength(text, at) {
42055
+ if (text.charCodeAt(at) !== 27 || text[at + 1] !== "[") return 0;
42056
+ let i = at + 2;
42057
+ while (i < text.length && /[0-9;]/.test(text[i])) i++;
42058
+ return text[i] === "m" ? i + 1 - at : 0;
42059
+ }
42060
+ /**
42061
+ * item_length: utf8_strnwidth with ANSI escapes skipped (wide characters 2, combining ones
42062
+ * 0, control characters none); a string that is no UTF-8 (bytes kept as `decodeGitPath`'s
42063
+ * U+DC80..U+DCFF) counts its bytes.
42064
+ */
42065
+ function columnItemWidth(text) {
42066
+ let width = 0;
42067
+ for (let i = 0; i < text.length;) {
42068
+ const esc = escapeLength(text, i);
42069
+ if (esc) {
42070
+ i += esc;
42071
+ continue;
42072
+ }
42073
+ const cp = text.codePointAt(i);
42074
+ if (cp >= 55296 && cp <= 57343) return byteLength(text);
42075
+ const w = gitCharWidth(cp);
42076
+ if (w > 0) width += w;
42077
+ i += cp > 65535 ? 2 : 1;
42078
+ }
42079
+ return width;
42080
+ }
42081
+ /**
42082
+ * `(size_t)a / (size_t)b` stored in an `int`, as column.c computes its columns and rows
42083
+ * (`width - strlen(indent)` and `DIV_ROUND_UP(list->nr, cols)` are unsigned: a negative
42084
+ * width wraps around).
42085
+ */
42086
+ function udiv(a, b) {
42087
+ const d = BigInt.asUintN(64, BigInt(b));
42088
+ if (d === 0n) return 0;
42089
+ return Number(BigInt.asIntN(32, BigInt.asUintN(64, BigInt(a)) / d));
42090
+ }
42091
+ /** `(int)x`: C's wrap of int arithmetic. */
42092
+ const int32 = (x) => Number(BigInt.asIntN(32, BigInt(x)));
42093
+ /**
42094
+ * print_columns: `list` laid out as `colopts` says (inactive or `plain`: one item per line;
42095
+ * `column`/`row`: a table filled down or across, `dense` shrinking the columns), as the
42096
+ * text git prints. `colopts` must be finalized (no `auto`).
42097
+ *
42098
+ * @throws ColumnOptionError where git dies (a dense layout of a negative width wrapping to a
42099
+ * negative column count: `fatal: size_t overflow`)
42100
+ */
42101
+ function printColumns(list, colopts, options = {}) {
42102
+ if (list.length === 0) return "";
42103
+ const indent = options.indent ?? "";
42104
+ const nl = options.nl ?? "\n";
42105
+ const padding = options.padding ?? 1;
42106
+ const width = options.width ? options.width : (options.termColumns ?? 80) - 1;
42107
+ if (!columnActive(colopts)) return list.map((s) => `${s}\n`).join("");
42108
+ const layout = colopts & 15;
42109
+ if (layout === 15) return list.map((s) => `${indent}${s}${nl}`).join("");
42110
+ if (layout !== 0 && layout !== 1) throw new Error(`BUG: invalid layout mode ${layout}`);
42111
+ return displayTable(list, layout === 0, (colopts & 128) !== 0, {
42112
+ indent,
42113
+ nl,
42114
+ padding,
42115
+ width
42116
+ });
42117
+ }
42118
+ /** display_table: COL_COLUMN or COL_ROW. */
42119
+ function displayTable(list, column, dense, opts) {
42120
+ const nr = list.length;
42121
+ const len = list.map(columnItemWidth);
42122
+ const indentLength = byteLength(opts.indent);
42123
+ const lenAt = (i) => len[i];
42124
+ let rows = 0;
42125
+ let cols = 0;
42126
+ const linear = (x, y) => int32(column ? Math.imul(x, rows) + y : Math.imul(y, cols) + x);
42127
+ const past = (i) => i < 0 || i >= nr;
42128
+ let initialWidth = 0;
42129
+ for (const l of len) if (initialWidth < l) initialWidth = l;
42130
+ initialWidth += opts.padding;
42131
+ cols = udiv(opts.width - indentLength, initialWidth);
42132
+ if (cols === 0) cols = 1;
42133
+ rows = udiv(nr + cols - 1, cols);
42134
+ const computeColumnWidth = () => {
42135
+ const w = [];
42136
+ const shown = Math.min(cols, nr);
42137
+ for (let x = 0; x < shown; x++) {
42138
+ let widest = linear(x, 0);
42139
+ for (let y = 0; y < rows; y++) {
42140
+ const i = linear(x, y);
42141
+ if (!past(i) && lenAt(widest) < lenAt(i)) widest = i;
42142
+ }
42143
+ w[x] = widest;
42144
+ }
42145
+ return w;
42146
+ };
42147
+ let widths;
42148
+ if (dense) {
42149
+ if (cols < 0) throw new ColumnOptionError(`fatal: size_t overflow: 4 * ${BigInt.asUintN(64, BigInt(cols))}`, 128);
42150
+ while (rows > 1) {
42151
+ const oldRows = rows;
42152
+ const oldCols = cols;
42153
+ rows--;
42154
+ cols = udiv(nr + rows - 1, rows);
42155
+ const w = computeColumnWidth();
42156
+ let total = indentLength;
42157
+ for (let x = 0; x < cols; x++) total += lenAt(w[x]) + opts.padding;
42158
+ if (total > opts.width) {
42159
+ rows = oldRows;
42160
+ cols = oldCols;
42161
+ break;
42162
+ }
42163
+ }
42164
+ widths = computeColumnWidth();
42165
+ }
42166
+ let out = "";
42167
+ for (let y = 0; y < rows; y++) for (let x = 0; x < cols; x++) {
42168
+ const i = linear(x, y);
42169
+ if (past(i)) break;
42170
+ let l = lenAt(i);
42171
+ if (widths) {
42172
+ const widest = lenAt(widths[x]);
42173
+ if (widest < initialWidth) {
42174
+ l += initialWidth - widest;
42175
+ l -= opts.padding;
42176
+ }
42177
+ }
42178
+ const newline = column ? past(int32(i + rows)) : x === cols - 1 || i === nr - 1;
42179
+ out += x === 0 ? opts.indent : "";
42180
+ out += list[i];
42181
+ out += newline ? opts.nl : " ".repeat(Math.max(0, initialWidth - Math.max(0, l)));
42182
+ }
42183
+ return out;
42184
+ }
42185
+ //#endregion
42186
+ //#region src/commands/column/column-config.ts
42187
+ /**
42188
+ * `colopts` from `column.ui` and `column.<command>` (none: `column.ui` alone).
42189
+ *
42190
+ * @throws InvalidConfigError with git's lines for a value git refuses (exit 128)
42191
+ */
42192
+ function columnConfigOf(workingCopy, command) {
42193
+ if (!workingCopy.config) return 0;
42194
+ const config = RemoteConfigStore.from(workingCopy);
42195
+ const keys = command === void 0 ? ["column.ui"] : ["column.ui", `column.${command}`];
42196
+ const read = readColumnConfig((config.entriesWithOriginFor(keys) ?? keys.flatMap((key) => config.valuesWithOrigin(key).map((where) => ({
42197
+ key,
42198
+ ...where
42199
+ })))).map(({ key, text, file, line }) => ({
42200
+ key: key.toLowerCase(),
42201
+ value: text,
42202
+ ...file !== void 0 ? { file } : {},
42203
+ ...line !== void 0 ? { line } : {}
42204
+ })), command);
42205
+ if ("message" in read) throw new InvalidConfigError(read.key, read.message);
42206
+ return read.colopts;
42207
+ }
42208
+ /**
42209
+ * A listing's finalized `colopts`: the configuration's, then `option` (`--column`,
42210
+ * `--column=<options>`, `--no-column`), `auto` off (no terminal).
42211
+ *
42212
+ * @throws InvalidConfigError for a bad configured value, ColumnOptionError for a bad option
42213
+ */
42214
+ function columnSettingsOf(workingCopy, command, option) {
42215
+ let colopts = columnConfigOf(workingCopy, command);
42216
+ if (option !== void 0) colopts = applyColumnOption(colopts, option);
42217
+ return finalizeColopts(colopts);
42218
+ }
42219
+ /** term_columns: the explicit width, else the host's `$COLUMNS`, else 80. */
42220
+ function terminalColumnsOf(workingCopy, explicit) {
42221
+ if (explicit !== void 0 && explicit > 0) return explicit;
42222
+ return termColumns(hostEnvironmentOf(workingCopy)?.columns);
42223
+ }
42224
+ //#endregion
41200
42225
  //#region src/commands/status-format.ts
41201
42226
  /**
41202
42227
  * The text forms of `git status` (wt-status.c's `wt_status_print`): the long format with its
@@ -41210,6 +42235,40 @@ function formatStatusPorcelain(status, version = 1, options = {}) {
41210
42235
  * // "On branch main\nChanges to be committed:\n (use \"git restore --staged <file>...\" ..."
41211
42236
  * ```
41212
42237
  */
42238
+ /** wt-status.c's `default_wt_status_colors`. */
42239
+ const DEFAULT_STATUS_COLORS = Object.freeze({
42240
+ header: "",
42241
+ updated: "\x1B[32m",
42242
+ changed: "\x1B[31m",
42243
+ untracked: "\x1B[31m",
42244
+ noBranch: "\x1B[31m",
42245
+ unmerged: "\x1B[31m",
42246
+ localBranch: "\x1B[32m",
42247
+ remoteBranch: "\x1B[31m"
42248
+ });
42249
+ const COLOR_RESET = "\x1B[m";
42250
+ /** color.c's `color_print_strbuf`: the text between the color and a reset, if any color. */
42251
+ function paint(color, text) {
42252
+ return color ? `${color}${text}${COLOR_RESET}` : text;
42253
+ }
42254
+ /** The colors of the human formats, all "" without a palette (`want_color` false). */
42255
+ function slotsOf(colors) {
42256
+ if (!colors) return {
42257
+ header: "",
42258
+ updated: "",
42259
+ changed: "",
42260
+ untracked: "",
42261
+ noBranch: "",
42262
+ unmerged: "",
42263
+ localBranch: "",
42264
+ remoteBranch: "",
42265
+ branch: ""
42266
+ };
42267
+ return {
42268
+ ...colors,
42269
+ branch: colors.branch ?? colors.header
42270
+ };
42271
+ }
41213
42272
  /** `s->committable` and `s->workdir_dirty` of a status (wt_status_collect). */
41214
42273
  function statusCommitInfo(status, header) {
41215
42274
  let committable = false;
@@ -41309,15 +42368,16 @@ function shortStatus(status, header, options) {
41309
42368
  const z = options.z === true;
41310
42369
  const fully = options.quotePath ?? true;
41311
42370
  const short = options.format === "short";
42371
+ const c = slotsOf(short ? options.colors : void 0);
41312
42372
  const eol = z ? "\0" : "\n";
41313
42373
  let out = "";
41314
- if (options.branch) out += shortTracking(header, options) + eol;
42374
+ if (options.branch) out += shortTracking(header, options, c) + eol;
41315
42375
  const { change, untracked, ignored } = lists(status);
41316
42376
  const q = (p) => z ? p : quotePath(p, true, fully);
41317
42377
  for (const e of change) {
41318
42378
  const mask = stagemask(e);
41319
42379
  if (mask) {
41320
- out += `${UNMERGED_KEYS[mask]} ${q(e.path)}${eol}`;
42380
+ out += `${paint(c.unmerged, UNMERGED_KEYS[mask])} ${q(e.path)}${eol}`;
41321
42381
  continue;
41322
42382
  }
41323
42383
  let y = e.worktree;
@@ -41326,7 +42386,8 @@ function shortStatus(status, header, options) {
41326
42386
  else if (e.submoduleModified) y = "m";
41327
42387
  else if (e.submoduleUntracked) y = "?";
41328
42388
  }
41329
- const x = e.index;
42389
+ const x = e.index === " " ? " " : paint(c.updated, e.index);
42390
+ if (y !== " ") y = paint(c.changed, y);
41330
42391
  if (z) {
41331
42392
  out += `${x}${y} ${e.path}\0`;
41332
42393
  if (e.renamedFrom !== void 0) out += `${e.renamedFrom}\0`;
@@ -41335,30 +42396,32 @@ function shortStatus(status, header, options) {
41335
42396
  out += `${x}${y} ${from}${q(e.path)}\n`;
41336
42397
  }
41337
42398
  }
41338
- for (const p of untracked) out += `?? ${q(p)}${eol}`;
41339
- for (const p of ignored) out += `!! ${q(p)}${eol}`;
42399
+ const sign = (s) => z && options.compatibility === "2.43" ? s : paint(c.untracked, s);
42400
+ for (const p of untracked) out += `${sign("??")} ${q(p)}${eol}`;
42401
+ for (const p of ignored) out += `${sign("!!")} ${q(p)}${eol}`;
41340
42402
  return out;
41341
42403
  }
41342
42404
  const isSubmodule = (e) => submoduleToken(e)[0] === "S";
41343
42405
  /** wt_shortstatus_print_tracking: `## branch...upstream [ahead N, behind M]` (no eol). */
41344
- function shortTracking(header, options) {
41345
- let out = "## ";
42406
+ function shortTracking(header, options, c) {
42407
+ const h = (text) => paint(c.header, text);
42408
+ let out = h("## ");
41346
42409
  if (!header.branch) return out;
41347
- if (header.isInitial) out += "No commits yet on ";
41348
- if (header.branch === "HEAD") return `${out}HEAD (no branch)`;
41349
- out += header.branch.replace(/^refs\/heads\//, "");
42410
+ if (header.isInitial) out += h("No commits yet on ");
42411
+ if (header.branch === "HEAD") return out + paint(c.noBranch, "HEAD (no branch)");
42412
+ out += paint(c.localBranch, header.branch.replace(/^refs\/heads\//, ""));
41350
42413
  const t = header.tracking;
41351
42414
  if (!t || t.result < 0 && !t.base) return out;
41352
42415
  const gone = t.result < 0;
41353
- out += `...${t.short ?? t.base}`;
42416
+ out += h("...") + paint(c.remoteBranch, t.short ?? t.base);
41354
42417
  if (!gone && t.result === 0) return out;
41355
- out += " [";
41356
- if (gone) out += "gone";
41357
- else if (options.aheadBehindQuick) out += "different";
41358
- else if (!t.ahead) out += `behind ${t.behind}`;
41359
- else if (!t.behind) out += `ahead ${t.ahead}`;
41360
- else out += `ahead ${t.ahead}, behind ${t.behind}`;
41361
- return `${out}]`;
42418
+ out += h(" [");
42419
+ if (gone) out += h("gone");
42420
+ else if (options.aheadBehindQuick) out += h("different");
42421
+ else if (!t.ahead) out += h("behind ") + paint(c.remoteBranch, `${t.behind}`);
42422
+ else if (!t.behind) out += h("ahead ") + paint(c.localBranch, `${t.ahead}`);
42423
+ else out += h("ahead ") + paint(c.localBranch, `${t.ahead}`) + h(", behind ") + paint(c.remoteBranch, `${t.behind}`);
42424
+ return out + h("]");
41362
42425
  }
41363
42426
  /** wt_porcelain_v2_print. */
41364
42427
  function porcelainV2(status, header, options) {
@@ -41413,16 +42476,25 @@ function commentedLines(text, prefix) {
41413
42476
  */
41414
42477
  var StatusPrinter = class {
41415
42478
  prefix;
42479
+ color;
41416
42480
  out = "";
41417
- constructor(prefix) {
42481
+ /**
42482
+ * @param prefix the comment-line string, undefined: lines are not commented
42483
+ * @param color the color of lines printed without one of their own (git's callers pass
42484
+ * the header's), "" for none
42485
+ */
42486
+ constructor(prefix, color = "") {
41418
42487
  this.prefix = prefix;
42488
+ this.color = color;
41419
42489
  }
41420
- vprintf(atBol, text, trail) {
42490
+ vprintf(atBol, text, trail, color = this.color) {
41421
42491
  if (text === "") {
42492
+ let sb = "";
41422
42493
  if (this.prefix !== void 0) {
41423
- this.out += this.prefix;
41424
- if (trail === void 0) this.out += " ";
42494
+ sb += this.prefix;
42495
+ if (trail === void 0) sb += " ";
41425
42496
  }
42497
+ this.out += paint(color, sb);
41426
42498
  if (trail !== void 0) this.out += trail;
41427
42499
  return;
41428
42500
  }
@@ -41436,7 +42508,7 @@ var StatusPrinter = class {
41436
42508
  if (text[line] !== "\n" && text[line] !== " ") buf += " ";
41437
42509
  }
41438
42510
  buf += eol >= 0 ? text.slice(line, eol) : text.slice(line);
41439
- this.out += buf;
42511
+ this.out += paint(color, buf);
41440
42512
  if (eol < 0) break;
41441
42513
  this.out += "\n";
41442
42514
  line = eol + 1;
@@ -41444,14 +42516,17 @@ var StatusPrinter = class {
41444
42516
  }
41445
42517
  if (trail !== void 0) this.out += trail;
41446
42518
  }
41447
- ln(text) {
41448
- this.vprintf(true, text, "\n");
42519
+ /** status_printf_ln (in `color`, else the printer's) */
42520
+ ln(text, color) {
42521
+ this.vprintf(true, text, "\n", color);
41449
42522
  }
41450
- printf(text) {
41451
- this.vprintf(true, text, void 0);
42523
+ /** status_printf */
42524
+ printf(text, color) {
42525
+ this.vprintf(true, text, void 0, color);
41452
42526
  }
41453
- more(text) {
41454
- this.vprintf(false, text, void 0);
42527
+ /** status_printf_more */
42528
+ more(text, color) {
42529
+ this.vprintf(false, text, void 0, color);
41455
42530
  }
41456
42531
  raw(text) {
41457
42532
  this.out += text;
@@ -41459,7 +42534,15 @@ var StatusPrinter = class {
41459
42534
  };
41460
42535
  /** wt_longstatus_print. */
41461
42536
  function longStatus(status, header, options, info) {
41462
- const p = new StatusPrinter(options.commentPrefix);
42537
+ const c = slotsOf(options.colors);
42538
+ const p = new StatusPrinter(options.commentPrefix, c.header);
42539
+ const columns = options.colopts !== void 0 ? {
42540
+ colopts: options.colopts,
42541
+ termColumns: options.termColumns ?? 80,
42542
+ header: c.header,
42543
+ comment: options.commentPrefix !== void 0,
42544
+ colored: options.colors !== void 0
42545
+ } : void 0;
41463
42546
  const hints = options.hints ?? true;
41464
42547
  const fully = options.quotePath ?? true;
41465
42548
  const q = (path) => quotePath(path, false, fully);
@@ -41472,7 +42555,9 @@ function longStatus(status, header, options, info) {
41472
42555
  if (header.branch) {
41473
42556
  let onWhat = "On branch ";
41474
42557
  let branchName = header.branch;
42558
+ let branchStatusColor = c.header;
41475
42559
  if (branchName === "HEAD") {
42560
+ branchStatusColor = c.noBranch;
41476
42561
  if (state.rebaseInProgress || state.rebaseInteractiveInProgress) {
41477
42562
  onWhat = state.rebaseInteractiveInProgress ? "interactive rebase in progress; onto " : "rebase in progress; onto ";
41478
42563
  branchName = state.onto ?? "";
@@ -41485,11 +42570,14 @@ function longStatus(status, header, options, info) {
41485
42570
  }
41486
42571
  } else branchName = branchName.replace(/^refs\/heads\//, "");
41487
42572
  p.printf("");
41488
- p.more(onWhat);
41489
- p.more(`${branchName}\n`);
42573
+ p.more(onWhat, branchStatusColor);
42574
+ p.more(`${branchName}\n`, c.branch);
41490
42575
  if (!header.isInitial && header.trackingText) {
41491
- for (const line of header.trackingText.split("\n").slice(0, -1)) p.raw(`${options.commentPrefix !== void 0 ? `${options.commentPrefix} ` : ""}${line}\n`);
41492
- p.raw(options.commentPrefix !== void 0 ? `${options.commentPrefix}\n` : "\n");
42576
+ for (const line of header.trackingText.split("\n").slice(0, -1)) {
42577
+ const text = `${options.commentPrefix !== void 0 ? `${options.commentPrefix} ` : ""}${line}`;
42578
+ p.raw(`${paint(c.header, text)}\n`);
42579
+ }
42580
+ p.raw(options.commentPrefix !== void 0 ? `${paint(c.header, options.commentPrefix)}\n` : "\n");
41493
42581
  }
41494
42582
  }
41495
42583
  if (state.mergeInProgress) {
@@ -41570,7 +42658,7 @@ function longStatus(status, header, options, info) {
41570
42658
  if (updated.length > 0) {
41571
42659
  p.ln("Changes to be committed:");
41572
42660
  if (hints) unstageHint();
41573
- for (const e of updated) changeLine(p, e, "updated", q);
42661
+ for (const e of updated) changeLine(p, e, "updated", q, c.updated);
41574
42662
  trailer();
41575
42663
  }
41576
42664
  const unmerged = change.filter((e) => e.stages);
@@ -41595,7 +42683,7 @@ function longStatus(status, header, options, info) {
41595
42683
  for (const e of unmerged) {
41596
42684
  const how = UNMERGED_LABELS[stagemask(e)];
41597
42685
  p.printf(" ");
41598
- p.more(`${how}${" ".repeat(UNMERGED_LABEL_WIDTH - how.length)}${q(e.path)}\n`);
42686
+ p.more(`${how}${" ".repeat(UNMERGED_LABEL_WIDTH - how.length)}${q(e.path)}\n`, c.unmerged);
41599
42687
  }
41600
42688
  trailer();
41601
42689
  }
@@ -41609,7 +42697,7 @@ function longStatus(status, header, options, info) {
41609
42697
  p.ln(" (use \"git restore <file>...\" to discard changes in working directory)");
41610
42698
  if (dirtySubmodules) p.ln(" (commit or discard the untracked or modified content in submodules)");
41611
42699
  }
41612
- for (const e of changed) changeLine(p, e, "changed", q);
42700
+ for (const e of changed) changeLine(p, e, "changed", q, c.changed);
41613
42701
  trailer();
41614
42702
  }
41615
42703
  if (options.submoduleSummary) {
@@ -41622,12 +42710,12 @@ function longStatus(status, header, options, info) {
41622
42710
  }
41623
42711
  const untrackedMode = options.untracked ?? "normal";
41624
42712
  if (untrackedMode !== "no") {
41625
- otherSection(p, untracked, "Untracked files", "add", hints, q);
41626
- if ((options.ignored ?? "no") !== "no") otherSection(p, ignored, "Ignored files", "add -f", hints, q);
41627
- } else if (info.committable) p.ln(`Untracked files not listed${hints ? " (use -u option to show untracked files)" : ""}`);
42713
+ otherSection(p, untracked, "Untracked files", "add", hints, q, c.untracked, columns);
42714
+ if ((options.ignored ?? "no") !== "no") otherSection(p, ignored, "Ignored files", "add -f", hints, q, c.untracked, columns);
42715
+ } else if (info.committable) p.ln(`Untracked files not listed${hints ? " (use -u option to show untracked files)" : ""}`, "");
41628
42716
  if (options.verbose !== void 0) p.raw(options.verbose);
41629
42717
  if (!info.committable) {
41630
- if (options.amend) p.ln("No changes");
42718
+ if (options.amend) p.ln("No changes", "");
41631
42719
  else if (options.nowarn) {} else if (info.workdirDirty) p.raw(hints ? "no changes added to commit (use \"git add\" and/or \"git commit -a\")\n" : "no changes added to commit\n");
41632
42720
  else if (untracked.length > 0) p.raw(hints ? "nothing added to commit but untracked files present (use \"git add\" to track)\n" : "nothing added to commit but untracked files present\n");
41633
42721
  else if (header.isInitial) p.raw(hints ? "nothing to commit (create/copy files and use \"git add\" to track)\n" : "nothing to commit\n");
@@ -41636,12 +42724,12 @@ function longStatus(status, header, options, info) {
41636
42724
  }
41637
42725
  if (options.showStash && (header.stashCount ?? 0) > 0) {
41638
42726
  const n = header.stashCount;
41639
- p.ln(`Your stash currently has ${n} ${n === 1 ? "entry" : "entries"}`);
42727
+ p.ln(`Your stash currently has ${n} ${n === 1 ? "entry" : "entries"}`, "");
41640
42728
  }
41641
42729
  return p.out;
41642
42730
  }
41643
42731
  /** wt_longstatus_print_change_data. */
41644
- function changeLine(p, e, kind, q) {
42732
+ function changeLine(p, e, kind, q, color) {
41645
42733
  const status = kind === "updated" ? e.index : e.worktree;
41646
42734
  let extra = "";
41647
42735
  if (kind === "changed" && isSubmodule(e)) {
@@ -41655,20 +42743,30 @@ function changeLine(p, e, kind, q) {
41655
42743
  const pad = " ".repeat(DIFF_LABEL_WIDTH - what.length);
41656
42744
  const renamed = e.renamedFrom !== void 0 && (status === "R" || status === "C");
41657
42745
  p.printf(" ");
41658
- p.more(renamed ? `${what}${pad}${q(e.renamedFrom)} -> ${q(e.path)}` : `${what}${pad}${q(e.path)}`);
42746
+ p.more(renamed ? `${what}${pad}${q(e.renamedFrom)} -> ${q(e.path)}` : `${what}${pad}${q(e.path)}`, color);
41659
42747
  if (extra) p.more(extra);
41660
- p.more("\n");
42748
+ p.more("\n", "");
41661
42749
  }
41662
- /** wt_longstatus_print_other (no columns). */
41663
- function otherSection(p, paths, what, how, hints, q) {
42750
+ /**
42751
+ * wt_longstatus_print_other: the paths one per line, or laid out by `column.status`
42752
+ * (`columns`: the finalized `colopts` and the terminal's width) after `<header>[#]\t<color>`,
42753
+ * each line ending in a reset when colored.
42754
+ */
42755
+ function otherSection(p, paths, what, how, hints, q, color, columns) {
41664
42756
  if (paths.length === 0) return;
41665
42757
  p.ln(`${what}:`);
41666
42758
  if (hints) p.ln(` (use "git ${how} <file>..." to include in what will be committed)`);
41667
- for (const path of paths) {
42759
+ if (columns && columnActive(columns.colopts)) p.raw(printColumns(paths.map(q), columns.colopts, {
42760
+ padding: 1,
42761
+ indent: `${columns.header}${columns.comment ? "#" : ""}\t${color}`,
42762
+ ...columns.colored ? { nl: `${COLOR_RESET}\n` } : {},
42763
+ termColumns: columns.termColumns
42764
+ }));
42765
+ else for (const path of paths) {
41668
42766
  p.printf(" ");
41669
- p.more(`${q(path)}\n`);
42767
+ p.more(`${q(path)}\n`, color);
41670
42768
  }
41671
- p.ln("");
42769
+ p.ln("", "");
41672
42770
  }
41673
42771
  /** show_rebase_information: an interactive rebase's done and remaining commands. */
41674
42772
  function rebaseInformation(p, state, hints) {
@@ -41722,6 +42820,46 @@ function rebaseInProgress(p, state, hints, hasUnmerged, amend) {
41722
42820
  }
41723
42821
  }
41724
42822
  //#endregion
42823
+ //#region src/commands/status-color-config.ts
42824
+ /** builtin/commit.c's `color_status_slots` (and `added`), by lowercased name */
42825
+ const STATUS_SLOTS = {
42826
+ header: "header",
42827
+ updated: "updated",
42828
+ added: "updated",
42829
+ changed: "changed",
42830
+ untracked: "untracked",
42831
+ nobranch: "noBranch",
42832
+ unmerged: "unmerged",
42833
+ localbranch: "localBranch",
42834
+ remotebranch: "remoteBranch",
42835
+ branch: "branch"
42836
+ };
42837
+ /**
42838
+ * The palette of status's human formats, or undefined for no color.
42839
+ *
42840
+ * @throws InvalidConfigError for a value git refuses (exit 128)
42841
+ */
42842
+ function readStatusColors(workingCopy, options = {}) {
42843
+ const compatibility = options.compatibility ?? "2.56";
42844
+ const colors = { ...DEFAULT_STATUS_COLORS };
42845
+ let ui;
42846
+ let status;
42847
+ const entries = workingCopy.config ? RemoteConfigStore.from(workingCopy).allEntriesWithOrigin() ?? [] : [];
42848
+ for (const { key, text, file, line } of entries) if (key === "color.ui") ui = readColorBool(key, text);
42849
+ else if (key === "color.status" || key === "status.color") status = readColorBool(key, text);
42850
+ else if (key.startsWith("color.status.") || key.startsWith("status.color.")) {
42851
+ const slot = STATUS_SLOTS[key.slice(13).toLowerCase()];
42852
+ if (!slot) continue;
42853
+ if (text === void 0) throw new InvalidConfigError(key, `error: missing value for '${key}'\n${badConfigVariableLine(key, file, line)}`);
42854
+ const color = parseGitColor(text, compatibility);
42855
+ if (color === void 0) throw new InvalidConfigError(key, `error: invalid color value: ${text}\n${badConfigVariableLine(key, file, line)}`);
42856
+ colors[slot] = color;
42857
+ }
42858
+ let want = status ?? ui ?? "auto";
42859
+ if (options.color !== void 0) want = options.color === true ? "always" : options.color === false ? "never" : options.color;
42860
+ return want === "always" ? colors : void 0;
42861
+ }
42862
+ //#endregion
41725
42863
  //#region src/commands/tracking-info.ts
41726
42864
  /** remote.c's `stat_branch_pair` of `branchRef` against `base` (`quick`: AHEAD_BEHIND_QUICK). */
41727
42865
  async function statBranchPair(source, branchRef, base, quick) {
@@ -42777,6 +43915,17 @@ var StatusCommand = class extends GitCommand {
42777
43915
  const branch = options.branch ?? (deferred ? cfgBool(config, "status.branch", false) : false);
42778
43916
  const quick = options.aheadBehind !== void 0 ? !options.aheadBehind : deferred ? !cfgBool(config, "status.aheadBehind", true) : false;
42779
43917
  const showStash = options.showStash ?? cfgBool(config, "status.showStash", false);
43918
+ const palette = readStatusColors(this.workingCopy, {
43919
+ ...options.color !== void 0 ? { color: options.color } : {},
43920
+ ...options.colorCompatibility ? { compatibility: options.colorCompatibility } : {}
43921
+ });
43922
+ const colors = options.toFile ? void 0 : palette;
43923
+ let colopts;
43924
+ if (options.commitTemplate !== true) {
43925
+ colopts = columnConfigOf(this.workingCopy, "status");
43926
+ if (options.column !== void 0) colopts = applyColumnOption(colopts, options.column);
43927
+ colopts = finalizeColopts(colopts);
43928
+ }
42780
43929
  const status = await this.call();
42781
43930
  const hints = options.hints ?? cfgBool(config, "advice.statusHints", true);
42782
43931
  const commentPrefix = options.commentPrefix ?? (resolvedFormat === "long" && cfgBool(config, "status.displayCommentPrefix", false) ? commentLineString(this.workingCopy) : void 0);
@@ -42799,7 +43948,8 @@ var StatusCommand = class extends GitCommand {
42799
43948
  committable: info.committable,
42800
43949
  worktreeChanges: info.worktreeChanges,
42801
43950
  referenceId,
42802
- commentPrefix
43951
+ commentPrefix,
43952
+ headerColor: colors?.header ?? ""
42803
43953
  });
42804
43954
  const summaryLimit = resolvedFormat === "long" ? this.submoduleSummaryLimit() : 0;
42805
43955
  const submoduleSummary = summaryLimit !== 0 && this.ignoreSubmodules !== "all" ? await this.submoduleSummaries(summaryLimit, options.amend === true) : void 0;
@@ -42821,7 +43971,13 @@ var StatusCommand = class extends GitCommand {
42821
43971
  reference: options.amend ? "HEAD^1" : "HEAD",
42822
43972
  aheadBehindQuick: quick,
42823
43973
  ...verbose !== void 0 ? { verbose } : {},
42824
- ...submoduleSummary ? { submoduleSummary } : {}
43974
+ ...submoduleSummary ? { submoduleSummary } : {},
43975
+ ...colors ? { colors } : {},
43976
+ ...options.colorCompatibility ? { compatibility: options.colorCompatibility } : {},
43977
+ ...colopts ? {
43978
+ colopts,
43979
+ termColumns: terminalColumnsOf(this.workingCopy, options.columns)
43980
+ } : {}
42825
43981
  }),
42826
43982
  status,
42827
43983
  warnings: [...status.warnings, ...header.warnings]
@@ -42896,7 +44052,10 @@ var StatusCommand = class extends GitCommand {
42896
44052
  * ones, under their own headers); in a file (the commit template) after the cut line.
42897
44053
  */
42898
44054
  async verboseText(level, o) {
42899
- const p = (text) => o.commentPrefix !== void 0 ? `${o.commentPrefix}${text ? ` ${text}` : ""}\n` : `${text}\n`;
44055
+ const p = (text) => {
44056
+ const line = o.commentPrefix !== void 0 ? `${o.commentPrefix}${text ? ` ${text}` : ""}` : text;
44057
+ return o.headerColor ? `${o.headerColor}${line}\x1b[m\n` : `${line}\n`;
44058
+ };
42900
44059
  let out = "";
42901
44060
  if (o.toFile && !o.cutLineAdded) out += cutLine(o.commentPrefix ?? "#");
42902
44061
  const twoLevels = level > 1;
@@ -44032,6 +45191,8 @@ var DiffCommand = class DiffCommand extends GitCommand {
44032
45191
  mergeBase = false;
44033
45192
  /** Whether `--rotate-to`/`--skip-to` need their exact path (`git diff`; not `git log`) */
44034
45193
  rotateStrict = true;
45194
+ /** {@link callFormats} reports where diff.c's `diff_line_prefix` goes (`log --graph`) */
45195
+ linePrefix = false;
44035
45196
  /** git's `has_changes` of the last call */
44036
45197
  changesFound = false;
44037
45198
  /** git's `check_failed`: `--check` found an error in the last call */
@@ -44095,6 +45256,18 @@ var DiffCommand = class DiffCommand extends GitCommand {
44095
45256
  return this;
44096
45257
  }
44097
45258
  /**
45259
+ * diff.c's `diff_line_prefix` (`log --graph`'s padding): {@link callFormats} gives the
45260
+ * offsets in its output where it goes (`prefixPoints`, for `insertLinePrefix`): before
45261
+ * every line, except where git's word diff leaves it out
45262
+ *
45263
+ * @internal
45264
+ */
45265
+ setLinePrefixPoints(on) {
45266
+ this.checkCallable();
45267
+ this.linePrefix = on;
45268
+ return this;
45269
+ }
45270
+ /**
44098
45271
  * The exit status `git diff` ends with (`diff_result_code`): bit 1 when `--exit-code` or
44099
45272
  * `--quiet` is set and the last call found differences, bit 2 when its `--check` (the
44100
45273
  * `check` format) found errors.
@@ -44680,10 +45853,11 @@ var DiffCommand = class DiffCommand extends GitCommand {
44680
45853
  const headers = this.headersInPathspec();
44681
45854
  const withHeaders = this.includesConflictHeaders(headers);
44682
45855
  if (collected.entries.length === 0 && collected.combined.length === 0 && !withHeaders) return followed;
44683
- const sink = new ByteSink();
45856
+ const sink = this.linePrefix ? new LinePrefixSink() : new ByteSink();
44684
45857
  if (await this.writeFormats(sink, formats, collected, headers) === 0 && collected.combined.length === 0 && !withHeaders) return followed;
44685
45858
  return {
44686
45859
  bytes: sink.bytes(),
45860
+ ...sink instanceof LinePrefixSink ? { prefixPoints: sink.points } : {},
44687
45861
  ...followed
44688
45862
  };
44689
45863
  });
@@ -44744,6 +45918,7 @@ var DiffCommand = class DiffCommand extends GitCommand {
44744
45918
  this.resetExternal();
44745
45919
  const options = this.outputOptions();
44746
45920
  Object.assign(options, this.prefixes());
45921
+ if (sink instanceof LinePrefixSink) options.linePrefix = sink;
44747
45922
  if (this.textOptions.reverse) [options.srcPrefix, options.dstPrefix] = [options.dstPrefix ?? "b/", options.srcPrefix ?? "a/"];
44748
45923
  const pairs = [];
44749
45924
  const unmerged = /* @__PURE__ */ new Set();
@@ -46642,6 +47817,73 @@ function compareEntryNames(a, aTree, b, bTree) {
46642
47817
  return (a.length > n ? a.charCodeAt(n) : aTree ? 47 : 0) - (b.length > n ? b.charCodeAt(n) : bTree ? 47 : 0);
46643
47818
  }
46644
47819
  //#endregion
47820
+ //#region src/commands/index-refresh.ts
47821
+ /**
47822
+ * git's `refresh_index(REFRESH_QUIET)` over a staging area's entries (read-cache.c's
47823
+ * `refresh_cache_ent` for each one):
47824
+ *
47825
+ * ```ts
47826
+ * const refresh = await refreshIndexEntries(staging, worktree, { trust, fsmonitor });
47827
+ * if (refresh.unmerged.length > 0) refuse();
47828
+ * await applyIndexStatUpdates(staging, refresh.updates); // in memory, written with the index
47829
+ * ```
47830
+ *
47831
+ * An entry whose stat no longer matches its file but whose content still does takes the
47832
+ * file's current stat; a changed entry is left as it is and nothing is printed. Unmerged
47833
+ * paths are reported once each. Skip-worktree and assume-unchanged entries, the ones the
47834
+ * file system monitor holds valid, intent-to-add entries and gitlinks are never stat'ed.
47835
+ */
47836
+ /** `refresh_index(REFRESH_QUIET)`: what the refresh would store (see the module comment). */
47837
+ async function refreshIndexEntries(staging, worktree, options) {
47838
+ const { trust, fsmonitor } = options;
47839
+ const entries = [];
47840
+ for await (const entry of staging.entryList?.() ?? staging.entries()) entries.push(entry);
47841
+ const indexTime = staging.getUpdateTime();
47842
+ const stated = (entry) => entry.stage === 0 && !entry.skipWorktree && !entry.assumeValid && !entry.intentToAdd && entry.mode !== FileMode.GITLINK && !fsmonitor?.isValid(entry);
47843
+ const updates = [];
47844
+ const unmerged = [];
47845
+ for await (const { item: entry, current } of withWorktreeEntries(worktree, entries, stated)) {
47846
+ if (entry.stage !== 0) {
47847
+ if (unmerged[unmerged.length - 1] !== entry.path) unmerged.push(entry.path);
47848
+ continue;
47849
+ }
47850
+ if (!stated(entry)) continue;
47851
+ const compared = await compareWithWorktree(worktree, entry, {
47852
+ trust,
47853
+ indexTime
47854
+ }, current);
47855
+ if (compared.kind) continue;
47856
+ const update = statUpdateOf(entry, compared);
47857
+ if (update && !update.smudge) {
47858
+ if (!sameStatAsEntry(entry, update)) {
47859
+ updates.push(update);
47860
+ continue;
47861
+ }
47862
+ }
47863
+ fsmonitor?.markValid(entry);
47864
+ }
47865
+ return {
47866
+ updates,
47867
+ unmerged
47868
+ };
47869
+ }
47870
+ /** Stores the stats of a refresh in the staging area, in memory (compare-and-set per entry). */
47871
+ async function applyIndexStatUpdates(staging, updates) {
47872
+ if (updates.length === 0) return;
47873
+ const now = Date.now();
47874
+ const editor = staging.createEditor();
47875
+ for (const update of updates) editor.add({
47876
+ path: update.path,
47877
+ apply: (existing) => applyStatUpdate(existing, update, now) ?? existing
47878
+ });
47879
+ await editor.finish();
47880
+ }
47881
+ /** Whether a stat update would store exactly what the entry holds. */
47882
+ function sameStatAsEntry(entry, update) {
47883
+ const same = (a, b) => b === void 0 || a === b;
47884
+ return entry.size === update.size && entry.mtime === update.mtime && same(entry.mtimeNs, update.mtimeNs) && same(entry.ctime, update.ctime) && same(entry.ctimeNs, update.ctimeNs) && same(entry.dev, update.dev) && same(entry.ino, update.ino) && same(entry.uid, update.uid) && same(entry.gid, update.gid);
47885
+ }
47886
+ //#endregion
46645
47887
  //#region src/commands/add-patch/patch-backend.ts
46646
47888
  /**
46647
47889
  * The repository side of a patch selection: the diff add-patch.c asks git for (`diff-files
@@ -46759,41 +48001,13 @@ var IndexRefresh = class extends GitCommand {
46759
48001
  await this.readCurrentIndex(false);
46760
48002
  const staging = this.staging;
46761
48003
  const worktree = this.workingCopy.worktree;
46762
- const entries = [];
46763
- for await (const entry of staging.entryList?.() ?? staging.entries()) entries.push(entry);
46764
48004
  let out = "";
46765
48005
  let hasErrors = false;
46766
- const updates = [];
46767
48006
  if (worktree) {
46768
- const trust = worktreeModeTrust(this.workingCopy, worktree);
46769
- const indexTime = staging.getUpdateTime();
46770
- const stated = (entry) => entry.stage === 0 && !entry.skipWorktree && !entry.assumeValid && !entry.intentToAdd && entry.mode !== FileMode.GITLINK;
46771
- let lastUnmerged;
46772
- for await (const { item: entry, current } of withWorktreeEntries(worktree, entries, stated)) {
46773
- if (entry.stage !== 0) {
46774
- if (entry.path !== lastUnmerged) out += `${entry.path}: needs merge\n`;
46775
- hasErrors = true;
46776
- lastUnmerged = entry.path;
46777
- continue;
46778
- }
46779
- if (!stated(entry)) continue;
46780
- const compared = await compareWithWorktree(worktree, entry, {
46781
- trust,
46782
- indexTime
46783
- }, current);
46784
- if (compared.kind) continue;
46785
- const update = statUpdateOf(entry, compared);
46786
- if (update && !update.smudge) updates.push(update);
46787
- }
46788
- }
46789
- if (updates.length > 0) {
46790
- const now = Date.now();
46791
- const editor = staging.createEditor();
46792
- for (const update of updates) editor.add({
46793
- path: update.path,
46794
- apply: (existing) => applyStatUpdate(existing, update, now) ?? existing
46795
- });
46796
- await editor.finish();
48007
+ const refresh = await refreshIndexEntries(staging, worktree, { trust: worktreeModeTrust(this.workingCopy, worktree) });
48008
+ for (const path of refresh.unmerged) out += `${path}: needs merge\n`;
48009
+ hasErrors = refresh.unmerged.length > 0;
48010
+ await applyIndexStatUpdates(staging, refresh.updates);
46797
48011
  }
46798
48012
  try {
46799
48013
  await staging.write();
@@ -49480,7 +50694,7 @@ var AddCommand = class extends GitCommand {
49480
50694
  if (outcome === "added") output.push(`add '${displayPath}'`);
49481
50695
  return "ok";
49482
50696
  } catch (error) {
49483
- if (!(error instanceof AddToIndexError)) throw error;
50697
+ if (!(error instanceof AddToIndexError)) throw withEarlierWarnings(error, warnings);
49484
50698
  errors.push(...error.lines);
49485
50699
  failed.push(path);
49486
50700
  return "failed";
@@ -49943,7 +51157,7 @@ var AddCommand = class extends GitCommand {
49943
51157
  onWarning: (message) => warnings.push(message)
49944
51158
  });
49945
51159
  } catch (error) {
49946
- if (!(error instanceof AddToIndexError)) throw error;
51160
+ if (!(error instanceof AddToIndexError)) throw withEarlierWarnings(error, warnings);
49947
51161
  errors.push(...error.lines);
49948
51162
  failed.push(path);
49949
51163
  continue;
@@ -50068,6 +51282,15 @@ function embeddedRepoAdvice(path) {
50068
51282
  "hint: See \"git help submodule\" for more information."
50069
51283
  ];
50070
51284
  }
51285
+ /**
51286
+ * A required filter's death (`FilterDriverError`) with the lines git printed before it (the
51287
+ * conversion's warnings so far: a filter's `error:` lines and stderr); other errors as
51288
+ * they are.
51289
+ */
51290
+ function withEarlierWarnings(error, warnings) {
51291
+ if (error instanceof FilterDriverError && warnings.length > 0) error.warnings = [...warnings, ...error.warnings ?? []];
51292
+ return error;
51293
+ }
50071
51294
  //#endregion
50072
51295
  //#region src/results/blame-format.ts
50073
51296
  /**
@@ -50587,4 +51810,4 @@ let RevertStatus = /* @__PURE__ */ function(RevertStatus) {
50587
51810
  return RevertStatus;
50588
51811
  }({});
50589
51812
  //#endregion
50590
- export { submoduleToken as $, splitCmdline as $a, sparseWarningText as $c, stripspace as $i, checkBlankAtEof as $l, applyMailmapToHeader as $n, isConflictMarkerLine as $o, trailerLinesOf as $r, committerIdent as $s, SubmoduleUnpack as $t, IndexRefresh as A, createAddEntry as Aa, ReinitializeObjectStorageError as Ac, ApplyParser as Ai, gitCommitMessageHooks as Al, submoduleHeader as An, rerereGcLocation as Ao, combineNotesCatSortUniq as Ar, quoteCStyleBody as As, AUTOSTASH_SAVED_LINES as At, moveRefs as Au, parseIgnoredMode as B, SIGNING_FAILED_LINES as Ba, IndexVersionConfigError as Bc, FastForwardMode as Bi, runPostCheckoutHook as Bl, parseSignature as Bn, mergeDriversOf as Bo, amendWithTrailers as Br, DEFAULT_DIFF_COLORS as Bs, squashMessage as Bt, patchRevisionOf as C, DiffPickaxe as Ca, readMailmapBlob as Cc, LogGraph as Ci, markIndexUpdate as Cl, SubmoduleRepository as Cn, unknownRevisionMessage as Co, expandNotesRef as Cr, formatSummary as Cs, matchArgValue as Ct, resolveIdentDate as Cu, PATCH_MODES as D, DiffFormatter as Da, InvalidDefaultBranchError as Dc, ApplyCommand as Di, configuredHookEntries as Dl, readDiffSubmoduleConfig as Dn, rerereDiff as Do, readRef as Dr, utf8$1 as Ds, relativeDate as Dt, localTimezoneOffset as Du, runAddPatch as E, parseOrderFile as Ea, removeLegacyRemoteFile as Ec, readBlob as Ei, commonGitFileOf as El, parseSubmoduleDiffFormat as En, rerereClear as Eo, initNotes as Er, statSummary as Es, parseMaybeBool as Et, formatRfc2822Date as Eu, hasPickaxe as F, DEFAULT_DIRSTAT as Fa, defaultBranchHint as Fc, latin1ToText as Fi, hookSettingsCheck as Fl, checkSignature as Fn, MergeDriverCommandMissingError as Fo, LogPrinter as Fr, WORD_DIFF_MODES as Fs, removeBranchState as Ft, SubmoduleSummaryCommand as G, signCommit as Ga, cleanTrackedSparseDirectories as Gc, cleanupWith as Gi, encodePacketized as Gl, signatureFormatAt as Gn, isBinaryContent as Go, interpretTrailers as Gr, WSEH_OLD as Gs, StashWorktreeRemovalError as Gt, readShowUntrackedFiles as H, SigningFailedError as Ha, indexVersionConfigError as Hc, MergeStrategy as Hi, sequencerPrepareMessage as Hl, parseSshOutput as Hn, DEFAULT_RENAME_LIMIT as Ho, appendTrailers as Hr, MovedLineBuffer as Hs, NoStagedChangesError as Ht, renamesValue as I, formatDirstat as Ia, defaultInitialBranch as Ic, pathToLatin1 as Ii, hookSettingsFromEntries as Il, checkSignatureWith as In, MergeDriverFailedError as Io, mailFromHeader as Ir, compileWordRegex as Is, removeMergeBranchState as It, StatusPrinter as J, signTagCompat as Ja, readSparseCheckoutFile as Jc, commitMessageFromOption as Ji, coreBool as Jl, verifyCommitBytes as Jn, readGitlinkHead as Jo, parseTrailerWhere as Jr, parseColorMoved as Js, checkFlaggedEntries as Jt, readHeadDescription as K, signPayload as Ka, entryList as Kc, commentPrefixOf as Ki, queryFsmonitorDaemon as Kl, signatureLetter as Kn, IndexAdder as Ko, parseTrailerIfExists as Kr, coloredHunkHeader as Ks, WorkingCopyStashProvider as Kt, TextconvCaches as L, parseDirstatParams as La, defaultRefFormat as Lc, textToLatin1 as Li, isKnownHook as Ll, mergetagsOf as Ln, createMergeDriver as Lo, mailSubjectLine as Lr, writeWordDiffHunks as Ls, resetMerge as Lt, DiffCommand as M, createDeleteEntry as Ma, UnknownRefFormatError as Mc, cUnquote as Mi, hookHostInGitDir as Ml, parseGitmodules as Mn, rerereRemaining as Mo, combineNotesIgnore as Mr, quoteTwo as Ms, cleanupMessage as Mt, listRemoteNames as Mu, checkPickaxeOptions as N, createModifyEntry as Na, UnsupportedObjectStorageError as Nc, latin1ToBytes as Ni, hookHostOf as Nl, SignatureVerificationError as Nn, rerereStatus as No, combineNotesOverwrite as Nr, cutToLineRanges as Ns, createAutostash as Nt, patchModeFor as O, diffEntryToPair as Oa, InvalidInitialBranchError as Oc, parseWhitespaceAction as Oi, configuredHooks as Ol, readGitmodulesEntries as On, rerereEngineOf as Oo, updateNotesRef as Or, writeHeaderOnlyPatch as Os, sanitizedSubject as Ot, parseGitDate as Ou, formatDiffEntry as P, createRenameEntry as Pa, checkDefaultObjectStorage as Pc, latin1ToPath as Pi, hookRunnerOf as Pl, bytesOf as Pn, runRerere as Po, readNoteBytes as Pr, lineRangesSpan as Ps, moveHeadAsReset as Pt, formatStatusPorcelain as Q, signingKeyIdOf as Qa, sparsePathAdvice as Qc, preparedMessageCleanup as Qi, WS_DEFAULT_RULE as Ql, GrepPatternError as Qn, conflictMarkerSizeOf as Qo, trailerConfigOf as Qr, wsErrorHighlightOf as Qs, restoreWorktreeHard as Qt, StatusCommand as R, writeCombinedDiff as Ra, isValidBranchName$1 as Rc, newFilePatch as Ri, nullIdLike as Rl, parseBufferSignedByHeader as Rn, installMergeDrivers as Ro, mergesMode as Rr, COLOR_MOVED_MODE_ERROR as Rs, resetUnmergedToHead as Rt, runAddInteractive as S, decorateFullRefs as Sa, Mailmap as Sc, GRAPH_COLUMN_COLORS_ANSI as Si, worktreePathRules as Sl, NULL_OBJECT_ID as Sn, parseRevisionArgs as So, expandLooseNotesRef as Sr, formatStat as Ss, loadRefDecorations as St, resolveCommitterIdent as Su, runPatchSelection as T, orderRank as Ta, readRepositoryMailmap as Tc, ortResultEntries as Ti, LOCAL_REPO_ENV as Tl, openSubmoduleRepository as Tn, normalizeConflicts as To, initCopyNotesForRewrite as Tr, pprintRename as Ts, parseColorSpec as Tt, approxidateCareful$1 as Tu, readSubmoduleDirt as U, refuseCommitSigning as Ua, takeIndexWarnings as Uc, isMergeSuccessful as Ui, fsmonitorModeOf as Ul, readStoredObjectBytes as Un, detectRenames as Uo, formatTrailersOf as Ur, WSEH_CONTEXT as Us, StashCreateCommand as Ut, parseUntrackedFilesMode as V, SIGNING_KEYS as Va, indexFormatDefault as Vc, MergeStatus as Vi, sequencerPostCommit as Vl, parseSignedBuffer as Vn, ortConfigOptions as Vo, appendSignoff as Vr, DIFF_COLOR_SLOTS as Vs, NoChangesSelectedError as Vt, submoduleNotSupportedWarning as W, resolveSigning as Wa, SparseUnpack as Wc, CleanupMode as Wi, FSMONITOR_DAEMON_IPC_NAME as Wl, removeSignatureHeaders as Wn, GIT_MAX_SCORE as Wo, ignoredLogMessageBytes as Wr, WSEH_NEW as Ws, StashPathspecResetError as Wt, statusCommitInfo as X, signingConfigFromEntries as Xa, sparseCheckoutConfig as Xc, editorCleanupMode as Xi, worktreeModeTrust as Xl, verifyTagBytes as Xn, strerror as Xo, signoffLine as Xr, parseWsErrorHighlight as Xs, recordWrittenStat as Xt, formatStatusText as Y, signerOf as Ya, readSparseCheckoutPatterns as Yc, completeLine as Yi, createIdAbbreviator as Yl, verifyMergeSignature as Yn, stageZeroClashes as Yo, processTrailers as Yr, parseColorMovedWs as Ys, fsmonitorKeptEntries as Yt, StatusImpl as Z, signingConfigOf as Za, sparseDirectoriesOf as Zc, parseCleanupMode as Zi, WS_BLANK_AT_EOF as Zl, CommitFilters as Zn, DEFAULT_CONFLICT_MARKER_SIZE as Zo, trailerConfigFromEntries as Zr, writeColoredHunks as Zs, restoreKeptEntries as Zt, formatBlamePorcelain as _, treeDelta as _a, CorruptTreeError as _c, DEFAULT_DATE_MODE as _i, restoreCaseOptions as _l, shortBranchName as _n, lstatExists as _o, copyNoteForRewrite as _r, formatNoIndexDiff as _s, PrettyFormatError as _t, committerIdentOf as _u, PushStatus as a, indexChanges as aa, LAZY_FETCH_DISABLED_WARNING as ac, matchPathspecSeen as ai, overwriteMessage as al, STASH_REF as an, disableHint as ao, storedBase as ar, blobSide as as, ExternalDiffTempFiles as at, checkAutoCommentChar as au, collapsedSparseDirectories as b, StashApplyStatus as ba, objectTypeOfMode as bc, parseDateMode as bi, treePathRefusal as bl, worktreeAdminWorkingCopy as bn, verifyNonFilename as bo, createNotesCommit as br, formatRawPair as bs, formatRefDecorations as bt, identConfigOf as bu, isPullSuccessful as c, plainUnpackError as ca, installPromisorFetcher as cc, pathspecCommonPrefix as ci, removeDirectoryIfEmpty as cl, RevFilter as cn, installTracking as co, forkPointOf as cr, contentSide as cs, readDiffColorSettings as ct, configBool as cu, hasUpdates as d, refsWatched as da, registerPartialClone as dc, pathspecItemMayMatch as di, untrackedUnder as dl, checkCandidatePath as dn, trackableStart as do, patchIdOfChanges as dr, diffOptsContext as ds, ConfigValueDeath as dt, mergeVerbosityOf as du, FlatTreeCache as ea, reflogLine as ec, validateTrailerArgs as ei, updateSparsity as el, recursesIntoSubmodules as en, RevisionResolver as eo, compileCommitGrep as er, writePairCheck as es, RevParseCommand as et, isGitSpace$1 as eu, CherryPickStatus as f, rewriteIndex as fa, acceptedPromisorRemotes as fc, pathspecName as fi, worktreeDiffers as fl, findLinkedWorktree as fn, uniqueTrackingName as fo, patchIdsOfPatchText as fr, displayWidth$1 as fs, formatConfigValue as ft, DEFAULT_IDENT as fu, formatBlameIncremental as g, switchTrees as ga, httpClientSettingsOf as gc, untrackedScanPathspec as gi, planTreeRestore as gl, requireWorktrees as gn, looksLikePathspec as go, commitNotes as gr, formatNameStatus as gs, parseGitColor as gt, authorIdentOf as gu, formatBlame as h, subjectOf$2 as ha, resetPromisorAcceptance as hc, treePathspec as hi, planFlatRestore as hl, repositoryPlaceOf as hn, checkFilename as ho, NotesError as hr, formatNameOnly as hs, normalizeConfigValue as ht, InvalidIdentError as hu, isRebaseSuccessful as i, flatTree as ia, updateHeadExpecting as ic, matchPathspec as ii, flaggedEntryDiffers as il, StashApplyCommand as in, autoSetupRebase as io, mergeStoredTrees as ir, blobIdOf as is, ExternalDiffDiedError as it, autoCommentCharLines as iu, createPatchBackend as j, createCopyEntry as ja, UnknownObjectStorageFormatError as jc, bytesToLatin1 as ji, gitFileOf as jl, isSubmoduleIgnoreMode as jn, rerereHostOf as jo, combineNotesConcatenate as jr, quotePath$1 as js, applyAutostash as jt, RemoteConfigStore as ju, promptIndex as k, ChangeType as ka, MissingDefaultBranchValueError as kc, ApplyEngine as ki, gitCommitAfterHooks as kl, showSubmoduleDiffSummary as kn, rerereForget as ko, NotesTree as kr, writePairPatch as ks, wrapText as kt, deleteRefs as ku, RefUpdateStatus as l, planPathsRestore as la, promisorOf as lc, pathspecErrors as li, statFollowingLinks as ll, WorktreeListCommand as ln, planTracking as lo, PathspecAttributes as lr, countLines as ls, whitespaceRuleError as lt, configValue$1 as lu, formatAnnotate as m, storeFlatTreeOver as ma, promisorRemoteReplyOf as mc, treeEntryInteresting as mi, checkoutFreshTree as ml, refuseIfCheckedOut as mn, worktreeAmbiguityHints as mo, isFullHexObjectId as mr, externalDiffMetainfo as ms, gitConfigColorBool as mt, InvalidDateError as mu, RebaseAction as n, conflictsComment as na, reflogSubject as nc, latin1Bytes as ni, entryNotUptodate as nl, ResetMode as nn, ambiguousRemoteAdvice as no, remergeObjectsView as nr, LoadedSide as ns, installTextconvRunner as nt, wsCheckEmit as nu, getFailedUpdates as o, indexChangesFromTree as oa, createPromisorFetcher as oc, parsePathspec as oi, pruneEmptyParents as ol, StashListCommand as on, endOfSymbolicChain as oo, MergeBaseGraph as or, computeDiffstat as os, externalDiffProgramOf as ot, attributesSourceResolver as ou, BlameColorError as p, storeFlatTree as pa, promisorAutoFilter as pc, psEqual as pi, worktreeModified as pl, parseExpiry as pn, upstreamMissingError as po, canonicalObjectId as pr, driverOf as ps, gitConfigBool as pt, IdentityUnknownError as pu, formatTrackingInfo as q, signRequestOf as qa, pushSparseWarnings as qc, commitCleanupMode as qi, abbrevLengths as ql, trustRank as qn, addLeadingDirs as qo, parseTrailerIfMissing as qr, diffColorSlotOf as qs, ResetCommand as qt, RebaseStatus as r, firstPlainError as ra, updateHead as rc, latin1String as ri, findInTheWay as rl, PathspecFile as rn, applyRefspecs as ro, mergeBaseTree as rr, attrPathOf as rs, textconvRunnerOf as rt, AutoCommentCharRemovedError as ru, isPushSuccessful as s, peelMergeHeads as sa, hasPromisorRemote as sc, parsePathspecItem as si, removeCaseVariants as sl, LogCommand as sn, guessRemoteBranch as so, commitsBaseSource as sr, contentDriver as ss, DEFAULT_DECORATION_COLORS as st, bareAttributesResolver as su, RevertStatus as t, OperationState as ta, reflogMessages as tc, globalPathspecMagic as ti, IndexCaseFolding as tl, ListBranchMode as tn, TrackMode as to, RemergeTreeCommand as tr, GIT_DIFF_BIG_FILE_THRESHOLD as ts, revisionMergeBases as tt, wsBlankLine as tu, getSuccessfulUpdates as u, readIndex as ua, promisorRemotes as uc, pathspecItemBytes as ui, statThroughLeadingLinks as ul, shortenUnambiguousRef as un, pushTrackingPlan as uo, PatchIds as ur, diffDriverOf as us, CONFIG_VALUE_TYPES as ut, conflictStyleOf as uu, AddCommand as v, updateIndexCacheTree as va, SHORT_MAGIC as vc, DateModeError as vi, writeTreeRestorePlan as vl, useRelativePaths as vn, parseRevisionAndPathArgs as vo, copyNotesForAmend as vr, formatNumstat as vs, expandStringArg as vt, findIdent as vu, pathPatchMode as w, orderByPatterns as wa, readMailmapFile as wc, graphColumnColors as wi, HookSession as wl, SubmoduleWalkError as wn, RerereError as wo, finishCopyNotesForRewrite as wr, noIndexPair as ws, matchBoolArg as wt, withoutCrud as wu, sparseIndexAsRead as x, createRefDecorationFilter as xa, readAllBytes as xc, showDate as xi, withTreePathRefusal as xl, worktreeUsingBranch as xn, handleRevisionArg as xo, defaultNotesRef as xr, formatShortstat as xs, humanDate as xt, resolveAuthorIdent as xu, SPARSE_INDEX_EXPANDED_HINT as y, writeIndexAsTree as ya, concatBytes$3 as yc, hostZoneName as yi, firstInvalidPath as yl, usesBranch as yn, verifyFilename as yo, copyNotesForRebase as yr, formatPatch as ys, formatCommitPretty as yt, hostEnvironmentOf as yu, cutLine as z, GitCommand as za, unknownObjectStorageFormat as zc, ContentMergeStrategy as zi, refTransactionHookOf as zl, parseGpgOutput as zn, lowLevelMerge as zo, reencodedCommitParts as zr, COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE as zs, saveAutostash as zt };
51813
+ export { formatStatusText as $, orderByPatterns as $a, readMailmapBlob as $c, graphColumnColors as $i, firstInvalidPath as $l, SubmoduleWalkError as $n, unknownRevisionMessage as $o, finishCopyNotesForRewrite as $r, formatSummary as $s, matchBoolArg as $t, findIdent as $u, IndexRefresh as A, OperationState as Aa, reflogLine as Ac, globalPathspecMagic as Ai, sparseWarningText as Al, ListBranchMode as An, TrackMode as Ao, RemergeTreeCommand as Ar, writePairCheck as As, textconvRunnerOf as At, worktreeModeTrust as Au, StatusCommand as B, refsWatched as Ba, promisorRemotes as Bc, pathspecItemMayMatch as Bi, removeCaseVariants as Bl, checkCandidatePath as Bn, trackableStart as Bo, patchIdOfChanges as Br, diffDriverOf as Bs, ConfigValueDeath as Bt, enterAutoCommentCharWarning as Bu, patchRevisionOf as C, commitMessageFromOption as Ca, diffColorSlotOf as Cc, parseTrailerWhere as Ci, entryList as Cl, checkFlaggedEntries as Cn, signTagCompat as Co, verifyCommitBytes as Cr, addLeadingDirs as Cs, termColumns as Ct, fsmonitorModeOf as Cu, PATCH_MODES as D, preparedMessageCleanup as Da, writeColoredHunks as Dc, trailerConfigOf as Di, sparseCheckoutConfig as Dl, restoreWorktreeHard as Dn, signingKeyIdOf as Do, GrepPatternError as Dr, DEFAULT_CONFLICT_MARKER_SIZE as Ds, RevParseCommand as Dt, abbrevLengths as Du, runAddPatch as E, parseCleanupMode as Ea, parseWsErrorHighlight as Ec, trailerConfigFromEntries as Ei, readSparseCheckoutPatterns as El, restoreKeptEntries as En, signingConfigOf as Eo, CommitFilters as Er, strerror as Es, submoduleToken as Et, queryFsmonitorDaemon as Eu, checkPickaxeOptions as F, indexChangesFromTree as Fa, LAZY_FETCH_DISABLED_WARNING as Fc, parsePathspec as Fi, findInTheWay as Fl, StashListCommand as Fn, endOfSymbolicChain as Fo, MergeBaseGraph as Fr, blobSide as Fs, badConfigVariableLine as Ft, wsBlankLine as Fu, readSubmoduleDirt as G, switchTrees as Ga, resetPromisorAcceptance as Gc, untrackedScanPathspec as Gi, untrackedUnder as Gl, requireWorktrees as Gn, looksLikePathspec as Go, commitNotes as Gr, formatNameOnly as Gs, parseGitColor as Gt, conflictStyleOf as Gu, parseIgnoredMode as H, storeFlatTree as Ha, acceptedPromisorRemotes as Hc, psEqual as Hi, statFollowingLinks as Hl, parseExpiry as Hn, upstreamMissingError as Ho, canonicalObjectId as Hr, displayWidth$1 as Hs, gitConfigBool as Ht, bareAttributesResolver as Hu, formatDiffEntry as I, peelMergeHeads as Ia, createPromisorFetcher as Ic, parsePathspecItem as Ii, flaggedEntryDiffers as Il, LogCommand as In, guessRemoteBranch as Io, commitsBaseSource as Ir, computeDiffstat as Is, readColorBool as It, wsCheckEmit as Iu, readHeadDescription as J, writeIndexAsTree as Ja, SHORT_MAGIC as Jc, hostZoneName as Ji, checkoutFreshTree as Jl, usesBranch as Jn, verifyFilename as Jo, copyNotesForRebase as Jr, formatNumstat as Js, formatCommitPretty as Jt, IdentityUnknownError as Ju, submoduleNotSupportedWarning as K, treeDelta as Ka, httpClientSettingsOf as Kc, DEFAULT_DATE_MODE as Ki, worktreeDiffers as Kl, shortBranchName as Kn, lstatExists as Ko, copyNoteForRewrite as Kr, formatNameStatus as Ks, PrettyFormatError as Kt, mergeVerbosityOf as Ku, hasPickaxe as L, plainUnpackError as La, hasPromisorRemote as Lc, pathspecCommonPrefix as Li, leadingFileOf as Ll, RevFilter as Ln, installTracking as Lo, forkPointOf as Lr, contentDriver as Ls, readDiffColorSettings as Lt, AutoCommentCharRemovedError as Lu, applyIndexStatUpdates as M, firstPlainError as Ma, reflogSubject as Mc, latin1String as Mi, IndexCaseFolding as Ml, PathspecFile as Mn, applyRefspecs as Mo, mergeBaseTree as Mr, LoadedSide as Ms, ExternalDiffTempFiles as Mt, WS_DEFAULT_RULE as Mu, refreshIndexEntries as N, flatTree as Na, updateHead as Nc, matchPathspec as Ni, belowRefused as Nl, StashApplyCommand as Nn, autoSetupRebase as No, mergeStoredTrees as Nr, attrPathOf as Ns, externalDiffProgramOf as Nt, checkBlankAtEof as Nu, patchModeFor as O, stripspace as Oa, wsErrorHighlightOf as Oc, trailerLinesOf as Oi, sparseDirectoriesOf as Ol, SubmoduleUnpack as On, splitCmdline as Oo, applyMailmapToHeader as Or, conflictMarkerSizeOf as Os, revisionMergeBases as Ot, coreBool as Ou, DiffCommand as P, indexChanges as Pa, updateHeadExpecting as Pc, matchPathspecSeen as Pi, entryNotUptodate as Pl, STASH_REF as Pn, disableHint as Po, storedBase as Pr, blobIdOf as Ps, DEFAULT_DECORATION_COLORS as Pt, isGitSpace$1 as Pu, StatusPrinter as Q, DiffPickaxe as Qa, Mailmap as Qc, LogGraph as Qi, writeTreeRestorePlan as Ql, SubmoduleRepository as Qn, parseRevisionArgs as Qo, expandNotesRef as Qr, formatStat as Qs, matchArgValue as Qt, committerIdentOf as Qu, renamesValue as R, planPathsRestore as Ra, installPromisorFetcher as Rc, pathspecErrors as Ri, overwriteMessage as Rl, WorktreeListCommand as Rn, planTracking as Ro, PathspecAttributes as Rr, contentSide as Rs, whitespaceRuleError as Rt, autoCommentCharLines as Ru, runAddInteractive as S, commitCleanupMode as Sa, coloredHunkHeader as Sc, parseTrailerIfMissing as Si, cleanTrackedSparseDirectories as Sl, ResetCommand as Sn, signRequestOf as So, trustRank as Sr, IndexAdder as Ss, readColumnConfig as St, sequencerPrepareMessage as Su, runPatchSelection as T, editorCleanupMode as Ta, parseColorMovedWs as Tc, signoffLine as Ti, readSparseCheckoutFile as Tl, recordWrittenStat as Tn, signingConfigFromEntries as To, verifyTagBytes as Tr, stageZeroClashes as Ts, formatStatusPorcelain as Tt, encodePacketized as Tu, parseUntrackedFilesMode as U, storeFlatTreeOver as Ua, promisorAutoFilter as Uc, treeEntryInteresting as Ui, statThroughLeadingLinks as Ul, refuseIfCheckedOut as Un, worktreeAmbiguityHints as Uo, isFullHexObjectId as Ur, driverOf as Us, gitConfigColorBool as Ut, configBool as Uu, cutLine as V, rewriteIndex as Va, registerPartialClone as Vc, pathspecName as Vi, removeDirectoryIfEmpty as Vl, findLinkedWorktree as Vn, uniqueTrackingName as Vo, patchIdsOfPatchText as Vr, diffOptsContext as Vs, formatConfigValue as Vt, attributesSourceResolver as Vu, readShowUntrackedFiles as W, subjectOf$2 as Wa, promisorRemoteReplyOf as Wc, treePathspec as Wi, takeCleanSubdirectory as Wl, repositoryPlaceOf as Wn, checkFilename as Wo, NotesError as Wr, externalDiffMetainfo as Ws, normalizeConfigValue as Wt, configValue$1 as Wu, readStatusColors as X, createRefDecorationFilter as Xa, objectTypeOfMode as Xc, showDate as Xi, planTreeRestore as Xl, worktreeUsingBranch as Xn, handleRefOption as Xo, defaultNotesRef as Xr, formatRawPair as Xs, humanDate as Xt, InvalidIdentError as Xu, formatTrackingInfo as Y, StashApplyStatus as Ya, concatBytes$3 as Yc, parseDateMode as Yi, planFlatRestore as Yl, worktreeAdminWorkingCopy as Yn, verifyNonFilename as Yo, createNotesCommit as Yr, formatPatch as Ys, formatRefDecorations as Yt, InvalidDateError as Yu, DEFAULT_STATUS_COLORS as Z, decorateFullRefs as Za, readAllBytes as Zc, GRAPH_COLUMN_COLORS_ANSI as Zi, restoreCaseOptions as Zl, NULL_OBJECT_ID as Zn, handleRevisionArg as Zo, expandLooseNotesRef as Zr, formatShortstat as Zs, loadRefDecorations as Zt, authorIdentOf as Zu, formatBlamePorcelain as _, MergeStrategy as _a, DIFF_COLOR_SLOTS as _c, appendTrailers as _i, IndexVersionConfigError as _l, NoStagedChangesError as _n, SigningFailedError as _o, parseSshOutput as _r, ortConfigOptions as _s, columnItemWidth as _t, isKnownHook as _u, PushStatus as a, ApplyParser as aa, writePairPatch as ac, withoutCrud as ad, combineNotesCatSortUniq as ai, MissingDefaultBranchValueError as al, AUTOSTASH_SAVED_LINES as an, createAddEntry as ao, submoduleHeader as ar, rerereForget as as, COL_COLUMN as at, LOCAL_REPO_ENV as au, collapsedSparseDirectories as b, cleanupWith as ba, WSEH_NEW as bc, interpretTrailers as bi, takeIndexWarnings as bl, StashWorktreeRemovalError as bn, signCommit as bo, signatureFormatAt as br, GIT_MAX_SCORE as bs, parseColumnMode as bt, runPostCheckoutHook as bu, isPullSuccessful as c, latin1ToBytes as ca, quoteTwo as cc, localTimezoneOffset as cd, combineNotesOverwrite as ci, UnknownRefFormatError as cl, createAutostash as cn, createModifyEntry as co, SignatureVerificationError as cr, rerereRemaining as cs, COL_ENABLED as ct, configuredHooks as cu, hasUpdates as d, pathToLatin1 as da, WORD_DIFF_MODES as dc, moveRefs as dd, mailFromHeader as di, defaultBranchHint as dl, removeMergeBranchState as dn, formatDirstat as do, checkSignatureWith as dr, MergeDriverCommandMissingError as ds, COL_PARSEOPT as dt, gitFileOf as du, ortResultEntries as ea, noIndexPair as ec, hostEnvironmentOf as ed, initCopyNotesForRewrite as ei, readMailmapFile as el, parseColorSpec as en, orderRank as eo, openSubmoduleRepository as er, RerereError as es, statusCommitInfo as et, treePathRefusal as eu, CherryPickStatus as f, textToLatin1 as fa, compileWordRegex as fc, RemoteConfigStore as fd, mailSubjectLine as fi, defaultBranchHint243 as fl, resetMerge as fn, parseDirstatParams as fo, mergetagsOf as fr, MergeDriverFailedError as fs, COL_PLAIN as ft, hookHostInGitDir as fu, formatBlameIncremental as g, MergeStatus as ga, DEFAULT_DIFF_COLORS as gc, appendSignoff as gi, unknownObjectStorageFormat as gl, NoChangesSelectedError as gn, SIGNING_KEYS as go, parseSignedBuffer as gr, mergeDriversOf as gs, columnActive as gt, hookSettingsFromEntries as gu, formatBlame as h, FastForwardMode as ha, COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE as hc, amendWithTrailers as hi, isValidBranchName$1 as hl, squashMessage as hn, SIGNING_FAILED_LINES as ho, parseSignature as hr, lowLevelMerge as hs, applyColumnOption as ht, hookSettingsCheck as hu, isRebaseSuccessful as i, ApplyEngine as ia, writeHeaderOnlyPatch as ic, resolveIdentDate as id, NotesTree as ii, InvalidInitialBranchError as il, wrapText as in, ChangeType as io, showSubmoduleDiffSummary as ir, rerereEngineOf as is, COL_AUTO as it, HookSession as iu, createPatchBackend as j, conflictsComment as ja, reflogMessages as jc, latin1Bytes as ji, updateSparsity as jl, ResetMode as jn, ambiguousRemoteAdvice as jo, remergeObjectsView as jr, GIT_DIFF_BIG_FILE_THRESHOLD as js, ExternalDiffDiedError as jt, WS_BLANK_AT_EOF as ju, promptIndex as k, FlatTreeCache as ka, committerIdent as kc, validateTrailerArgs as ki, sparsePathAdvice as kl, recursesIntoSubmodules as kn, RevisionResolver as ko, compileCommitGrep as kr, isConflictMarkerLine as ks, installTextconvRunner as kt, createIdAbbreviator as ku, RefUpdateStatus as l, latin1ToPath as la, cutToLineRanges as lc, parseGitDate as ld, readNoteBytes as li, UnsupportedObjectStorageError as ll, moveHeadAsReset as ln, createRenameEntry as lo, bytesOf as lr, rerereStatus as ls, COL_ENABLE_MASK as lt, gitCommitAfterHooks as lu, formatAnnotate as m, ContentMergeStrategy as ma, COLOR_MOVED_MODE_ERROR as mc, reencodedCommitParts as mi, defaultRefFormat as ml, saveAutostash as mn, GitCommand as mo, parseGpgOutput as mr, installMergeDrivers as ms, ColumnOptionError as mt, hookRunnerOf as mu, RebaseAction as n, ApplyCommand as na, statSummary as nc, resolveAuthorIdent as nd, readRef as ni, removeLegacyRemoteFile as nl, relativeDate as nn, DiffFormatter as no, readDiffSubmoduleConfig as nr, rerereClear as ns, columnSettingsOf as nt, worktreePathRules as nu, getFailedUpdates as o, bytesToLatin1 as oa, quoteCStyleBody as oc, approxidateCareful$1 as od, combineNotesConcatenate as oi, ReinitializeObjectStorageError as ol, applyAutostash as on, createCopyEntry as oo, isSubmoduleIgnoreMode as or, rerereGcLocation as os, COL_DENSE as ot, commonGitFileOf as ou, BlameColorError as p, newFilePatch as pa, writeWordDiffHunks as pc, listRemoteNames as pd, mergesMode as pi, defaultInitialBranch as pl, resetUnmergedToHead as pn, writeCombinedDiff as po, parseBufferSignedByHeader as pr, createMergeDriver as ps, COL_ROW as pt, hookHostOf as pu, SubmoduleSummaryCommand as q, updateIndexCacheTree as qa, CorruptTreeError as qc, DateModeError as qi, worktreeModified as ql, useRelativePaths as qn, parseRevisionAndPathArgs as qo, copyNotesForAmend as qr, formatNoIndexDiff as qs, expandStringArg as qt, DEFAULT_IDENT as qu, RebaseStatus as r, parseWhitespaceAction as ra, utf8$1 as rc, resolveCommitterIdent as rd, updateNotesRef as ri, InvalidDefaultBranchError as rl, sanitizedSubject as rn, diffEntryToPair as ro, readGitmodulesEntries as rr, rerereDiff as rs, terminalColumnsOf as rt, markIndexUpdate as ru, isPushSuccessful as s, cUnquote as sa, quotePath$1 as sc, formatRfc2822Date as sd, combineNotesIgnore as si, UnknownObjectStorageFormatError as sl, cleanupMessage as sn, createDeleteEntry as so, parseGitmodules as sr, rerereHostOf as ss, COL_DISABLED as st, configuredHookEntries as su, RevertStatus as t, readBlob as ta, pprintRename as tc, identConfigOf as td, initNotes as ti, readRepositoryMailmap as tl, parseMaybeBool as tn, parseOrderFile as to, parseSubmoduleDiffFormat as tr, normalizeConflicts as ts, columnConfigOf as tt, withTreePathRefusal as tu, getSuccessfulUpdates as u, latin1ToText as ua, lineRangesSpan as uc, deleteRefs as ud, LogPrinter as ui, checkDefaultObjectStorage as ul, removeBranchState as un, DEFAULT_DIRSTAT as uo, checkSignature as ur, runRerere as us, COL_LAYOUT_MASK as ut, gitCommitMessageHooks as uu, AddCommand as v, isMergeSuccessful as va, MovedLineBuffer as vc, formatTrailersOf as vi, indexFormatDefault as vl, StashCreateCommand as vn, refuseCommitSigning as vo, readStoredObjectBytes as vr, DEFAULT_RENAME_LIMIT as vs, explicitlyEnableColumn as vt, nullIdLike as vu, pathPatchMode as w, completeLine as wa, parseColorMoved as wc, processTrailers as wi, pushSparseWarnings as wl, fsmonitorKeptEntries as wn, signerOf as wo, verifyMergeSignature as wr, readGitlinkHead as ws, StatusImpl as wt, FSMONITOR_DAEMON_IPC_NAME as wu, sparseIndexAsRead as x, commentPrefixOf as xa, WSEH_OLD as xc, parseTrailerIfExists as xi, SparseUnpack as xl, WorkingCopyStashProvider as xn, signPayload as xo, signatureLetter as xr, isBinaryContent as xs, printColumns as xt, sequencerPostCommit as xu, SPARSE_INDEX_EXPANDED_HINT as y, CleanupMode as ya, WSEH_CONTEXT as yc, ignoredLogMessageBytes as yi, indexVersionConfigError as yl, StashPathspecResetError as yn, resolveSigning as yo, removeSignatureHeaders as yr, detectRenames as ys, finalizeColopts as yt, refTransactionHookOf as yu, TextconvCaches as z, readIndex as za, promisorOf as zc, pathspecItemBytes as zi, pruneEmptyParents as zl, shortenUnambiguousRef as zn, pushTrackingPlan as zo, PatchIds as zr, countLines as zs, CONFIG_VALUE_TYPES as zt, checkAutoCommentChar as zu };