@statewalker/vcs-commands 0.13.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 (304) 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/archive-command.d.ts +6 -2
  5. package/dist/commands/archive/archive-command.d.ts.map +1 -1
  6. package/dist/commands/archive/remote-archive-command.d.ts +27 -2
  7. package/dist/commands/archive/remote-archive-command.d.ts.map +1 -1
  8. package/dist/commands/archive/upload-archive-writer.d.ts +11 -5
  9. package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -1
  10. package/dist/commands/branch-command.d.ts +14 -2
  11. package/dist/commands/branch-command.d.ts.map +1 -1
  12. package/dist/commands/bundle/bundle-format.d.ts +6 -1
  13. package/dist/commands/bundle/bundle-format.d.ts.map +1 -1
  14. package/dist/commands/bundle/bundle-uri-host.d.ts +12 -1
  15. package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -1
  16. package/dist/commands/bundle/bundle-uri.d.ts +7 -1
  17. package/dist/commands/bundle/bundle-uri.d.ts.map +1 -1
  18. package/dist/commands/bundle/bundle-verify.d.ts +4 -1
  19. package/dist/commands/bundle/bundle-verify.d.ts.map +1 -1
  20. package/dist/commands/cat-file/batch-format.d.ts +8 -12
  21. package/dist/commands/cat-file/batch-format.d.ts.map +1 -1
  22. package/dist/commands/cat-file/cat-file-command.d.ts +39 -5
  23. package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
  24. package/dist/commands/check-ignore-command.d.ts.map +1 -1
  25. package/dist/commands/checkout-command.d.ts +4 -0
  26. package/dist/commands/checkout-command.d.ts.map +1 -1
  27. package/dist/commands/checkout-paths.d.ts +9 -0
  28. package/dist/commands/checkout-paths.d.ts.map +1 -1
  29. package/dist/commands/cherry-pick-command.d.ts +3 -0
  30. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  31. package/dist/commands/clean-interactive.d.ts +0 -9
  32. package/dist/commands/clean-interactive.d.ts.map +1 -1
  33. package/dist/commands/clone-command.d.ts +17 -0
  34. package/dist/commands/clone-command.d.ts.map +1 -1
  35. package/dist/commands/column/column-config.d.ts +23 -0
  36. package/dist/commands/column/column-config.d.ts.map +1 -0
  37. package/dist/commands/column/column-layout.d.ts +129 -0
  38. package/dist/commands/column/column-layout.d.ts.map +1 -0
  39. package/dist/commands/column/index.d.ts +3 -0
  40. package/dist/commands/column/index.d.ts.map +1 -0
  41. package/dist/commands/column-command.d.ts +59 -0
  42. package/dist/commands/column-command.d.ts.map +1 -0
  43. package/dist/commands/comment-char-config.d.ts +15 -0
  44. package/dist/commands/comment-char-config.d.ts.map +1 -1
  45. package/dist/commands/commit-command.d.ts +30 -2
  46. package/dist/commands/commit-command.d.ts.map +1 -1
  47. package/dist/commands/config-command.d.ts +12 -0
  48. package/dist/commands/config-command.d.ts.map +1 -1
  49. package/dist/commands/credential-helper.d.ts +214 -0
  50. package/dist/commands/credential-helper.d.ts.map +1 -0
  51. package/dist/commands/default-branch.d.ts +33 -3
  52. package/dist/commands/default-branch.d.ts.map +1 -1
  53. package/dist/commands/diff-color-config.d.ts +4 -0
  54. package/dist/commands/diff-color-config.d.ts.map +1 -1
  55. package/dist/commands/diff-command.d.ts +12 -0
  56. package/dist/commands/diff-command.d.ts.map +1 -1
  57. package/dist/commands/fast-export/fast-export-command.d.ts +89 -2
  58. package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -1
  59. package/dist/commands/fast-export/fast-import-command.d.ts +113 -8
  60. package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -1
  61. package/dist/commands/fast-export/fast-stream-support.d.ts +0 -9
  62. package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -1
  63. package/dist/commands/fetch-command.d.ts +23 -1
  64. package/dist/commands/fetch-command.d.ts.map +1 -1
  65. package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -1
  66. package/dist/commands/git-hooks.d.ts +31 -3
  67. package/dist/commands/git-hooks.d.ts.map +1 -1
  68. package/dist/commands/history-command.d.ts +173 -7
  69. package/dist/commands/history-command.d.ts.map +1 -1
  70. package/dist/commands/index-host.d.ts +19 -0
  71. package/dist/commands/index-host.d.ts.map +1 -1
  72. package/dist/commands/index-refresh.d.ts +36 -0
  73. package/dist/commands/index-refresh.d.ts.map +1 -0
  74. package/dist/commands/index.d.ts +9 -0
  75. package/dist/commands/index.d.ts.map +1 -1
  76. package/dist/commands/index.js +7 -6
  77. package/dist/commands/init-command.d.ts +20 -0
  78. package/dist/commands/init-command.d.ts.map +1 -1
  79. package/dist/commands/local-transport.d.ts +40 -2
  80. package/dist/commands/local-transport.d.ts.map +1 -1
  81. package/dist/commands/log-command.d.ts +7 -0
  82. package/dist/commands/log-command.d.ts.map +1 -1
  83. package/dist/commands/log-output.d.ts +11 -0
  84. package/dist/commands/log-output.d.ts.map +1 -1
  85. package/dist/commands/ls-tree-command.d.ts +10 -0
  86. package/dist/commands/ls-tree-command.d.ts.map +1 -1
  87. package/dist/commands/maintenance-schedule-command.d.ts +122 -0
  88. package/dist/commands/maintenance-schedule-command.d.ts.map +1 -0
  89. package/dist/commands/merge-command.d.ts +13 -1
  90. package/dist/commands/merge-command.d.ts.map +1 -1
  91. package/dist/commands/merge-index-command.d.ts +42 -0
  92. package/dist/commands/merge-index-command.d.ts.map +1 -0
  93. package/dist/commands/merge-one-file.d.ts +129 -0
  94. package/dist/commands/merge-one-file.d.ts.map +1 -0
  95. package/dist/commands/merge-support.d.ts +40 -4
  96. package/dist/commands/merge-support.d.ts.map +1 -1
  97. package/dist/commands/object-disk-info.d.ts +35 -0
  98. package/dist/commands/object-disk-info.d.ts.map +1 -0
  99. package/dist/commands/octopus-merge.d.ts +3 -3
  100. package/dist/commands/octopus-merge.d.ts.map +1 -1
  101. package/dist/commands/plumbing-input.d.ts.map +1 -1
  102. package/dist/commands/promisor-remote-reply.d.ts +31 -4
  103. package/dist/commands/promisor-remote-reply.d.ts.map +1 -1
  104. package/dist/commands/promisor-remote.d.ts +8 -1
  105. package/dist/commands/promisor-remote.d.ts.map +1 -1
  106. package/dist/commands/pull-command.d.ts +55 -7
  107. package/dist/commands/pull-command.d.ts.map +1 -1
  108. package/dist/commands/push-command.d.ts +18 -1
  109. package/dist/commands/push-command.d.ts.map +1 -1
  110. package/dist/commands/range-diff/range-diff-command.d.ts +37 -1
  111. package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -1
  112. package/dist/commands/rebase-command.d.ts +13 -1
  113. package/dist/commands/rebase-command.d.ts.map +1 -1
  114. package/dist/commands/ref-filter/for-each-ref-command.d.ts +3 -2
  115. package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -1
  116. package/dist/commands/ref-filter/index.d.ts +1 -0
  117. package/dist/commands/ref-filter/index.d.ts.map +1 -1
  118. package/dist/commands/ref-filter/peel-limit.d.ts +8 -0
  119. package/dist/commands/ref-filter/peel-limit.d.ts.map +1 -0
  120. package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -1
  121. package/dist/commands/ref-filter/ref-format.d.ts +26 -1
  122. package/dist/commands/ref-filter/ref-format.d.ts.map +1 -1
  123. package/dist/commands/ref-filter/ref-listing-command.d.ts +9 -0
  124. package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -1
  125. package/dist/commands/remote-transport.d.ts +27 -0
  126. package/dist/commands/remote-transport.d.ts.map +1 -1
  127. package/dist/commands/repack-command.d.ts +18 -2
  128. package/dist/commands/repack-command.d.ts.map +1 -1
  129. package/dist/commands/repo-command.d.ts +2 -7
  130. package/dist/commands/repo-command.d.ts.map +1 -1
  131. package/dist/commands/reset-command.d.ts +4 -1
  132. package/dist/commands/reset-command.d.ts.map +1 -1
  133. package/dist/commands/restore-command.d.ts.map +1 -1
  134. package/dist/commands/rev-list-command.d.ts +65 -0
  135. package/dist/commands/rev-list-command.d.ts.map +1 -1
  136. package/dist/commands/revert-command.d.ts +3 -0
  137. package/dist/commands/revert-command.d.ts.map +1 -1
  138. package/dist/commands/revision-filenames.d.ts.map +1 -1
  139. package/dist/commands/revision-range.d.ts +17 -0
  140. package/dist/commands/revision-range.d.ts.map +1 -1
  141. package/dist/commands/revision-resolver.d.ts +12 -0
  142. package/dist/commands/revision-resolver.d.ts.map +1 -1
  143. package/dist/commands/serve-repository.d.ts +21 -4
  144. package/dist/commands/serve-repository.d.ts.map +1 -1
  145. package/dist/commands/served-lazy-fetch.d.ts +61 -0
  146. package/dist/commands/served-lazy-fetch.d.ts.map +1 -0
  147. package/dist/commands/signing.d.ts +37 -4
  148. package/dist/commands/signing.d.ts.map +1 -1
  149. package/dist/commands/split-cmdline.d.ts +6 -0
  150. package/dist/commands/split-cmdline.d.ts.map +1 -0
  151. package/dist/commands/status-color-config.d.ts +33 -0
  152. package/dist/commands/status-color-config.d.ts.map +1 -0
  153. package/dist/commands/status-command.d.ts +15 -0
  154. package/dist/commands/status-command.d.ts.map +1 -1
  155. package/dist/commands/status-format.d.ts +46 -4
  156. package/dist/commands/status-format.d.ts.map +1 -1
  157. package/dist/commands/tag-command.d.ts +15 -1
  158. package/dist/commands/tag-command.d.ts.map +1 -1
  159. package/dist/commands/tree-restore.d.ts +14 -0
  160. package/dist/commands/tree-restore.d.ts.map +1 -1
  161. package/dist/commands/verify-command.d.ts +22 -2
  162. package/dist/commands/verify-command.d.ts.map +1 -1
  163. package/dist/commands/worktree-add-command.d.ts.map +1 -1
  164. package/dist/commands/worktree-overwrite-checks.d.ts +31 -6
  165. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
  166. package/dist/{commands-CPceUCP2.js → commands-DT3VEv50.js} +15168 -16842
  167. package/dist/errors/commit-errors.d.ts +37 -1
  168. package/dist/errors/commit-errors.d.ts.map +1 -1
  169. package/dist/errors/git-api-error.d.ts +6 -0
  170. package/dist/errors/git-api-error.d.ts.map +1 -1
  171. package/dist/errors/index.js +44 -3
  172. package/dist/{fsck-tbrPZX2q.js → fsck-BZ508Elg.js} +2 -2
  173. package/dist/git-command.d.ts +33 -1
  174. package/dist/git-command.d.ts.map +1 -1
  175. package/dist/git.d.ts +104 -1
  176. package/dist/git.d.ts.map +1 -1
  177. package/dist/index.js +8 -7
  178. package/dist/{remote-transport-C0OSJtor.js → local-transport-D98U6p4d.js} +228 -692
  179. package/dist/{maintenance-run-command-UiSIaeP8.js → maintenance-run-command-DZFnbnbo.js} +2366 -108
  180. package/dist/remote-config/remote-config-store.d.ts +6 -0
  181. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  182. package/dist/remote-transport-zvSqwpOB.js +4865 -0
  183. package/dist/results/cherry-pick-result.d.ts +4 -3
  184. package/dist/results/cherry-pick-result.d.ts.map +1 -1
  185. package/dist/results/diff-output.d.ts +7 -0
  186. package/dist/results/diff-output.d.ts.map +1 -1
  187. package/dist/results/diff-words.d.ts +14 -3
  188. package/dist/results/diff-words.d.ts.map +1 -1
  189. package/dist/results/index.js +1 -1
  190. package/dist/results/line-prefix-sink.d.ts +50 -0
  191. package/dist/results/line-prefix-sink.d.ts.map +1 -0
  192. package/dist/results/merge-result.d.ts +4 -3
  193. package/dist/results/merge-result.d.ts.map +1 -1
  194. package/dist/results/rebase-result.d.ts +5 -0
  195. package/dist/results/rebase-result.d.ts.map +1 -1
  196. package/dist/results/revert-result.d.ts +4 -3
  197. package/dist/results/revert-result.d.ts.map +1 -1
  198. package/dist/{results-CkS1p1CH.js → results-rF81cQse.js} +1788 -247
  199. package/dist/transport-command.d.ts +13 -0
  200. package/dist/transport-command.d.ts.map +1 -1
  201. package/package.json +21 -13
  202. package/src/commands/add-command.ts +15 -2
  203. package/src/commands/add-patch/patch-backend.ts +6 -44
  204. package/src/commands/archive/archive-command.ts +7 -3
  205. package/src/commands/archive/remote-archive-command.ts +45 -4
  206. package/src/commands/archive/upload-archive-writer.ts +34 -22
  207. package/src/commands/branch-command.ts +57 -4
  208. package/src/commands/bundle/bundle-format.ts +10 -2
  209. package/src/commands/bundle/bundle-uri-host.ts +71 -11
  210. package/src/commands/bundle/bundle-uri.ts +11 -4
  211. package/src/commands/bundle/bundle-verify.ts +4 -1
  212. package/src/commands/cat-file/batch-format.ts +17 -18
  213. package/src/commands/cat-file/cat-file-command.ts +182 -48
  214. package/src/commands/check-ignore-command.ts +110 -21
  215. package/src/commands/checkout-command.ts +149 -21
  216. package/src/commands/checkout-index-command.ts +2 -1
  217. package/src/commands/checkout-paths.ts +13 -0
  218. package/src/commands/cherry-pick-command.ts +9 -0
  219. package/src/commands/clean-interactive.ts +20 -74
  220. package/src/commands/clone-command.ts +102 -11
  221. package/src/commands/column/column-config.ts +63 -0
  222. package/src/commands/column/column-layout.ts +396 -0
  223. package/src/commands/column/index.ts +2 -0
  224. package/src/commands/column-command.ts +171 -0
  225. package/src/commands/comment-char-config.ts +42 -0
  226. package/src/commands/commit-command.ts +93 -18
  227. package/src/commands/config-command.ts +28 -0
  228. package/src/commands/credential-helper.ts +807 -0
  229. package/src/commands/default-branch.ts +57 -5
  230. package/src/commands/diff-color-config.ts +23 -10
  231. package/src/commands/diff-command.ts +25 -2
  232. package/src/commands/fast-export/fast-export-command.ts +661 -35
  233. package/src/commands/fast-export/fast-import-command.ts +694 -94
  234. package/src/commands/fast-export/fast-stream-support.ts +18 -1
  235. package/src/commands/fetch-command.ts +116 -16
  236. package/src/commands/fsck/fsck-object-checks.ts +3 -1
  237. package/src/commands/git-hooks.ts +96 -5
  238. package/src/commands/history-command.ts +952 -20
  239. package/src/commands/index-host.ts +51 -0
  240. package/src/commands/index-refresh.ts +121 -0
  241. package/src/commands/index.ts +9 -0
  242. package/src/commands/init-command.ts +57 -4
  243. package/src/commands/legacy-remotes.ts +4 -20
  244. package/src/commands/local-transport.ts +183 -18
  245. package/src/commands/log-command.ts +39 -1
  246. package/src/commands/log-output.ts +31 -4
  247. package/src/commands/ls-tree-command.ts +20 -12
  248. package/src/commands/maintenance-schedule-command.ts +418 -0
  249. package/src/commands/merge-command.ts +42 -8
  250. package/src/commands/merge-index-command.ts +202 -0
  251. package/src/commands/merge-one-file.ts +451 -0
  252. package/src/commands/merge-support.ts +169 -15
  253. package/src/commands/object-disk-info.ts +169 -0
  254. package/src/commands/octopus-merge.ts +37 -128
  255. package/src/commands/plumbing-input.ts +3 -1
  256. package/src/commands/promisor-remote-reply.ts +338 -56
  257. package/src/commands/promisor-remote.ts +39 -6
  258. package/src/commands/pull-command.ts +173 -27
  259. package/src/commands/push-command.ts +55 -6
  260. package/src/commands/range-diff/range-diff-command.ts +86 -3
  261. package/src/commands/read-tree-command.ts +2 -2
  262. package/src/commands/rebase-command.ts +46 -1
  263. package/src/commands/ref-filter/for-each-ref-command.ts +4 -3
  264. package/src/commands/ref-filter/index.ts +1 -0
  265. package/src/commands/ref-filter/peel-limit.ts +7 -0
  266. package/src/commands/ref-filter/ref-filter.ts +68 -7
  267. package/src/commands/ref-filter/ref-format.ts +85 -11
  268. package/src/commands/ref-filter/ref-listing-command.ts +30 -0
  269. package/src/commands/remote-command.ts +2 -2
  270. package/src/commands/remote-transport.ts +66 -3
  271. package/src/commands/repack-command.ts +75 -9
  272. package/src/commands/repo-command.ts +6 -70
  273. package/src/commands/reset-command.ts +11 -1
  274. package/src/commands/restore-command.ts +1 -0
  275. package/src/commands/rev-list-command.ts +205 -3
  276. package/src/commands/revert-command.ts +9 -0
  277. package/src/commands/revision-filenames.ts +32 -4
  278. package/src/commands/revision-range.ts +2 -2
  279. package/src/commands/revision-resolver.ts +21 -1
  280. package/src/commands/serve-repository.ts +42 -11
  281. package/src/commands/served-lazy-fetch.ts +164 -0
  282. package/src/commands/signing.ts +103 -12
  283. package/src/commands/split-cmdline.ts +32 -0
  284. package/src/commands/status-color-config.ts +92 -0
  285. package/src/commands/status-command.ts +50 -2
  286. package/src/commands/status-format.ts +198 -50
  287. package/src/commands/tag-command.ts +57 -2
  288. package/src/commands/tree-restore.ts +17 -0
  289. package/src/commands/verify-command.ts +84 -12
  290. package/src/commands/worktree-add-command.ts +2 -0
  291. package/src/commands/worktree-overwrite-checks.ts +75 -14
  292. package/src/errors/commit-errors.ts +52 -2
  293. package/src/errors/git-api-error.ts +7 -0
  294. package/src/git-command.ts +105 -4
  295. package/src/git.ts +153 -0
  296. package/src/remote-config/remote-config-store.ts +16 -0
  297. package/src/results/cherry-pick-result.ts +4 -3
  298. package/src/results/diff-output.ts +8 -0
  299. package/src/results/diff-words.ts +160 -32
  300. package/src/results/line-prefix-sink.ts +102 -0
  301. package/src/results/merge-result.ts +4 -3
  302. package/src/results/rebase-result.ts +5 -0
  303. package/src/results/revert-result.ts +4 -3
  304. package/src/transport-command.ts +79 -3
@@ -1,10 +1,10 @@
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
- import { joinPath as joinPath$1, sharedRepositoryOf, withSharedPerm } from "@statewalker/vcs-utils/files";
7
+ import { joinPath as joinPath$1, sharedRepositoryOf, withReadOnlyObjectFiles, withSharedPerm } from "@statewalker/vcs-utils/files";
8
8
  import { SHA1_OBJECT_FORMAT as SHA1_OBJECT_FORMAT$1, bytesToHex as bytesToHex$1, sha1Of } from "@statewalker/vcs-utils/hash";
9
9
  import { objectStorageFormatByUri, readProtectedConfig } from "@statewalker/vcs-store-files";
10
10
  import { FetchCheckError, anonymizeUrl, createDefaultTransports, createRepositoryFacade, encodePromisorRemoteNames, fetchPromisedObjects, matchDestination, matchSource, parsePromisorRemoteInfo, parseRefSpec, unpackLimitOf } from "@statewalker/vcs-transport";
@@ -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
  }
@@ -2652,9 +2706,9 @@ var HookSession = class HookSession {
2652
2706
  };
2653
2707
  }
2654
2708
  /**
2655
- * The repository's FilesApi for writes in its git directories: under `core.sharedRepository`
2656
- * wrapped so what is created there gets git's modes (`adjust_shared_perm`), as the files
2657
- * backend's own FilesApi is.
2709
+ * The repository's FilesApi for writes in its git directories, wrapped as the files
2710
+ * backend's own FilesApi is: under `core.sharedRepository` what is created there gets git's
2711
+ * modes (`adjust_shared_perm`), otherwise the object files git keeps read-only are 0444.
2658
2712
  */
2659
2713
  async repositoryFiles(layout) {
2660
2714
  let shared = 0;
@@ -2663,8 +2717,8 @@ var HookSession = class HookSession {
2663
2717
  } catch {
2664
2718
  shared = 0;
2665
2719
  }
2666
- if (!shared) return layout.files;
2667
2720
  const common = await commonDirOf(layout.files, layout.gitDir);
2721
+ if (!shared) return withReadOnlyObjectFiles(layout.files, joinFilesPath(common, "objects"));
2668
2722
  return withSharedPerm(layout.files, () => shared, common);
2669
2723
  }
2670
2724
  /**
@@ -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");
@@ -4993,8 +5221,9 @@ function indexHostOf(workingCopy, staging, trees) {
4993
5221
  //#region src/commands/default-branch.ts
4994
5222
  /**
4995
5223
  * The initial branch of a new repository, as git's `repo_default_branch_name` (refs.c) picks
4996
- * it: `init.defaultBranch` from the configuration a new repository sees (system, global, the
4997
- * command line), else `master`, or `main` in a git built with `WITH_BREAKING_CHANGES`
5224
+ * it: `init.defaultBranch` from the configuration the new repository sees (system, global, its
5225
+ * own config with what a template brought in, the command line; `includeIf "gitdir:..."`
5226
+ * matched against the new repository's git directory), else `master`, or `main` in a git built with `WITH_BREAKING_CHANGES`
4998
5227
  * (`GitHostEnvironment.breakingChanges`, git 3.0). With no name configured, git explains the
4999
5228
  * default in an `advice.defaultBranchName` hint, which {@link DefaultBranch.hint} holds.
5000
5229
  *
@@ -5045,14 +5274,22 @@ function isValidBranchName$1(name) {
5045
5274
  return name !== "" && isValidRefName(`refs/heads/${name}`);
5046
5275
  }
5047
5276
  /**
5048
- * The initial branch of a repository created now. Reads the protected configuration (the
5049
- * repository's own does not exist yet); without an environment, nothing is configured.
5277
+ * The initial branch of a repository created now, from `config` (the new repository's, see
5278
+ * {@link NewRepositoryConfig}); without one, from the protected configuration (system,
5279
+ * global, command line, `gitdir:` conditions false). Without either, nothing is configured.
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.
5050
5284
  *
5051
5285
  * @throws InvalidDefaultBranchError when `init.defaultBranch` names no valid branch (empty too)
5052
5286
  * @throws MissingDefaultBranchValueError when `init.defaultBranch` has no value
5053
5287
  */
5054
- async function defaultInitialBranch(environment) {
5055
- const config = await readProtectedConfig(environment);
5288
+ async function defaultInitialBranch(environment, repositoryConfig, options = {}) {
5289
+ const config = repositoryConfig ? repositoryConfig.listWithOrigin().map((e) => ({
5290
+ ...e,
5291
+ value: e.text
5292
+ })) : await readProtectedConfig(environment);
5056
5293
  const last = (key) => config.filter((e) => e.key === key).at(-1);
5057
5294
  const configured = last("init.defaultbranch");
5058
5295
  if (configured && configured.value === void 0) throw new MissingDefaultBranchValueError(configured.file, configured.line);
@@ -5061,12 +5298,35 @@ async function defaultInitialBranch(environment) {
5061
5298
  return { name: configured.value };
5062
5299
  }
5063
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
+ };
5064
5306
  const advice = last("advice.defaultbranchname");
5065
5307
  return advice === void 0 || parseGitBool$1(advice.value ?? "true") !== false ? {
5066
5308
  name,
5067
5309
  hint: defaultBranchHint(name, environment?.breakingChanges)
5068
5310
  } : { name };
5069
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
+ }
5070
5330
  /** git's `default_branch_name_advice` (2.5x, or 3.0), as `advise_if_enabled` prints it. */
5071
5331
  function defaultBranchHint(name, breakingChanges) {
5072
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
@@ -5381,28 +5641,17 @@ function defaultBranchName(store, compatibility) {
5381
5641
  const configured = store.value("init.defaultBranch");
5382
5642
  if (configured !== void 0 && configured !== "") return { name: configured };
5383
5643
  const name = "master";
5644
+ if (compatibility === "2.43") return {
5645
+ name,
5646
+ hint: defaultBranchHint243(name).join("\n")
5647
+ };
5384
5648
  const advice = store.value("advice.defaultBranchName");
5385
5649
  if (advice !== void 0 && parseGitBool$1(advice) === false) return { name };
5386
5650
  return {
5387
5651
  name,
5388
- hint: (compatibility === "2.43" ? defaultBranchHint243(name) : defaultBranchHint(name, false)).join("\n")
5652
+ hint: defaultBranchHint(name, false).join("\n")
5389
5653
  };
5390
5654
  }
5391
- /** git 2.43's `default_branch_name_advice` (an empty line is `hint: `, with its space). */
5392
- function defaultBranchHint243(name) {
5393
- return [
5394
- `Using '${name}' as the name for the initial branch. This default branch name`,
5395
- "is subject to change. To configure the initial branch name to use in all",
5396
- "of your new repositories, which will suppress this warning, call:",
5397
- "",
5398
- " git config --global init.defaultBranch <name>",
5399
- "",
5400
- "Names commonly chosen instead of 'master' are 'main', 'trunk' and",
5401
- "'development'. The just-created branch can be renamed via this command:",
5402
- "",
5403
- " git branch -m <name>"
5404
- ].map((line) => `hint: ${line}`);
5405
- }
5406
5655
  /**
5407
5656
  * A file of the common git directory as text, or undefined when it is not a regular file
5408
5657
  * (absent, a directory: `fopen_or_warn` reads nothing from either).
@@ -5926,8 +6175,13 @@ function int(key, value) {
5926
6175
  * `partialCloneFilter` and `token` of a remote it already has), and which remotes its lazy
5927
6176
  * fetches then try first ({@link acceptedPromisorRemotes}).
5928
6177
  *
5929
- * Not yet: `promisor.acceptFromServerUrl` (2.56: remotes created from an advertised URL) and
5930
- * `--filter=auto`.
6178
+ * `promisor.acceptFromServerUrl` (git 2.56) is consulted first: an advertised URL matching one
6179
+ * of its globs (`[<name>=]<url pattern>`, urlmatch.c's normalization, `*` within the host or
6180
+ * the path) is accepted whatever `acceptFromServer` says, an unknown remote being created as
6181
+ * `remote.<name>.url`/`promisor`/`advertisedAs` (the pattern's name, else
6182
+ * `promisor-auto-<sanitized url>`, `-<n>` added while another URL holds the name). The filters
6183
+ * the accepted remotes advertised make `--filter=auto` (git 2.54,
6184
+ * {@link promisorAutoFilter}).
5931
6185
  *
5932
6186
  * @example
5933
6187
  * ```ts
@@ -5940,6 +6194,8 @@ function int(key, value) {
5940
6194
  /** The optional fields git knows (`known_fields`), lower-cased. */
5941
6195
  const KNOWN_FIELDS = /* @__PURE__ */ new Map([["partialclonefilter", "partialCloneFilter"], ["token", "token"]]);
5942
6196
  const accepted = /* @__PURE__ */ new WeakMap();
6197
+ /** The filter each accepted remote advertised (git's `promisor_remote.advertised_filter`). */
6198
+ const advertisedFilters = /* @__PURE__ */ new WeakMap();
5943
6199
  /**
5944
6200
  * The promisor remotes a server's `promisor-remote` advertisement made this repository
5945
6201
  * accept (git's `promisor_remote.accepted`, kept for the process): its lazy fetches try them
@@ -5948,6 +6204,17 @@ const accepted = /* @__PURE__ */ new WeakMap();
5948
6204
  function acceptedPromisorRemotes(workingCopy) {
5949
6205
  return accepted.get(keyOf(workingCopy)) ?? /* @__PURE__ */ new Set();
5950
6206
  }
6207
+ /**
6208
+ * Forgets what earlier `promisor-remote` answers accepted for this repository, as each git
6209
+ * process starts with none (`promisor_remote.accepted`, `advertised_filter`): a fetch or clone
6210
+ * calls it before it connects, so `--filter=auto` and the lazy fetches' order follow only the
6211
+ * server it talks to now.
6212
+ */
6213
+ function resetPromisorAcceptance(workingCopy) {
6214
+ const key = keyOf(workingCopy);
6215
+ accepted.delete(key);
6216
+ advertisedFilters.delete(key);
6217
+ }
5951
6218
  function keyOf(workingCopy) {
5952
6219
  try {
5953
6220
  return workingCopy.history?.objects ?? workingCopy;
@@ -5960,8 +6227,12 @@ function keyOf(workingCopy) {
5960
6227
  * `fetchFromConnection` (`FetchClientOptions.promisorRemote`). `stderr` gets git's lines
5961
6228
  * (warnings, `Storing new filter from server ...`), each without its newline. Each call reads
5962
6229
  * the configuration afresh: a stored field is not stored (nor told) again.
6230
+ *
6231
+ * `remember: false` answers as a child process of git would (a lazy fetch's `git fetch`): its
6232
+ * acceptance changes the configuration it writes, not the remotes this repository's lazy
6233
+ * fetches try first nor `--filter=auto`.
5963
6234
  */
5964
- function promisorRemoteReplyOf(workingCopy, stderr) {
6235
+ function promisorRemoteReplyOf(workingCopy, stderr, options = {}) {
5965
6236
  const warnedFields = /* @__PURE__ */ new Set();
5966
6237
  const fieldsOf = (store, key) => {
5967
6238
  const value = store.value(key);
@@ -5985,34 +6256,76 @@ function promisorRemoteReplyOf(workingCopy, stderr) {
5985
6256
  return async (info) => {
5986
6257
  const store = RemoteConfigStore.from(workingCopy);
5987
6258
  const policy = acceptPolicyOf(store, stderr);
5988
- if (policy === "none") return void 0;
6259
+ const acceptUrls = loadAcceptFromServerUrl(store, stderr);
6260
+ if (policy === "none" && acceptUrls.length === 0) return void 0;
5989
6261
  const { remotes, warnings } = parsePromisorRemoteInfo(info);
5990
6262
  for (const w of warnings) stderr(`warning: ${w}`);
5991
6263
  const checked = fieldsOf(store, "promisor.checkFields");
5992
6264
  const local = configuredPromisors(store, checked);
5993
- const accepting = [];
5994
- for (const advertised of remotes) if (shouldAccept(policy, advertised, local, checked, stderr)) accepting.push(advertised);
5995
- if (accepting.length === 0) return void 0;
5996
6265
  const storedFields = fieldsOf(store, "promisor.storeFields");
6266
+ const current = configuredPromisors(store, storedFields);
6267
+ const accepting = [];
5997
6268
  let changed = false;
5998
- if (storedFields.length > 0) {
5999
- const current = configuredPromisors(store, storedFields);
6000
- for (const advertised of accepting) {
6001
- const mine = current.find((p) => p.name === advertised.name);
6002
- if (!mine) continue;
6003
- if (storedFields.includes("partialCloneFilter") && advertised.filter !== void 0 && validFilter(advertised.filter, advertised.name, stderr)) changed = storeField(store, advertised.name, "filter", "partialCloneFilter", advertised.filter, mine.filter, stderr) || changed;
6004
- if (storedFields.includes("token") && advertised.token !== void 0 && validToken(advertised.token, advertised.name, stderr)) changed = storeField(store, advertised.name, "token", "token", advertised.token, mine.token, stderr) || changed;
6005
- }
6269
+ for (const advertised of remotes) {
6270
+ const decision = shouldAccept(policy, advertised, local, checked, acceptUrls, store, stderr);
6271
+ if (decision.created) changed = true;
6272
+ if (decision.localName === void 0) continue;
6273
+ const accepted = {
6274
+ ...advertised,
6275
+ localName: decision.localName
6276
+ };
6277
+ accepting.push(accepted);
6278
+ const mine = current.find((p) => p.name === accepted.localName);
6279
+ if (!mine || storedFields.length === 0) continue;
6280
+ if (storedFields.includes("partialCloneFilter") && advertised.filter !== void 0 && validFilter(advertised.filter, accepted.localName, stderr)) changed = storeField(store, accepted.localName, "filter", "partialCloneFilter", advertised.filter, mine.filter, stderr) || changed;
6281
+ if (storedFields.includes("token") && advertised.token !== void 0 && validToken(advertised.token, accepted.localName, stderr)) changed = storeField(store, accepted.localName, "token", "token", advertised.token, mine.token, stderr) || changed;
6006
6282
  }
6007
6283
  if (changed) await store.save();
6284
+ if (accepting.length === 0) return void 0;
6285
+ if (options.remember === false) return encodePromisorRemoteNames(accepting.map((r) => r.name));
6008
6286
  const promisors = new Set(promisorRemotes(RemoteConfigStore.from(workingCopy)).map((r) => r.name));
6009
6287
  const key = keyOf(workingCopy);
6010
6288
  const set = accepted.get(key) ?? /* @__PURE__ */ new Set();
6011
- for (const r of accepting) if (promisors.has(r.name)) set.add(r.name);
6289
+ const filters = advertisedFilters.get(key) ?? /* @__PURE__ */ new Map();
6290
+ for (const r of accepting) {
6291
+ if (!promisors.has(r.localName)) continue;
6292
+ set.add(r.localName);
6293
+ if (r.filter !== void 0) filters.set(r.localName, r.filter);
6294
+ }
6012
6295
  accepted.set(key, set);
6296
+ advertisedFilters.set(key, filters);
6013
6297
  return encodePromisorRemoteNames(accepting.map((r) => r.name));
6014
6298
  };
6015
6299
  }
6300
+ /**
6301
+ * git's `promisor_remote_construct_filter`: the filter `--filter=auto` stands for, from the
6302
+ * promisor remotes (in config order) a server's `promisor-remote` made this repository accept
6303
+ * that advertised one, expanded (`blob:limit=5k` as `blob:limit=5120`); undefined when none
6304
+ * did. An invalid one is skipped with git's warning.
6305
+ *
6306
+ * @throws Error where git hits its `BUG()`: two accepted remotes advertising valid filters
6307
+ */
6308
+ function promisorAutoFilter(workingCopy, stderr) {
6309
+ const key = keyOf(workingCopy);
6310
+ const acceptedNames = accepted.get(key);
6311
+ const filters = advertisedFilters.get(key);
6312
+ if (!acceptedNames || !filters) return void 0;
6313
+ let result;
6314
+ for (const { name } of promisorRemotes(RemoteConfigStore.from(workingCopy))) {
6315
+ const filter = filters.get(name);
6316
+ if (!acceptedNames.has(name) || filter === void 0) continue;
6317
+ let parsed;
6318
+ try {
6319
+ parsed = parseObjectFilter(filter);
6320
+ } catch (error) {
6321
+ stderr(`warning: promisor remote '${name}' advertised invalid filter '${filter}': ${error instanceof ObjectFilterError ? error.message : String(error)}`);
6322
+ continue;
6323
+ }
6324
+ if (result !== void 0) throw new Error("BUG: filter_options already populated");
6325
+ result = parsed.choice === "blob:limit" ? `blob:limit=${parsed.limit}` : filter;
6326
+ }
6327
+ return result;
6328
+ }
6016
6329
  /** accept_from_server: the last `promisor.acceptFromServer`, case-insensitive. */
6017
6330
  function acceptPolicyOf(store, stderr) {
6018
6331
  const value = store.value("promisor.acceptfromserver");
@@ -6046,17 +6359,155 @@ function configuredPromisors(store, fields) {
6046
6359
  }
6047
6360
  return out;
6048
6361
  }
6049
- /** should_accept_remote (without `promisor.acceptFromServerUrl`). */
6050
- function shouldAccept(policy, advertised, local, checked, stderr) {
6362
+ /** should_accept_remote: the name the advertised remote is accepted under, if it is. */
6363
+ function shouldAccept(policy, advertised, local, checked, acceptUrls, store, stderr) {
6364
+ const yes = (ok) => ok ? { localName: advertised.name } : {};
6051
6365
  const mine = local.find((p) => p.name === advertised.name);
6052
- if (!mine) return policy === "all" && allFieldsMatch(advertised, local, void 0, checked);
6053
- if (policy === "all") return allFieldsMatch(advertised, local, void 0, checked);
6054
- if (policy === "knownName") return allFieldsMatch(advertised, local, mine, checked);
6366
+ if (!mine) {
6367
+ const allowed = urlMatchesAcceptList(acceptUrls, advertised.url);
6368
+ if (allowed) {
6369
+ const name = handleMatchingAllowedUrl(store, allowed.remoteName, advertised, stderr);
6370
+ if (name !== void 0) return {
6371
+ localName: name,
6372
+ created: true
6373
+ };
6374
+ }
6375
+ return yes(policy === "all" && allFieldsMatch(advertised, local, void 0, checked));
6376
+ }
6377
+ if (mine.url === advertised.url && urlMatchesAcceptList(acceptUrls, advertised.url)) return yes(allFieldsMatch(advertised, local, mine, checked));
6378
+ if (policy === "all") return yes(allFieldsMatch(advertised, local, void 0, checked));
6379
+ if (policy === "knownName") return yes(allFieldsMatch(advertised, local, mine, checked));
6055
6380
  if (mine.url !== advertised.url) {
6056
6381
  stderr(`warning: known remote named '${advertised.name}' but with URL '${mine.url}' instead of '${advertised.url}', ignoring this remote`);
6057
- return false;
6382
+ return {};
6383
+ }
6384
+ return yes(policy === "knownUrl" && allFieldsMatch(advertised, local, mine, checked));
6385
+ }
6386
+ /** git's iscntrl over the bytes of a string (C locale). */
6387
+ function hasControlChar(text) {
6388
+ return /[\x00-\x1f\x7f]/.test(text);
6389
+ }
6390
+ /** valid_remote_name: `refs/remotes/<name>/test` a valid ref name (in a valid refspec). */
6391
+ function validRemoteName(name) {
6392
+ return name.length > 0 && isValidRefName(`refs/remotes/${name}/test`);
6393
+ }
6394
+ /** load_accept_from_server_url and valid_accept_url: the valid entries, in config order. */
6395
+ function loadAcceptFromServerUrl(store, stderr) {
6396
+ const out = [];
6397
+ for (const entry of store.values("promisor.acceptfromserverurl")) {
6398
+ const eq = entry.indexOf("=");
6399
+ let remoteName;
6400
+ let pattern = entry;
6401
+ if (eq >= 0) {
6402
+ remoteName = entry.slice(0, eq);
6403
+ if (!validRemoteName(remoteName)) {
6404
+ stderr(`warning: invalid remote name '${remoteName}' before '=' sign in '${entry}' from promisor.acceptFromServerUrl config`);
6405
+ continue;
6406
+ }
6407
+ pattern = entry.slice(eq + 1);
6408
+ }
6409
+ const normalized = hasControlChar(pattern) ? void 0 : normalizeUrl(pattern, { allowGlobs: true });
6410
+ if (normalized === void 0 || isUrlNormalizeError(normalized)) {
6411
+ stderr(`warning: invalid url pattern '${pattern}' in '${entry}' from promisor.acceptFromServerUrl config`);
6412
+ continue;
6413
+ }
6414
+ out.push({
6415
+ ...remoteName !== void 0 ? { remoteName } : {},
6416
+ pattern: normalized
6417
+ });
6058
6418
  }
6059
- return policy === "knownUrl" && allFieldsMatch(advertised, local, mine, checked);
6419
+ return out;
6420
+ }
6421
+ /** A byte string (one character per byte, as `normalizeUrl` gives) as its bytes. */
6422
+ function bytesOf$2(text) {
6423
+ const out = new Uint8Array(text.length);
6424
+ for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 255;
6425
+ return out;
6426
+ }
6427
+ /** match_one_url: scheme and port exactly, host and path each through wildmatch. */
6428
+ function matchOneUrl(p, u) {
6429
+ if (p.schemeLength !== u.schemeLength || p.url.slice(0, p.schemeLength) !== u.url.slice(0, u.schemeLength)) return false;
6430
+ const part = (n, offset, length) => n.url.slice(offset, offset + length);
6431
+ if (p.portLength !== u.portLength || part(p, p.portOffset, p.portLength) !== part(u, u.portOffset, u.portLength)) return false;
6432
+ return wildmatchBytes(bytesOf$2(part(p, p.hostOffset, p.hostLength)), bytesOf$2(part(u, u.hostOffset, u.hostLength))) && wildmatchBytes(bytesOf$2(part(p, p.pathOffset, p.pathLength)), bytesOf$2(part(u, u.pathOffset, u.pathLength)));
6433
+ }
6434
+ /** url_matches_accept_list: the first entry matching the (normalized) URL. */
6435
+ function urlMatchesAcceptList(acceptUrls, url) {
6436
+ if (acceptUrls.length === 0) return void 0;
6437
+ const normalized = normalizeUrl(url);
6438
+ if (isUrlNormalizeError(normalized)) return void 0;
6439
+ return acceptUrls.find((a) => matchOneUrl(a.pattern, normalized));
6440
+ }
6441
+ /** isalnum in the C locale */
6442
+ const isAlnum$4 = (c) => /^[A-Za-z0-9]$/.test(c);
6443
+ /** promisor_remote_name_from_url and sanitize_remote_name. */
6444
+ function promisorRemoteNameFromUrl(url, stderr) {
6445
+ const n = normalizeUrl(url);
6446
+ if (isUrlNormalizeError(n)) {
6447
+ stderr(`warning: couldn't normalize advertised url '${url}', ignoring this remote`);
6448
+ return;
6449
+ }
6450
+ let buf = "";
6451
+ if (n.hostLength) buf += `${n.url.slice(n.hostOffset, n.hostOffset + n.hostLength)}-`;
6452
+ if (n.portLength) buf += `${n.url.slice(n.portOffset, n.portOffset + n.portLength)}-`;
6453
+ if (n.pathLength) {
6454
+ let path = n.url.slice(n.pathOffset, n.pathOffset + n.pathLength);
6455
+ path = path.replace(/\/+$/, "");
6456
+ if (path.endsWith(".git")) path = path.slice(0, -4);
6457
+ buf += path;
6458
+ }
6459
+ let out = "";
6460
+ let prev = "-";
6461
+ for (const ch of buf) {
6462
+ const c = isAlnum$4(ch) ? ch : "-";
6463
+ if (prev === "-" && c === "-") continue;
6464
+ out += c;
6465
+ prev = c;
6466
+ }
6467
+ if (out.endsWith("-")) out = out.slice(0, -1);
6468
+ if (out === "") {
6469
+ stderr(`warning: couldn't generate a valid remote name from advertised url '${url}', ignoring this remote`);
6470
+ return;
6471
+ }
6472
+ out = `promisor-auto-${out}`;
6473
+ if (!validRemoteName(out)) {
6474
+ stderr(`warning: generated remote name '${out}' from advertised url '${url}' is invalid, ignoring this remote`);
6475
+ return;
6476
+ }
6477
+ return out;
6478
+ }
6479
+ const MAX_REMOTES_WITH_SIMILAR_NAMES = 20;
6480
+ /**
6481
+ * handle_matching_allowed_url and configure_auto_promisor_remote: the name the remote gets
6482
+ * (a free one, or one already holding the URL, reused), written to the configuration.
6483
+ */
6484
+ function handleMatchingAllowedUrl(store, allowedName, advertised, stderr) {
6485
+ const basename = allowedName ?? promisorRemoteNameFromUrl(advertised.url, stderr);
6486
+ if (basename === void 0) return void 0;
6487
+ let name = basename;
6488
+ let reuse = false;
6489
+ let i = 0;
6490
+ while (i < MAX_REMOTES_WITH_SIMILAR_NAMES) {
6491
+ const existing = store.value(`remote.${name}.url`);
6492
+ if (existing === void 0) break;
6493
+ if (existing === advertised.url) {
6494
+ reuse = true;
6495
+ break;
6496
+ }
6497
+ i++;
6498
+ name = `${basename}-${i}`;
6499
+ }
6500
+ if (i >= MAX_REMOTES_WITH_SIMILAR_NAMES) {
6501
+ stderr(`warning: too many remotes accepted with name like '${basename}-X', ignoring this remote`);
6502
+ return;
6503
+ }
6504
+ if (!reuse) {
6505
+ stderr(`Auto-creating promisor remote '${name}' for URL '${advertised.url}'`);
6506
+ store.setValue(`remote.${name}.url`, advertised.url);
6507
+ }
6508
+ store.setValue(`remote.${name}.promisor`, "true");
6509
+ store.setValue(`remote.${name}.advertisedAs`, advertised.name);
6510
+ return name;
6060
6511
  }
6061
6512
  /** all_fields_match: every checked field advertised and equal to one remote's (or `mine`'s). */
6062
6513
  function allFieldsMatch(advertised, local, mine, checked) {
@@ -6213,7 +6664,7 @@ function createPromisorFetcher(workingCopy, options = {}) {
6213
6664
  const history = historyWithoutLazyFetch(workingCopy.history);
6214
6665
  const compatibility = compatibilityOf();
6215
6666
  const run = async () => {
6216
- const { fetchFsckOf } = await import("./fsck-tbrPZX2q.js").then((n) => n.t);
6667
+ const { fetchFsckOf } = await import("./fsck-BZ508Elg.js").then((n) => n.t);
6217
6668
  const environment = hostEnvironmentOf(workingCopy);
6218
6669
  const fsckWarnings = [];
6219
6670
  const unpackLimit = unpackLimitOf({ getAll: (key) => config.values(key) }, "fetch");
@@ -6227,13 +6678,32 @@ function createPromisorFetcher(workingCopy, options = {}) {
6227
6678
  home: environment.home
6228
6679
  } : {}
6229
6680
  });
6230
- const { prepareRemote, protocolVersionOf, withRemoteUploadPack } = await import("./remote-transport-C0OSJtor.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);
6231
6683
  await withRemoteUploadPack(await prepareRemote(workingCopy, url, options.transports ?? createDefaultTransports()), {
6232
6684
  ...options.credentials ? { credentials: options.credentials } : {},
6233
6685
  ...options.headers ? { headers: options.headers } : {},
6234
6686
  ...options.timeout !== void 0 ? { timeout: options.timeout } : {},
6235
6687
  protocolVersion: protocolVersionOf(config),
6236
- httpSettings: (remoteUrl) => httpClientSettingsOf(config, remoteUrl, environment, { compatibility })
6688
+ httpSettings: (remoteUrl) => {
6689
+ const settings = httpClientSettingsOf(config, remoteUrl, environment, {
6690
+ compatibility,
6691
+ ...options.warningCallback ? { onWarning: options.warningCallback } : {}
6692
+ });
6693
+ return options.warningCallback ? {
6694
+ ...settings,
6695
+ onWarning: options.warningCallback
6696
+ } : settings;
6697
+ },
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
+ })
6237
6707
  }, async (connection) => {
6238
6708
  try {
6239
6709
  await fetchPromisedObjects(connection, {
@@ -6241,6 +6711,7 @@ function createPromisorFetcher(workingCopy, options = {}) {
6241
6711
  ids,
6242
6712
  filter: "blob:none",
6243
6713
  url: anonymizeUrl(url),
6714
+ promisorRemote: promisorRemoteReplyOf(workingCopy, (line) => promisor()?.warnings.push(line), { remember: false }),
6244
6715
  compatibility,
6245
6716
  ...fsck ? { fsckObjects: fsck } : {},
6246
6717
  ...unpackLimit !== void 0 ? { unpackLimit } : {}
@@ -7893,6 +8364,88 @@ function coloredHunkHeader(line, c) {
7893
8364
  return hunkHeader(line, c).done();
7894
8365
  }
7895
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
7896
8449
  //#region src/results/diff-words.ts
7897
8450
  /**
7898
8451
  * git's word diff (diff.c's `diff_words_*` and `fn_out_diff_words_*`): `--word-diff=plain`,
@@ -7914,9 +8467,13 @@ function coloredHunkHeader(line, c) {
7914
8467
  * mode, one `-`/`+`/` ` line per piece with `~` for each newline in porcelain mode. Context
7915
8468
  * lines are printed without their sign (porcelain: with it, followed by `~`).
7916
8469
  *
7917
- * Not reproduced: under `log --graph` git writes the graph's line prefix in word mode only
7918
- * where a word hunk starts on a new line or a piece's text has a newline, so porcelain lines
7919
- * (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.
7920
8477
  *
7921
8478
  * @module
7922
8479
  */
@@ -8001,25 +8558,75 @@ var Pieces = class {
8001
8558
  * Prints the piece as `DIFF_SYMBOL_WORD_DIFF` does (`fprintf("%.*s")`): up to its first NUL
8002
8559
  * byte, whatever follows (suffix, reset, newline) dropped with it
8003
8560
  */
8004
- flushTo(sink) {
8561
+ flushTo(sink, prefix) {
8562
+ const out = (b) => prefix ? prefix.push(sink, b) : sink.push(b);
8005
8563
  for (const p of this.parts) {
8006
8564
  const nul = p.indexOf(0);
8007
8565
  if (nul < 0) {
8008
- sink.push(p);
8566
+ out(p);
8009
8567
  continue;
8010
8568
  }
8011
- if (nul > 0) sink.push(p.subarray(0, nul));
8569
+ if (nul > 0) out(p.subarray(0, nul));
8012
8570
  break;
8013
8571
  }
8014
8572
  this.parts = [];
8015
8573
  }
8016
8574
  };
8017
- /** `fn_out_diff_words_write_helper`: `text` as pieces of `el`, `newline` for each LF */
8018
- 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) {
8019
8624
  const sb = new Pieces();
8625
+ let print = false;
8020
8626
  let at = 0;
8021
8627
  let count = text.length;
8022
8628
  while (count > 0) {
8629
+ if (print) prefix?.add();
8023
8630
  const nl = text.subarray(at, at + count).indexOf(NEWLINE$1);
8024
8631
  if (nl !== 0) {
8025
8632
  const colored = el.color !== void 0 && el.color !== "";
@@ -8033,9 +8640,10 @@ function writeHelper(sink, el, newline, text) {
8033
8640
  sb.bytes(newline);
8034
8641
  count -= nl + 1;
8035
8642
  at += nl + 1;
8036
- if (count > 0) sb.flushTo(sink);
8643
+ print = true;
8644
+ if (count > 0) sb.flushTo(sink, prefix);
8037
8645
  }
8038
- sb.flushTo(sink);
8646
+ sb.flushTo(sink, prefix);
8039
8647
  }
8040
8648
  /** `find_word_boundaries`: the next word at or after `begin`, or undefined */
8041
8649
  function findWord(text, regex, start) {
@@ -8086,12 +8694,18 @@ function fillWords(text, regex) {
8086
8694
  var WordDiffState = class {
8087
8695
  sink;
8088
8696
  regex;
8697
+ prefix;
8089
8698
  minus = [];
8090
8699
  plus = [];
8091
8700
  style;
8092
- 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) {
8093
8706
  this.sink = sink;
8094
8707
  this.regex = regex;
8708
+ this.prefix = prefix;
8095
8709
  this.style = styleOf(mode, colors);
8096
8710
  }
8097
8711
  /** `diff_words_append`: a line without its sign, its LF included */
@@ -8102,6 +8716,17 @@ var WordDiffState = class {
8102
8716
  flush() {
8103
8717
  if (this.minus.length > 0 || this.plus.length > 0) this.show();
8104
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
+ }
8105
8730
  /** `diff_words_show` */
8106
8731
  show() {
8107
8732
  const minus = concat$4(this.minus);
@@ -8109,11 +8734,14 @@ var WordDiffState = class {
8109
8734
  this.minus = [];
8110
8735
  this.plus = [];
8111
8736
  const style = this.style;
8737
+ const prefix = this.prefix;
8112
8738
  if (plus.length === 0) {
8113
- writeHelper(this.sink, style.oldWord, style.newline, minus);
8739
+ this.writePrefix();
8740
+ writeHelper(this.sink, style.oldWord, style.newline, minus, prefix);
8114
8741
  return;
8115
8742
  }
8116
- let currentPlus = 0;
8743
+ this.currentPlus = 0;
8744
+ this.lastMinus = 0;
8117
8745
  const mw = fillWords(minus, this.regex);
8118
8746
  const pw = fillWords(plus, this.regex);
8119
8747
  for (const change of xdiffHunks(mw.lines, pw.lines)) {
@@ -8121,12 +8749,18 @@ var WordDiffState = class {
8121
8749
  const plusFirst = change.chg2 ? change.i2 + 1 : change.i2;
8122
8750
  const [minusBegin, minusEnd] = span(mw.orig, minusFirst, change.chg1);
8123
8751
  const [plusBegin, plusEnd] = span(pw.orig, plusFirst, change.chg2);
8124
- if (currentPlus !== plusBegin) writeHelper(this.sink, style.ctx, style.newline, plus.subarray(currentPlus, plusBegin));
8125
- if (minusBegin !== minusEnd) writeHelper(this.sink, style.oldWord, style.newline, minus.subarray(minusBegin, minusEnd));
8126
- if (plusBegin !== plusEnd) writeHelper(this.sink, style.newWord, style.newline, plus.subarray(plusBegin, plusEnd));
8127
- 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);
8128
8763
  }
8129
- if (currentPlus !== plus.length) writeHelper(this.sink, style.ctx, style.newline, plus.subarray(currentPlus));
8130
8764
  }
8131
8765
  };
8132
8766
  /** The text a hunk of words covers: from its first word's start to its last word's end */
@@ -8150,19 +8784,17 @@ function concat$4(parts) {
8150
8784
  return out;
8151
8785
  }
8152
8786
  /** diff.c's `emit_line_0` without a sign: `set` before the text, the reset after it */
8153
- function emitLine(sink, set, reset, line) {
8787
+ function emitLine(set, reset, line) {
8154
8788
  let len = line.length;
8155
- const hasNewline = len > 0 && line[len - 1] === NEWLINE$1;
8156
- if (hasNewline) len--;
8157
- const hasCr = len > 0 && line[len - 1] === 13;
8158
- if (hasCr) len--;
8159
- if (len > 0) {
8160
- if (set) sink.push(enc$1(set));
8161
- sink.push(line.subarray(0, len));
8162
- if (reset) sink.push(enc$1(reset));
8163
- }
8164
- if (hasCr) sink.push(Uint8Array.of(13));
8165
- 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
+ ]);
8166
8798
  }
8167
8799
  /**
8168
8800
  * The hunks of a text pair as diff.c's `fn_out_consume` prints them under `--word-diff`:
@@ -8173,12 +8805,15 @@ function emitLine(sink, set, reset, line) {
8173
8805
  */
8174
8806
  function writeWordDiffHunks(sink, hunks, options) {
8175
8807
  const colors = options.colors;
8176
- 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);
8177
8812
  const context = colors?.context ?? "";
8178
8813
  const reset = colors?.reset ?? "";
8179
8814
  for (const hunk of hunks) {
8180
8815
  state.flush();
8181
- sink.push(colors ? coloredHunkHeader(hunk.header, colors) : hunk.header);
8816
+ emit(colors ? coloredHunkHeader(hunk.header, colors) : hunk.header);
8182
8817
  for (const line of hunk.lines) {
8183
8818
  const bytes = line.bytes;
8184
8819
  const text = bytes.length > 0 && bytes[bytes.length - 1] !== NEWLINE$1 ? withNewline$1(bytes) : bytes;
@@ -8188,9 +8823,10 @@ function writeWordDiffHunks(sink, hunks, options) {
8188
8823
  }
8189
8824
  state.flush();
8190
8825
  if (options.mode === "porcelain") {
8191
- emitLine(sink, context, reset, concat$4([Uint8Array.of(32), text]));
8192
- sink.push(TILDE_LINE);
8193
- } 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));
8194
8830
  }
8195
8831
  }
8196
8832
  state.flush();
@@ -8760,7 +9396,8 @@ async function builtinDiff(sink, pair, options, absentPath, report) {
8760
9396
  writeWordDiffHunks(sink, coloredHunksOf(result), {
8761
9397
  mode: wordDiff,
8762
9398
  ...pattern !== void 0 ? { regex: compileWordRegex(pattern) } : {},
8763
- ...colors ? { colors } : {}
9399
+ ...colors ? { colors } : {},
9400
+ ...options.linePrefix ? { linePrefix: options.linePrefix } : {}
8764
9401
  });
8765
9402
  return;
8766
9403
  }
@@ -12428,11 +13065,29 @@ async function parseRevisionAndPathArgs(resolver, args, files, options) {
12428
13065
  const revisions = dashdash < 0 ? args : args.slice(0, dashdash);
12429
13066
  const paths = dashdash < 0 ? [] : args.slice(dashdash + 1);
12430
13067
  let not = false;
12431
- for (const [i, arg] of revisions.entries()) {
12432
- 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") {
12433
13077
  not = !not;
12434
13078
  continue;
12435
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
+ }
12436
13091
  const handled = await handleRevisionArg(resolver, arg, not, options, entries, dashdash >= 0);
12437
13092
  if (handled === false) {
12438
13093
  if (dashdash >= 0 || arg.startsWith("^")) throw new RevisionError(arg, [...resolver.warnings, `fatal: bad revision '${arg}'`].join("\n"));
@@ -12440,6 +13095,7 @@ async function parseRevisionAndPathArgs(resolver, args, files, options) {
12440
13095
  return {
12441
13096
  entries,
12442
13097
  warnings: resolver.warnings,
13098
+ inputGiven: state.inputGiven || entries.length > 0,
12443
13099
  paths: [...revisions.slice(i), ...paths]
12444
13100
  };
12445
13101
  }
@@ -12451,6 +13107,7 @@ async function parseRevisionAndPathArgs(resolver, args, files, options) {
12451
13107
  return {
12452
13108
  entries,
12453
13109
  warnings: resolver.warnings,
13110
+ inputGiven: state.inputGiven || entries.length > 0,
12454
13111
  paths
12455
13112
  };
12456
13113
  }
@@ -12926,6 +13583,12 @@ var RevisionResolver = class {
12926
13583
  * name that read no entry (`S_IFINVALID`), `<rev>:` (the tree itself) included
12927
13584
  */
12928
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;
12929
13592
  config;
12930
13593
  disambiguateChecked = false;
12931
13594
  /**
@@ -12956,8 +13619,12 @@ var RevisionResolver = class {
12956
13619
  async resolve(name, options = {}) {
12957
13620
  this.checkDisambiguateConfig(name);
12958
13621
  this.lastMode = void 0;
13622
+ this.lastPath = void 0;
12959
13623
  const direct = await this.oid1(name, options);
12960
- 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
+ }
12961
13628
  if (name.startsWith(":")) {
12962
13629
  if (!options.onlyToDie && name.length > 2 && name[1] === "/") return this.oneline(name.slice(2), await this.allRefCommits());
12963
13630
  let stage = 0;
@@ -12967,6 +13634,7 @@ var RevisionResolver = class {
12967
13634
  path = name.slice(3);
12968
13635
  }
12969
13636
  const resolved = this.relativePath(path, name);
13637
+ this.lastPath = resolved;
12970
13638
  const found = await this.indexEntry(resolved, stage);
12971
13639
  if (found === void 0 && options.onlyToDie && name.length > 1 && name[1] !== "/") await this.diagnoseIndexPath(name, stage, resolved);
12972
13640
  return found;
@@ -12989,6 +13657,7 @@ var RevisionResolver = class {
12989
13657
  return;
12990
13658
  }
12991
13659
  const filename = this.relativePath(name.slice(i + 1), name);
13660
+ this.lastPath = filename;
12992
13661
  const tree = await this.peelToType(treeish, "tree");
12993
13662
  const found = tree === void 0 ? void 0 : await this.treeEntry(tree, filename);
12994
13663
  if (found === void 0 && options.onlyToDie) await this.diagnoseTreePath(name, objectName, tree, filename);
@@ -14016,6 +14685,36 @@ async function safe(fn) {
14016
14685
  }
14017
14686
  }
14018
14687
  //#endregion
14688
+ //#region src/commands/split-cmdline.ts
14689
+ /**
14690
+ * alias.c's split_cmdline: words split on whitespace, quotes removed, a backslash escaping
14691
+ * the next character outside single quotes; split_cmdline_strerror's text on an error.
14692
+ */
14693
+ function splitCmdline(line) {
14694
+ const args = [];
14695
+ let current = "";
14696
+ let quoted = "";
14697
+ for (let i = 0; i < line.length; i++) {
14698
+ const c = line[i];
14699
+ if (!quoted && /[ \t\n\r]/.test(c)) {
14700
+ args.push(current);
14701
+ current = "";
14702
+ while (i + 1 < line.length && /[ \t\n\r]/.test(line[i + 1])) i++;
14703
+ } else if (!quoted && (c === "'" || c === "\"")) quoted = c;
14704
+ else if (c === quoted) quoted = "";
14705
+ else {
14706
+ if (c === "\\" && quoted !== "'") {
14707
+ i++;
14708
+ if (i >= line.length) return "cmdline ends with \\";
14709
+ }
14710
+ current += line[i];
14711
+ }
14712
+ }
14713
+ if (quoted) return "unclosed quote";
14714
+ args.push(current);
14715
+ return args;
14716
+ }
14717
+ //#endregion
14019
14718
  //#region src/commands/signing.ts
14020
14719
  /**
14021
14720
  * Requests to sign (`commit -S`, `commit.gpgSign`, `tag -s`/`-u`, `tag.gpgSign`,
@@ -14030,8 +14729,9 @@ async function safe(fn) {
14030
14729
  * `commit_tree_extended` / `add_header_signature` do. `commit -S` and `tag -s`/`-u` sign (the
14031
14730
  * tag's signature appended to its message, builtin/tag.c's `do_sign`), and so do the
14032
14731
  * commands that write commits for the user: rebase, cherry-pick, revert, merge and am
14033
- * (statewalker/statewalker-root#319, each through {@link signCommit}); push certificates
14034
- * 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}.
14035
14735
  *
14036
14736
  * Without a signer every request to sign fails as native git fails when its signing program
14037
14737
  * cannot sign (gpg-interface.c `sign_buffer_gpg`: `error: gpg failed to sign the data:` with
@@ -14385,33 +15085,75 @@ function sshPublicKeyBlob(text) {
14385
15085
  const field = text.split("\n").find((l) => l.trim() !== "" && !l.startsWith("#"))?.trim().split(/\s+/)[1];
14386
15086
  return field ? base64Bytes(field) : void 0;
14387
15087
  }
15088
+ /** gpg-interface.c's `is_literal_ssh_key`: the key itself rather than a file naming it. */
15089
+ function isLiteralSshKey(key) {
15090
+ return key.startsWith("key::") || key.startsWith("ssh-");
15091
+ }
15092
+ /**
15093
+ * gpg-interface.c's `get_default_ssh_signing_key` (as `get_signing_key_id` runs it): the
15094
+ * first line of `command`'s output, newline kept, when it is a literal key. git goes on with
15095
+ * a NULL key when it is not and crashes in `get_ssh_key_fingerprint` (SIGSEGV) after its
15096
+ * warning: that is thrown with exit status 139.
15097
+ */
15098
+ async function defaultSshSigningKey(command, sign, host) {
15099
+ const argv = splitCmdline(command);
15100
+ if (typeof argv === "string") throw new SigningFailedError(`fatal: malformed build-time gpg.ssh.defaultKeyCommand: ${argv}`, sign, 128);
15101
+ const program = argv[0] ?? "";
15102
+ const messages = [];
15103
+ let ran;
15104
+ if (program === "") messages.push("error: cannot run : No such file or directory");
15105
+ else {
15106
+ ran = await host?.runArgv("gpg.ssh.defaultKeyCommand", argv);
15107
+ if (ran?.startError !== void 0) messages.push(ran.startError);
15108
+ }
15109
+ const stdout = ran?.stdout ?? "";
15110
+ const stderr = ran?.stderr ?? "";
15111
+ if (ran?.exitCode === 0) {
15112
+ const nl = stdout.indexOf("\n");
15113
+ const first = nl < 0 ? stdout : stdout.slice(0, nl + 1);
15114
+ if (first !== "" && isLiteralSshKey(first)) return first;
15115
+ messages.push(`warning: gpg.ssh.defaultKeyCommand succeeded but returned no keys: ${stderr} ${stdout}`);
15116
+ } else messages.push(`warning: gpg.ssh.defaultKeyCommand failed: ${stderr} ${stdout}`);
15117
+ throw new SigningFailedError(messages.join("\n"), sign, 139);
15118
+ }
14388
15119
  /**
14389
15120
  * gpg-interface.c's `get_signing_key_id()` for `sign` (`""`: the default key): the key of an
14390
15121
  * openpgp or x509 signature (`user.signingKey`, else the committer as `Name <email>`), the
14391
15122
  * SHA-256 fingerprint of an ssh key (`ssh-keygen -lf`'s `SHA256:...`, for a literal key, a
14392
- * public key file or an OpenSSH private key file).
15123
+ * public key file or an OpenSSH private key file). Without a key, ssh's comes from
15124
+ * `gpg.ssh.defaultKeyCommand` (`get_default_ssh_signing_key`), run through `options.host`. A
15125
+ * key file is read as `ssh-keygen -lf <key>` reads it in the directory git runs in: a relative
15126
+ * path from the worktree top, `~/` not expanded (git passes the key as configured).
14393
15127
  *
14394
15128
  * @throws SigningFailedError as git dies when it cannot fingerprint an ssh key (`fatal: failed
14395
15129
  * to get the ssh fingerprint for key '<key>'`), or has none
14396
15130
  */
14397
- async function signingKeyIdOf(workingCopy, sign, committer) {
15131
+ async function signingKeyIdOf(workingCopy, sign, committer, options = {}) {
14398
15132
  const config = signingConfigOf(workingCopy);
14399
- const key = sign !== "" ? sign : config.signingKey;
15133
+ let key = sign !== "" ? sign : config.signingKey;
14400
15134
  if (config.format !== "ssh") return key ?? `${committer.name} <${committer.email}>`;
14401
- if (key === void 0) throw new SigningFailedError("fatal: either user.signingkey or gpg.ssh.defaultKeyCommand needs to be configured", sign, 128);
15135
+ if (key === void 0) {
15136
+ if (config.defaultKeyCommand === void 0) throw new SigningFailedError("fatal: either user.signingkey or gpg.ssh.defaultKeyCommand needs to be configured", sign, 128);
15137
+ key = await defaultSshSigningKey(config.defaultKeyCommand, sign, options.host);
15138
+ }
14402
15139
  let text;
14403
15140
  if (key.startsWith("key::")) text = key.slice(5);
14404
15141
  else if (key.startsWith("ssh-")) text = key;
14405
15142
  else {
14406
15143
  const environment = hostEnvironmentOf(workingCopy);
14407
- const path = expandUserPath(key, environment) ?? key;
15144
+ let path = key;
15145
+ if (!path.startsWith("/")) {
15146
+ const cwd = await options.host?.hostWorkingDirectory().catch(() => void 0);
15147
+ if (cwd !== void 0) path = `${cwd.replace(/\/+$/, "")}/${path}`;
15148
+ }
14408
15149
  const bytes = await environment?.readFile(path).catch(() => void 0);
14409
15150
  text = bytes ? new TextDecoder().decode(bytes) : void 0;
14410
15151
  }
14411
15152
  const blob = text === void 0 ? void 0 : sshPublicKeyBlob(text);
14412
- if (!blob) throw new SigningFailedError(`fatal: failed to get the ssh fingerprint for key '${key}'`, sign, 128);
15153
+ if (!blob) throw new SigningFailedError(`fatal: failed to get the ssh fingerprint for key '${key}': Success`, sign, 128);
14413
15154
  const digest = createSha256().update(blob).digest();
14414
- return `SHA256:${btoa(String.fromCharCode(...digest)).replace(/=+$/, "")}`;
15155
+ const fingerprint = `SHA256:${btoa(String.fromCharCode(...digest)).replace(/=+$/, "")}`;
15156
+ return options.compatibility === "2.43" ? `${fingerprint} ` : fingerprint;
14415
15157
  }
14416
15158
  //#endregion
14417
15159
  //#region src/git-command.ts
@@ -14591,6 +15333,69 @@ var GitCommand = class {
14591
15333
  const promisor = promisorOf(workingCopy);
14592
15334
  if (promisor && !promisor.fetcher) promisor.setFetcher(createPromisorFetcher(workingCopy));
14593
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
+ }
14594
15399
  }
14595
15400
  /**
14596
15401
  * Each entry point of the command (`call`, `callText`, ...) puts back the ref store's
@@ -14631,11 +15436,11 @@ var GitCommand = class {
14631
15436
  try {
14632
15437
  result = method.apply(this, args);
14633
15438
  } catch (error) {
14634
- leave?.();
15439
+ Promise.resolve(leave?.()).catch(() => {});
14635
15440
  throw error;
14636
15441
  }
14637
15442
  if (leave && result && typeof result.finally === "function") return result.finally(leave);
14638
- leave?.();
15443
+ Promise.resolve(leave?.()).catch(() => {});
14639
15444
  return result;
14640
15445
  };
14641
15446
  }
@@ -15593,6 +16398,29 @@ var GitCommand = class {
15593
16398
  }
15594
16399
  }
15595
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
+ /**
15596
16424
  * A resolver for git's revision syntax over this command's stores (see
15597
16425
  * {@link RevisionResolver}); its `warnings` hold what git would print.
15598
16426
  */
@@ -17000,19 +17828,37 @@ let StashApplyStatus = /* @__PURE__ */ function(StashApplyStatus) {
17000
17828
  * where it would overwrite local changes or untracked files, then the conflicts staged).
17001
17829
  */
17002
17830
  const sameEntry$3 = (a, b) => a === void 0 || b === void 0 ? a === b : a.objectId === b.objectId && a.mode === b.mode;
17003
- /** The blobs, links and gitlinks of a tree, by path (none for no tree). */
17004
- async function flatTree(trees, treeId) {
17831
+ /**
17832
+ * The blobs, links and gitlinks of a tree, by path (none for no tree).
17833
+ *
17834
+ * @param options.asIndex The entries as unpack-trees adds them to an index
17835
+ * (`add_index_entry`'s `OK_TO_REPLACE`): a file the directory of its name follows in the
17836
+ * same tree (a crafted tree holding both, which fsck calls `duplicateEntries`) is dropped
17837
+ * once a file of that directory is read, so the map never holds a file/directory clash
17838
+ * (webrun-vcs#247)
17839
+ */
17840
+ async function flatTree(trees, treeId, options) {
17005
17841
  const out = /* @__PURE__ */ new Map();
17006
17842
  if (!treeId) return out;
17843
+ const asIndex = options?.asIndex === true;
17007
17844
  const walk = async (id, prefix) => {
17845
+ let added = false;
17008
17846
  for await (const entry of trees.loadTree(id)) {
17009
17847
  const path = prefix ? `${prefix}/${entry.name}` : entry.name;
17010
- if (entry.mode === FileMode.TREE) await walk(entry.id, path);
17011
- else out.set(path, {
17012
- objectId: entry.id,
17013
- mode: entry.mode
17014
- });
17848
+ if (entry.mode === FileMode.TREE) {
17849
+ if (await walk(entry.id, path)) {
17850
+ if (asIndex) out.delete(path);
17851
+ added = true;
17852
+ }
17853
+ } else {
17854
+ out.set(path, {
17855
+ objectId: entry.id,
17856
+ mode: entry.mode
17857
+ });
17858
+ added = true;
17859
+ }
17015
17860
  }
17861
+ return added;
17016
17862
  };
17017
17863
  await walk(treeId, "");
17018
17864
  return out;
@@ -17428,16 +18274,43 @@ async function writeIndexAsTree(staging, trees, format, options = {}) {
17428
18274
  * directories of intent-to-add entries left invalid; nothing where the index has conflicts.
17429
18275
  * Sets the cache-tree the next `write` writes.
17430
18276
  */
17431
- async function updateIndexCacheTree(staging, trees, format) {
18277
+ async function updateIndexCacheTree(staging, trees, format, onClash) {
17432
18278
  if (!staging.getCacheTree || !staging.setCacheTree) return;
17433
18279
  if (await staging.hasConflicts()) return;
17434
18280
  const previous = staging.getCacheTree();
17435
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
+ }
17436
18289
  const treeId = await staging.writeTree(trees);
17437
18290
  const cacheTree = await updateCacheTree(trees, treeId, previous, format);
17438
18291
  for (const entry of await indexEntryList(staging)) if (entry.intentToAdd) invalidateCacheTreeForIntentToAdd(cacheTree, entry.path);
17439
18292
  staging.setCacheTree(cacheTree);
17440
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
+ }
17441
18314
  /** Every index entry in the index's order, at once where the staging can give them so. */
17442
18315
  async function indexEntryList(staging) {
17443
18316
  const list = staging.entryList?.();
@@ -17691,26 +18564,62 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
17691
18564
  const subs = options.submodules;
17692
18565
  /** Paths whose submodule checks replace the untracked-file checks (verify_absent_1) */
17693
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
+ };
17694
18602
  const paths = [.../* @__PURE__ */ new Set([...head.keys(), ...target.keys()])].sort();
17695
18603
  for (const path of paths) {
18604
+ if (belowRefused(path, refused)) continue;
17696
18605
  const h = head.get(path);
17697
18606
  const t = target.get(path);
17698
- const i = index.get(path);
18607
+ const i = consumed.has(path) ? void 0 : index.get(path);
17699
18608
  if (sameEntry$3(h, t) && !(options.initialCheckout && t && !i)) continue;
17700
18609
  if (i) {
17701
18610
  if (t && sameEntry$3(i, t)) continue;
17702
18611
  if (!sameEntry$3(i, h)) {
17703
- staged.push(path);
18612
+ refuse(staged, path);
17704
18613
  continue;
17705
18614
  }
17706
18615
  if (subs && checked && !quiet(path) && i.mode === FileMode.GITLINK) {
17707
18616
  if (!t && update && await subs.isSubmodule(path, i) && await subs.exists(path)) await subs.refuses(path, (h ?? i).objectId, null);
17708
- const refused = await subs.notUptodate(path, i);
17709
- if (refused) {
17710
- local.push(path);
18617
+ const notUptodate = await subs.notUptodate(path, i);
18618
+ if (notUptodate) {
18619
+ refuse(local, path);
17711
18620
  continue;
17712
18621
  }
17713
- if (refused === false) {
18622
+ if (notUptodate === false) {
17714
18623
  if (t && t.mode !== FileMode.GITLINK) await subs.fileReplacesRefuses(path, i);
17715
18624
  if (t) await subs.mergedRefuses(path, i, t);
17716
18625
  (t ? updates : removes).push(path);
@@ -17718,7 +18627,7 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
17718
18627
  }
17719
18628
  }
17720
18629
  if (checked && !quiet(path) && await entryNotUptodate(checked, path, i, trust, indexTime)) {
17721
- local.push(path);
18630
+ refuse(local, path);
17722
18631
  continue;
17723
18632
  }
17724
18633
  if (subs && t && !quiet(path)) await subs.mergedRefuses(path, i, t);
@@ -17727,7 +18636,7 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
17727
18636
  }
17728
18637
  if (t) {
17729
18638
  if (h && !options.initialCheckout) {
17730
- staged.push(path);
18639
+ refuse(staged, path);
17731
18640
  continue;
17732
18641
  }
17733
18642
  if (subs && !quiet(path)) {
@@ -17735,15 +18644,29 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
17735
18644
  if (absent !== void 0) submodulePaths.add(path);
17736
18645
  if (!absent) await subs.mergedRefuses(path, void 0, t);
17737
18646
  }
18647
+ if (worktree && !quiet(path) && t.mode !== FileMode.GITLINK) {
18648
+ if ((await worktree.getEntry(path))?.isDirectory && !await cleanSubdirectory(path)) continue;
18649
+ }
17738
18650
  updates.push(path);
17739
18651
  continue;
17740
18652
  }
17741
- 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);
17742
18665
  }
17743
18666
  const deleting = [...removes, ...local.filter((p) => !target.has(p))];
17744
18667
  const writing = new Set(updates.filter((p) => !sparse || sparse.writes(p)));
17745
18668
  const found = worktree ? await findInTheWay(worktree, {
17746
- writes: [...writing].filter((p) => !submodulePaths.has(p)),
18669
+ writes: [...[...writing].filter((p) => !submodulePaths.has(p)), ...absentDirs],
17747
18670
  removes: new Set(deleting),
17748
18671
  index,
17749
18672
  ...await restoreCaseOptions(worktree, ignoreCase),
@@ -17844,7 +18767,8 @@ async function switchTreesWith(ctx, head, target, options, sparse) {
17844
18767
  direction: "checkout",
17845
18768
  index: attributesIndexOf(result)
17846
18769
  },
17847
- progress
18770
+ progress,
18771
+ ...options.metadata ? { metadata: options.metadata } : {}
17848
18772
  });
17849
18773
  }
17850
18774
  progress.stop();
@@ -17945,6 +18869,19 @@ function subjectOf$2(message) {
17945
18869
  for (; i < lines.length && lines[i] !== ""; i++) subject.push(lines[i]);
17946
18870
  return subject.join(" ");
17947
18871
  }
18872
+ /**
18873
+ * MERGE_HEAD's entries as commits (git's `read_merge_heads` → `lookup_commit_reference`): a
18874
+ * merged annotated tag is written by its own id (`write_merge_heads`) and peeled when read;
18875
+ * an entry that peels to no commit is kept as written.
18876
+ */
18877
+ async function peelMergeHeads(resolver, ids) {
18878
+ const out = [];
18879
+ for (const id of ids) {
18880
+ const peeled = await resolver.peelTags(id).catch(() => void 0);
18881
+ out.push(peeled?.type === "commit" ? peeled.id : id);
18882
+ }
18883
+ return out;
18884
+ }
17948
18885
  //#endregion
17949
18886
  //#region src/commands/message-cleanup.ts
17950
18887
  /**
@@ -27156,6 +28093,7 @@ var LogPrinter = class {
27156
28093
  const width = this.graph ? this.graph.getWidth() : 0;
27157
28094
  const diffOptions = {
27158
28095
  ...width ? { statWidth: 80 - width } : {},
28096
+ ...this.graph ? { linePrefix: true } : {},
27159
28097
  ...this.follow && this.followPath !== void 0 ? { follow: this.followPath } : {},
27160
28098
  ...this.options.fullDiff ? { fullDiff: true } : {},
27161
28099
  ...this.diffAbbrev()
@@ -27175,7 +28113,8 @@ var LogPrinter = class {
27175
28113
  this.out.text("\n");
27176
28114
  }
27177
28115
  }
27178
- 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));
27179
28118
  }
27180
28119
  /** combine-diff.c's diff_tree_combined for a merge */
27181
28120
  async combined(entry, log, dense) {
@@ -32255,6 +33194,26 @@ var LogCommand = class extends GitCommand {
32255
33194
  this.useBloomFilters = use;
32256
33195
  return this;
32257
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
+ }
32258
33217
  /** What the path-limited walk did so far (see {@link LogPathStatistics}). */
32259
33218
  getStatistics() {
32260
33219
  return {
@@ -33908,6 +34867,7 @@ var LogCommand = class extends GitCommand {
33908
34867
  const diff = new DiffCommand(this._workingCopy);
33909
34868
  prepare?.(diff);
33910
34869
  diff.setOldTree(oldTree).setNewTree(newTree).setRotateStrict(false).setTreeWalk(this.treeWalk).shareReadsOf(this);
34870
+ if (options.linePrefix) diff.setLinePrefixPoints(true);
33911
34871
  if (this.colorSettings) diff.setColorSettings(this.colorSettings);
33912
34872
  diff.setOptions({
33913
34873
  ...this.diffOptions,
@@ -34885,6 +35845,15 @@ var RevTable = class {
34885
35845
  this.byId.set(id, n);
34886
35846
  return n;
34887
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
+ }
34888
35857
  /** The commit at graph position `pos`, added when first met. */
34889
35858
  lookupPos(pos) {
34890
35859
  const byPos = this.byPos;
@@ -36170,7 +37139,7 @@ var SubmoduleUnpack = class SubmoduleUnpack {
36170
37139
  }
36171
37140
  async m() {
36172
37141
  if (this.loadedMover) return this.loadedMover;
36173
- this.moverLoad ??= import("./commands-CPceUCP2.js").then((n) => n.Hn).then((commands) => {
37142
+ this.moverLoad ??= import("./commands-DT3VEv50.js").then((n) => n.Pn).then((commands) => {
36174
37143
  this.commands = commands;
36175
37144
  this.loadedMover = new commands.SubmoduleHeadMover(this.workingCopy, this.superPrefix);
36176
37145
  return this.loadedMover;
@@ -36900,7 +37869,7 @@ var ResetCommand = class extends GitCommand {
36900
37869
  blobs: this.blobs,
36901
37870
  workingCopy: this.workingCopy,
36902
37871
  worktree
36903
- }, commit.tree, trackedBefore, keptOut, sparse, submodules, unchanged);
37872
+ }, commit.tree, trackedBefore, keptOut, sparse, submodules, unchanged, await this.checkoutRefOf(this.ref ?? "HEAD", targetId, { fullRefsOnly: true }));
36904
37873
  }
36905
37874
  /**
36906
37875
  * Reset staging area to match a tree.
@@ -36981,7 +37950,7 @@ var ResetCommand = class extends GitCommand {
36981
37950
  * patterns are written, nothing that stays outside is removed, and the files leaving the
36982
37951
  * checkout are unlinked first. Returns the paths written.
36983
37952
  */
36984
- async function restoreWorktreeHard(deps, treeId, trackedBefore, keptOut, sparse, submodules, unchanged) {
37953
+ async function restoreWorktreeHard(deps, treeId, trackedBefore, keptOut, sparse, submodules, unchanged, metadata) {
36985
37954
  const { trees, blobs, workingCopy, worktree } = deps;
36986
37955
  const subs = submodules?.unpack;
36987
37956
  const oldGitlink = (path) => {
@@ -37025,7 +37994,8 @@ async function restoreWorktreeHard(deps, treeId, trackedBefore, keptOut, sparse,
37025
37994
  await writeTreeRestorePlan(worktree, blobs, plan, RESET_HARD, {
37026
37995
  symlinks: worktreeModeTrust(workingCopy, worktree).symlinks,
37027
37996
  replaceInTheWay: true,
37028
- discardUntracked: true
37997
+ discardUntracked: true,
37998
+ ...metadata ? { metadata } : {}
37029
37999
  });
37030
38000
  if (subs) {
37031
38001
  subs.reload();
@@ -39317,7 +40287,7 @@ function parseColorSpec(spec) {
39317
40287
  return `\x1b[${parts.join(";")}m`;
39318
40288
  }
39319
40289
  /** The length of the ANSI color sequence at `at` (display_mode_esc_sequence_len); 0 if none. */
39320
- function escapeLength(text, at) {
40290
+ function escapeLength$1(text, at) {
39321
40291
  if (text[at] !== "\x1B" || text[at + 1] !== "[") return 0;
39322
40292
  let i = at + 2;
39323
40293
  while (i < text.length && /[0-9;]/.test(text[i])) i++;
@@ -39334,7 +40304,7 @@ function charWidth(cp) {
39334
40304
  function displayWidth(text) {
39335
40305
  let w = 0;
39336
40306
  for (let i = 0; i < text.length;) {
39337
- const esc = escapeLength(text, i);
40307
+ const esc = escapeLength$1(text, i);
39338
40308
  if (esc) {
39339
40309
  i += esc;
39340
40310
  continue;
@@ -39351,7 +40321,7 @@ function utf8Replace(text, pos, width, subst) {
39351
40321
  let w = 0;
39352
40322
  let replaced = false;
39353
40323
  for (let i = 0; i < text.length;) {
39354
- const esc = escapeLength(text, i);
40324
+ const esc = escapeLength$1(text, i);
39355
40325
  if (esc) {
39356
40326
  out += text.slice(i, i + esc);
39357
40327
  i += esc;
@@ -39399,10 +40369,10 @@ function wrapText(text, indent1, indent2, width) {
39399
40369
  }
39400
40370
  let i = 0;
39401
40371
  for (;;) {
39402
- let esc = escapeLength(text, i);
40372
+ let esc = escapeLength$1(text, i);
39403
40373
  while (esc) {
39404
40374
  i += esc;
39405
- esc = escapeLength(text, i);
40375
+ esc = escapeLength$1(text, i);
39406
40376
  }
39407
40377
  const c = text[i];
39408
40378
  if (c === void 0 || GIT_SPACE.test(c)) {
@@ -39924,7 +40894,7 @@ async function formatAndPad(fmt, at, st, cx) {
39924
40894
  if (sb[ch] !== "m") break;
39925
40895
  let q = ch - 1;
39926
40896
  while (q > 0 && ch - q < 10 && sb[q] !== "\x1B") q--;
39927
- if (sb[q] !== "\x1B" || ch + 1 - q !== escapeLength(sb, q)) break;
40897
+ if (sb[q] !== "\x1B" || ch + 1 - q !== escapeLength$1(sb, q)) break;
39928
40898
  local = sb.slice(q, ch + 1) + local;
39929
40899
  ch = q - 1;
39930
40900
  }
@@ -40276,11 +41246,11 @@ const DEFAULT_DECORATION_COLORS = Object.freeze({
40276
41246
  grafted: "\x1B[1;34m"
40277
41247
  });
40278
41248
  /** Where a variable was read, as git names it when it dies */
40279
- function where(key, file, line) {
41249
+ function badConfigVariableLine(key, file, line) {
40280
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`;
40281
41251
  }
40282
41252
  /** color.c's `git_config_colorbool` (`undefined` for git's unknown) */
40283
- function colorBool(key, value) {
41253
+ function readColorBool(key, value) {
40284
41254
  if (value !== void 0) {
40285
41255
  const lower = value.toLowerCase();
40286
41256
  if (lower === "never" || lower === "always" || lower === "auto") return lower;
@@ -40319,33 +41289,33 @@ function readDiffColorSettings(workingCopy, options, uiConfig = true) {
40319
41289
  let wsErrorHighlight = WSEH_NEW;
40320
41290
  const entries = workingCopy.config ? RemoteConfigStore.from(workingCopy).allEntriesWithOrigin() ?? [] : [];
40321
41291
  for (const { key, text, file, line } of entries) {
40322
- 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)}`);
40323
41293
  if (key === "color.ui") {
40324
- if (uiConfig) ui = colorBool(key, text);
41294
+ if (uiConfig) ui = readColorBool(key, text);
40325
41295
  } else if (key === "diff.color" || key === "color.diff") {
40326
- if (uiConfig) diff = colorBool(key, text);
41296
+ if (uiConfig) diff = readColorBool(key, text);
40327
41297
  } else if (key === "diff.colormoved") {
40328
41298
  if (!uiConfig) continue;
40329
41299
  const mode = parseColorMoved(text);
40330
- 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)}`);
40331
41301
  colorMoved = mode;
40332
41302
  } else if (key === "diff.colormovedws") {
40333
41303
  if (!uiConfig) continue;
40334
41304
  if (text === void 0) throw missing();
40335
41305
  const parsed = parseColorMovedWs(text);
40336
- 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)}`);
40337
41307
  colorMovedWs = parsed.flags;
40338
41308
  } else if (key === "diff.wserrorhighlight") {
40339
41309
  if (text === void 0) throw missing();
40340
41310
  const val = parseWsErrorHighlight(text);
40341
- 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)}`);
40342
41312
  wsErrorHighlight = val;
40343
41313
  } else if (key.startsWith("diff.color.") || key.startsWith("color.diff.")) {
40344
41314
  const slot = diffColorSlotOf(key.slice(11));
40345
41315
  if (!slot) continue;
40346
41316
  if (text === void 0) throw missing();
40347
41317
  const color = parseGitColor(text, compatibility);
40348
- 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)}`);
40349
41319
  colors[slot] = color;
40350
41320
  } else if (key.startsWith("color.decorate.")) {
40351
41321
  const name = key.slice(15);
@@ -40353,7 +41323,7 @@ function readDiffColorSettings(workingCopy, options, uiConfig = true) {
40353
41323
  if (!slot) continue;
40354
41324
  if (text === void 0) throw missing();
40355
41325
  const color = parseGitColor(text, compatibility);
40356
- 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)}`);
40357
41327
  decorationColors[slot] = color;
40358
41328
  }
40359
41329
  }
@@ -40879,6 +41849,379 @@ function formatStatusPorcelain(status, version = 1, options = {}) {
40879
41849
  return lines.map((l) => `${l}${eol}`).join("");
40880
41850
  }
40881
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
40882
42225
  //#region src/commands/status-format.ts
40883
42226
  /**
40884
42227
  * The text forms of `git status` (wt-status.c's `wt_status_print`): the long format with its
@@ -40892,6 +42235,40 @@ function formatStatusPorcelain(status, version = 1, options = {}) {
40892
42235
  * // "On branch main\nChanges to be committed:\n (use \"git restore --staged <file>...\" ..."
40893
42236
  * ```
40894
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
+ }
40895
42272
  /** `s->committable` and `s->workdir_dirty` of a status (wt_status_collect). */
40896
42273
  function statusCommitInfo(status, header) {
40897
42274
  let committable = false;
@@ -40991,15 +42368,16 @@ function shortStatus(status, header, options) {
40991
42368
  const z = options.z === true;
40992
42369
  const fully = options.quotePath ?? true;
40993
42370
  const short = options.format === "short";
42371
+ const c = slotsOf(short ? options.colors : void 0);
40994
42372
  const eol = z ? "\0" : "\n";
40995
42373
  let out = "";
40996
- if (options.branch) out += shortTracking(header, options) + eol;
42374
+ if (options.branch) out += shortTracking(header, options, c) + eol;
40997
42375
  const { change, untracked, ignored } = lists(status);
40998
42376
  const q = (p) => z ? p : quotePath(p, true, fully);
40999
42377
  for (const e of change) {
41000
42378
  const mask = stagemask(e);
41001
42379
  if (mask) {
41002
- out += `${UNMERGED_KEYS[mask]} ${q(e.path)}${eol}`;
42380
+ out += `${paint(c.unmerged, UNMERGED_KEYS[mask])} ${q(e.path)}${eol}`;
41003
42381
  continue;
41004
42382
  }
41005
42383
  let y = e.worktree;
@@ -41008,7 +42386,8 @@ function shortStatus(status, header, options) {
41008
42386
  else if (e.submoduleModified) y = "m";
41009
42387
  else if (e.submoduleUntracked) y = "?";
41010
42388
  }
41011
- const x = e.index;
42389
+ const x = e.index === " " ? " " : paint(c.updated, e.index);
42390
+ if (y !== " ") y = paint(c.changed, y);
41012
42391
  if (z) {
41013
42392
  out += `${x}${y} ${e.path}\0`;
41014
42393
  if (e.renamedFrom !== void 0) out += `${e.renamedFrom}\0`;
@@ -41017,30 +42396,32 @@ function shortStatus(status, header, options) {
41017
42396
  out += `${x}${y} ${from}${q(e.path)}\n`;
41018
42397
  }
41019
42398
  }
41020
- for (const p of untracked) out += `?? ${q(p)}${eol}`;
41021
- 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}`;
41022
42402
  return out;
41023
42403
  }
41024
42404
  const isSubmodule = (e) => submoduleToken(e)[0] === "S";
41025
42405
  /** wt_shortstatus_print_tracking: `## branch...upstream [ahead N, behind M]` (no eol). */
41026
- function shortTracking(header, options) {
41027
- let out = "## ";
42406
+ function shortTracking(header, options, c) {
42407
+ const h = (text) => paint(c.header, text);
42408
+ let out = h("## ");
41028
42409
  if (!header.branch) return out;
41029
- if (header.isInitial) out += "No commits yet on ";
41030
- if (header.branch === "HEAD") return `${out}HEAD (no branch)`;
41031
- 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\//, ""));
41032
42413
  const t = header.tracking;
41033
42414
  if (!t || t.result < 0 && !t.base) return out;
41034
42415
  const gone = t.result < 0;
41035
- out += `...${t.short ?? t.base}`;
42416
+ out += h("...") + paint(c.remoteBranch, t.short ?? t.base);
41036
42417
  if (!gone && t.result === 0) return out;
41037
- out += " [";
41038
- if (gone) out += "gone";
41039
- else if (options.aheadBehindQuick) out += "different";
41040
- else if (!t.ahead) out += `behind ${t.behind}`;
41041
- else if (!t.behind) out += `ahead ${t.ahead}`;
41042
- else out += `ahead ${t.ahead}, behind ${t.behind}`;
41043
- 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("]");
41044
42425
  }
41045
42426
  /** wt_porcelain_v2_print. */
41046
42427
  function porcelainV2(status, header, options) {
@@ -41095,16 +42476,25 @@ function commentedLines(text, prefix) {
41095
42476
  */
41096
42477
  var StatusPrinter = class {
41097
42478
  prefix;
42479
+ color;
41098
42480
  out = "";
41099
- 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 = "") {
41100
42487
  this.prefix = prefix;
42488
+ this.color = color;
41101
42489
  }
41102
- vprintf(atBol, text, trail) {
42490
+ vprintf(atBol, text, trail, color = this.color) {
41103
42491
  if (text === "") {
42492
+ let sb = "";
41104
42493
  if (this.prefix !== void 0) {
41105
- this.out += this.prefix;
41106
- if (trail === void 0) this.out += " ";
42494
+ sb += this.prefix;
42495
+ if (trail === void 0) sb += " ";
41107
42496
  }
42497
+ this.out += paint(color, sb);
41108
42498
  if (trail !== void 0) this.out += trail;
41109
42499
  return;
41110
42500
  }
@@ -41118,7 +42508,7 @@ var StatusPrinter = class {
41118
42508
  if (text[line] !== "\n" && text[line] !== " ") buf += " ";
41119
42509
  }
41120
42510
  buf += eol >= 0 ? text.slice(line, eol) : text.slice(line);
41121
- this.out += buf;
42511
+ this.out += paint(color, buf);
41122
42512
  if (eol < 0) break;
41123
42513
  this.out += "\n";
41124
42514
  line = eol + 1;
@@ -41126,14 +42516,17 @@ var StatusPrinter = class {
41126
42516
  }
41127
42517
  if (trail !== void 0) this.out += trail;
41128
42518
  }
41129
- ln(text) {
41130
- 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);
41131
42522
  }
41132
- printf(text) {
41133
- this.vprintf(true, text, void 0);
42523
+ /** status_printf */
42524
+ printf(text, color) {
42525
+ this.vprintf(true, text, void 0, color);
41134
42526
  }
41135
- more(text) {
41136
- this.vprintf(false, text, void 0);
42527
+ /** status_printf_more */
42528
+ more(text, color) {
42529
+ this.vprintf(false, text, void 0, color);
41137
42530
  }
41138
42531
  raw(text) {
41139
42532
  this.out += text;
@@ -41141,7 +42534,15 @@ var StatusPrinter = class {
41141
42534
  };
41142
42535
  /** wt_longstatus_print. */
41143
42536
  function longStatus(status, header, options, info) {
41144
- 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;
41145
42546
  const hints = options.hints ?? true;
41146
42547
  const fully = options.quotePath ?? true;
41147
42548
  const q = (path) => quotePath(path, false, fully);
@@ -41154,7 +42555,9 @@ function longStatus(status, header, options, info) {
41154
42555
  if (header.branch) {
41155
42556
  let onWhat = "On branch ";
41156
42557
  let branchName = header.branch;
42558
+ let branchStatusColor = c.header;
41157
42559
  if (branchName === "HEAD") {
42560
+ branchStatusColor = c.noBranch;
41158
42561
  if (state.rebaseInProgress || state.rebaseInteractiveInProgress) {
41159
42562
  onWhat = state.rebaseInteractiveInProgress ? "interactive rebase in progress; onto " : "rebase in progress; onto ";
41160
42563
  branchName = state.onto ?? "";
@@ -41167,11 +42570,14 @@ function longStatus(status, header, options, info) {
41167
42570
  }
41168
42571
  } else branchName = branchName.replace(/^refs\/heads\//, "");
41169
42572
  p.printf("");
41170
- p.more(onWhat);
41171
- p.more(`${branchName}\n`);
42573
+ p.more(onWhat, branchStatusColor);
42574
+ p.more(`${branchName}\n`, c.branch);
41172
42575
  if (!header.isInitial && header.trackingText) {
41173
- for (const line of header.trackingText.split("\n").slice(0, -1)) p.raw(`${options.commentPrefix !== void 0 ? `${options.commentPrefix} ` : ""}${line}\n`);
41174
- 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");
41175
42581
  }
41176
42582
  }
41177
42583
  if (state.mergeInProgress) {
@@ -41252,7 +42658,7 @@ function longStatus(status, header, options, info) {
41252
42658
  if (updated.length > 0) {
41253
42659
  p.ln("Changes to be committed:");
41254
42660
  if (hints) unstageHint();
41255
- for (const e of updated) changeLine(p, e, "updated", q);
42661
+ for (const e of updated) changeLine(p, e, "updated", q, c.updated);
41256
42662
  trailer();
41257
42663
  }
41258
42664
  const unmerged = change.filter((e) => e.stages);
@@ -41277,7 +42683,7 @@ function longStatus(status, header, options, info) {
41277
42683
  for (const e of unmerged) {
41278
42684
  const how = UNMERGED_LABELS[stagemask(e)];
41279
42685
  p.printf(" ");
41280
- 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);
41281
42687
  }
41282
42688
  trailer();
41283
42689
  }
@@ -41291,7 +42697,7 @@ function longStatus(status, header, options, info) {
41291
42697
  p.ln(" (use \"git restore <file>...\" to discard changes in working directory)");
41292
42698
  if (dirtySubmodules) p.ln(" (commit or discard the untracked or modified content in submodules)");
41293
42699
  }
41294
- for (const e of changed) changeLine(p, e, "changed", q);
42700
+ for (const e of changed) changeLine(p, e, "changed", q, c.changed);
41295
42701
  trailer();
41296
42702
  }
41297
42703
  if (options.submoduleSummary) {
@@ -41304,12 +42710,12 @@ function longStatus(status, header, options, info) {
41304
42710
  }
41305
42711
  const untrackedMode = options.untracked ?? "normal";
41306
42712
  if (untrackedMode !== "no") {
41307
- otherSection(p, untracked, "Untracked files", "add", hints, q);
41308
- if ((options.ignored ?? "no") !== "no") otherSection(p, ignored, "Ignored files", "add -f", hints, q);
41309
- } 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)" : ""}`, "");
41310
42716
  if (options.verbose !== void 0) p.raw(options.verbose);
41311
42717
  if (!info.committable) {
41312
- if (options.amend) p.ln("No changes");
42718
+ if (options.amend) p.ln("No changes", "");
41313
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");
41314
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");
41315
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");
@@ -41318,12 +42724,12 @@ function longStatus(status, header, options, info) {
41318
42724
  }
41319
42725
  if (options.showStash && (header.stashCount ?? 0) > 0) {
41320
42726
  const n = header.stashCount;
41321
- p.ln(`Your stash currently has ${n} ${n === 1 ? "entry" : "entries"}`);
42727
+ p.ln(`Your stash currently has ${n} ${n === 1 ? "entry" : "entries"}`, "");
41322
42728
  }
41323
42729
  return p.out;
41324
42730
  }
41325
42731
  /** wt_longstatus_print_change_data. */
41326
- function changeLine(p, e, kind, q) {
42732
+ function changeLine(p, e, kind, q, color) {
41327
42733
  const status = kind === "updated" ? e.index : e.worktree;
41328
42734
  let extra = "";
41329
42735
  if (kind === "changed" && isSubmodule(e)) {
@@ -41337,20 +42743,30 @@ function changeLine(p, e, kind, q) {
41337
42743
  const pad = " ".repeat(DIFF_LABEL_WIDTH - what.length);
41338
42744
  const renamed = e.renamedFrom !== void 0 && (status === "R" || status === "C");
41339
42745
  p.printf(" ");
41340
- 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);
41341
42747
  if (extra) p.more(extra);
41342
- p.more("\n");
42748
+ p.more("\n", "");
41343
42749
  }
41344
- /** wt_longstatus_print_other (no columns). */
41345
- 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) {
41346
42756
  if (paths.length === 0) return;
41347
42757
  p.ln(`${what}:`);
41348
42758
  if (hints) p.ln(` (use "git ${how} <file>..." to include in what will be committed)`);
41349
- 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) {
41350
42766
  p.printf(" ");
41351
- p.more(`${q(path)}\n`);
42767
+ p.more(`${q(path)}\n`, color);
41352
42768
  }
41353
- p.ln("");
42769
+ p.ln("", "");
41354
42770
  }
41355
42771
  /** show_rebase_information: an interactive rebase's done and remaining commands. */
41356
42772
  function rebaseInformation(p, state, hints) {
@@ -41404,6 +42820,46 @@ function rebaseInProgress(p, state, hints, hasUnmerged, amend) {
41404
42820
  }
41405
42821
  }
41406
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
41407
42863
  //#region src/commands/tracking-info.ts
41408
42864
  /** remote.c's `stat_branch_pair` of `branchRef` against `base` (`quick`: AHEAD_BEHIND_QUICK). */
41409
42865
  async function statBranchPair(source, branchRef, base, quick) {
@@ -42459,6 +43915,17 @@ var StatusCommand = class extends GitCommand {
42459
43915
  const branch = options.branch ?? (deferred ? cfgBool(config, "status.branch", false) : false);
42460
43916
  const quick = options.aheadBehind !== void 0 ? !options.aheadBehind : deferred ? !cfgBool(config, "status.aheadBehind", true) : false;
42461
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
+ }
42462
43929
  const status = await this.call();
42463
43930
  const hints = options.hints ?? cfgBool(config, "advice.statusHints", true);
42464
43931
  const commentPrefix = options.commentPrefix ?? (resolvedFormat === "long" && cfgBool(config, "status.displayCommentPrefix", false) ? commentLineString(this.workingCopy) : void 0);
@@ -42481,7 +43948,8 @@ var StatusCommand = class extends GitCommand {
42481
43948
  committable: info.committable,
42482
43949
  worktreeChanges: info.worktreeChanges,
42483
43950
  referenceId,
42484
- commentPrefix
43951
+ commentPrefix,
43952
+ headerColor: colors?.header ?? ""
42485
43953
  });
42486
43954
  const summaryLimit = resolvedFormat === "long" ? this.submoduleSummaryLimit() : 0;
42487
43955
  const submoduleSummary = summaryLimit !== 0 && this.ignoreSubmodules !== "all" ? await this.submoduleSummaries(summaryLimit, options.amend === true) : void 0;
@@ -42503,7 +43971,13 @@ var StatusCommand = class extends GitCommand {
42503
43971
  reference: options.amend ? "HEAD^1" : "HEAD",
42504
43972
  aheadBehindQuick: quick,
42505
43973
  ...verbose !== void 0 ? { verbose } : {},
42506
- ...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
+ } : {}
42507
43981
  }),
42508
43982
  status,
42509
43983
  warnings: [...status.warnings, ...header.warnings]
@@ -42578,7 +44052,10 @@ var StatusCommand = class extends GitCommand {
42578
44052
  * ones, under their own headers); in a file (the commit template) after the cut line.
42579
44053
  */
42580
44054
  async verboseText(level, o) {
42581
- 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
+ };
42582
44059
  let out = "";
42583
44060
  if (o.toFile && !o.cutLineAdded) out += cutLine(o.commentPrefix ?? "#");
42584
44061
  const twoLevels = level > 1;
@@ -43714,6 +45191,8 @@ var DiffCommand = class DiffCommand extends GitCommand {
43714
45191
  mergeBase = false;
43715
45192
  /** Whether `--rotate-to`/`--skip-to` need their exact path (`git diff`; not `git log`) */
43716
45193
  rotateStrict = true;
45194
+ /** {@link callFormats} reports where diff.c's `diff_line_prefix` goes (`log --graph`) */
45195
+ linePrefix = false;
43717
45196
  /** git's `has_changes` of the last call */
43718
45197
  changesFound = false;
43719
45198
  /** git's `check_failed`: `--check` found an error in the last call */
@@ -43777,6 +45256,18 @@ var DiffCommand = class DiffCommand extends GitCommand {
43777
45256
  return this;
43778
45257
  }
43779
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
+ /**
43780
45271
  * The exit status `git diff` ends with (`diff_result_code`): bit 1 when `--exit-code` or
43781
45272
  * `--quiet` is set and the last call found differences, bit 2 when its `--check` (the
43782
45273
  * `check` format) found errors.
@@ -44362,10 +45853,11 @@ var DiffCommand = class DiffCommand extends GitCommand {
44362
45853
  const headers = this.headersInPathspec();
44363
45854
  const withHeaders = this.includesConflictHeaders(headers);
44364
45855
  if (collected.entries.length === 0 && collected.combined.length === 0 && !withHeaders) return followed;
44365
- const sink = new ByteSink();
45856
+ const sink = this.linePrefix ? new LinePrefixSink() : new ByteSink();
44366
45857
  if (await this.writeFormats(sink, formats, collected, headers) === 0 && collected.combined.length === 0 && !withHeaders) return followed;
44367
45858
  return {
44368
45859
  bytes: sink.bytes(),
45860
+ ...sink instanceof LinePrefixSink ? { prefixPoints: sink.points } : {},
44369
45861
  ...followed
44370
45862
  };
44371
45863
  });
@@ -44426,6 +45918,7 @@ var DiffCommand = class DiffCommand extends GitCommand {
44426
45918
  this.resetExternal();
44427
45919
  const options = this.outputOptions();
44428
45920
  Object.assign(options, this.prefixes());
45921
+ if (sink instanceof LinePrefixSink) options.linePrefix = sink;
44429
45922
  if (this.textOptions.reverse) [options.srcPrefix, options.dstPrefix] = [options.dstPrefix ?? "b/", options.srcPrefix ?? "a/"];
44430
45923
  const pairs = [];
44431
45924
  const unmerged = /* @__PURE__ */ new Set();
@@ -46324,6 +47817,73 @@ function compareEntryNames(a, aTree, b, bTree) {
46324
47817
  return (a.length > n ? a.charCodeAt(n) : aTree ? 47 : 0) - (b.length > n ? b.charCodeAt(n) : bTree ? 47 : 0);
46325
47818
  }
46326
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
46327
47887
  //#region src/commands/add-patch/patch-backend.ts
46328
47888
  /**
46329
47889
  * The repository side of a patch selection: the diff add-patch.c asks git for (`diff-files
@@ -46441,41 +48001,13 @@ var IndexRefresh = class extends GitCommand {
46441
48001
  await this.readCurrentIndex(false);
46442
48002
  const staging = this.staging;
46443
48003
  const worktree = this.workingCopy.worktree;
46444
- const entries = [];
46445
- for await (const entry of staging.entryList?.() ?? staging.entries()) entries.push(entry);
46446
48004
  let out = "";
46447
48005
  let hasErrors = false;
46448
- const updates = [];
46449
48006
  if (worktree) {
46450
- const trust = worktreeModeTrust(this.workingCopy, worktree);
46451
- const indexTime = staging.getUpdateTime();
46452
- const stated = (entry) => entry.stage === 0 && !entry.skipWorktree && !entry.assumeValid && !entry.intentToAdd && entry.mode !== FileMode.GITLINK;
46453
- let lastUnmerged;
46454
- for await (const { item: entry, current } of withWorktreeEntries(worktree, entries, stated)) {
46455
- if (entry.stage !== 0) {
46456
- if (entry.path !== lastUnmerged) out += `${entry.path}: needs merge\n`;
46457
- hasErrors = true;
46458
- lastUnmerged = entry.path;
46459
- continue;
46460
- }
46461
- if (!stated(entry)) continue;
46462
- const compared = await compareWithWorktree(worktree, entry, {
46463
- trust,
46464
- indexTime
46465
- }, current);
46466
- if (compared.kind) continue;
46467
- const update = statUpdateOf(entry, compared);
46468
- if (update && !update.smudge) updates.push(update);
46469
- }
46470
- }
46471
- if (updates.length > 0) {
46472
- const now = Date.now();
46473
- const editor = staging.createEditor();
46474
- for (const update of updates) editor.add({
46475
- path: update.path,
46476
- apply: (existing) => applyStatUpdate(existing, update, now) ?? existing
46477
- });
46478
- 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);
46479
48011
  }
46480
48012
  try {
46481
48013
  await staging.write();
@@ -49162,7 +50694,7 @@ var AddCommand = class extends GitCommand {
49162
50694
  if (outcome === "added") output.push(`add '${displayPath}'`);
49163
50695
  return "ok";
49164
50696
  } catch (error) {
49165
- if (!(error instanceof AddToIndexError)) throw error;
50697
+ if (!(error instanceof AddToIndexError)) throw withEarlierWarnings(error, warnings);
49166
50698
  errors.push(...error.lines);
49167
50699
  failed.push(path);
49168
50700
  return "failed";
@@ -49625,7 +51157,7 @@ var AddCommand = class extends GitCommand {
49625
51157
  onWarning: (message) => warnings.push(message)
49626
51158
  });
49627
51159
  } catch (error) {
49628
- if (!(error instanceof AddToIndexError)) throw error;
51160
+ if (!(error instanceof AddToIndexError)) throw withEarlierWarnings(error, warnings);
49629
51161
  errors.push(...error.lines);
49630
51162
  failed.push(path);
49631
51163
  continue;
@@ -49750,6 +51282,15 @@ function embeddedRepoAdvice(path) {
49750
51282
  "hint: See \"git help submodule\" for more information."
49751
51283
  ];
49752
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
+ }
49753
51294
  //#endregion
49754
51295
  //#region src/results/blame-format.ts
49755
51296
  /**
@@ -50269,4 +51810,4 @@ let RevertStatus = /* @__PURE__ */ function(RevertStatus) {
50269
51810
  return RevertStatus;
50270
51811
  }({});
50271
51812
  //#endregion
50272
- export { submoduleToken as $, TrackMode as $a, findInTheWay as $c, stripspace as $i, AutoCommentCharRemovedError as $l, applyMailmapToHeader as $n, GIT_DIFF_BIG_FILE_THRESHOLD as $o, trailerLinesOf as $r, reflogMessages as $s, SubmoduleUnpack as $t, IndexRefresh as A, createCopyEntry as Aa, checkDefaultObjectStorage as Ac, ApplyParser as Ai, hookRunnerOf as Al, submoduleHeader as An, rerereRemaining as Ao, combineNotesCatSortUniq as Ar, quoteTwo as As, AUTOSTASH_SAVED_LINES as At, parseIgnoredMode as B, SIGNING_KEYS as Ba, SparseUnpack as Bc, FastForwardMode as Bi, FSMONITOR_DAEMON_IPC_NAME as Bl, parseSignature as Bn, DEFAULT_RENAME_LIMIT as Bo, amendWithTrailers as Br, MovedLineBuffer as Bs, squashMessage as Bt, patchRevisionOf as C, orderByPatterns as Ca, InvalidDefaultBranchError as Cc, LogGraph as Ci, configuredHookEntries as Cl, SubmoduleRepository as Cn, normalizeConflicts as Co, expandNotesRef as Cr, pprintRename as Cs, matchArgValue as Ct, localTimezoneOffset as Cu, PATCH_MODES as D, diffEntryToPair as Da, UnknownObjectStorageFormatError as Dc, ApplyCommand as Di, gitFileOf as Dl, readDiffSubmoduleConfig as Dn, rerereForget as Do, readRef as Dr, writePairPatch as Ds, relativeDate as Dt, RemoteConfigStore as Du, runAddPatch as E, DiffFormatter as Ea, ReinitializeObjectStorageError as Ec, readBlob as Ei, gitCommitMessageHooks as El, parseSubmoduleDiffFormat as En, rerereEngineOf as Eo, initNotes as Er, writeHeaderOnlyPatch as Es, parseMaybeBool as Et, moveRefs as Eu, hasPickaxe as F, formatDirstat as Fa, unknownObjectStorageFormat as Fc, latin1ToText as Fi, refTransactionHookOf as Fl, checkSignature as Fn, createMergeDriver as Fo, LogPrinter as Fr, writeWordDiffHunks as Fs, removeBranchState as Ft, SubmoduleSummaryCommand as G, signPayload as Ga, readSparseCheckoutPatterns as Gc, cleanupWith as Gi, createIdAbbreviator as Gl, signatureFormatAt as Gn, addLeadingDirs as Go, interpretTrailers as Gr, diffColorSlotOf as Gs, StashWorktreeRemovalError as Gt, readShowUntrackedFiles as H, refuseCommitSigning as Ha, entryList as Hc, MergeStrategy as Hi, queryFsmonitorDaemon as Hl, parseSshOutput as Hn, GIT_MAX_SCORE as Ho, appendTrailers as Hr, WSEH_NEW as Hs, NoStagedChangesError as Ht, renamesValue as I, parseDirstatParams as Ia, IndexVersionConfigError as Ic, pathToLatin1 as Ii, runPostCheckoutHook as Il, checkSignatureWith as In, installMergeDrivers as Io, mailFromHeader as Ir, COLOR_MOVED_MODE_ERROR as Is, removeMergeBranchState as It, StatusPrinter as J, signerOf as Ja, sparsePathAdvice as Jc, commitMessageFromOption as Ji, WS_DEFAULT_RULE as Jl, verifyCommitBytes as Jn, strerror as Jo, parseTrailerWhere as Jr, parseWsErrorHighlight as Js, checkFlaggedEntries as Jt, readHeadDescription as K, signRequestOf as Ka, sparseCheckoutConfig as Kc, commentPrefixOf as Ki, worktreeModeTrust as Kl, signatureLetter as Kn, readGitlinkHead as Ko, parseTrailerIfExists as Kr, parseColorMoved as Ks, WorkingCopyStashProvider as Kt, TextconvCaches as L, writeCombinedDiff as La, indexFormatDefault as Lc, textToLatin1 as Li, sequencerPostCommit as Ll, mergetagsOf as Ln, lowLevelMerge as Lo, mailSubjectLine as Lr, COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE as Ls, resetMerge as Lt, DiffCommand as M, createModifyEntry as Ma, defaultInitialBranch as Mc, cUnquote as Mi, hookSettingsFromEntries as Ml, parseGitmodules as Mn, runRerere as Mo, combineNotesIgnore as Mr, lineRangesSpan as Ms, cleanupMessage as Mt, checkPickaxeOptions as N, createRenameEntry as Na, defaultRefFormat as Nc, latin1ToBytes as Ni, isKnownHook as Nl, SignatureVerificationError as Nn, MergeDriverCommandMissingError as No, combineNotesOverwrite as Nr, WORD_DIFF_MODES as Ns, createAutostash as Nt, patchModeFor as O, ChangeType as Oa, UnknownRefFormatError as Oc, parseWhitespaceAction as Oi, hookHostInGitDir as Ol, readGitmodulesEntries as On, rerereGcLocation as Oo, updateNotesRef as Or, quoteCStyleBody as Os, sanitizedSubject as Ot, listRemoteNames as Ou, formatDiffEntry as P, DEFAULT_DIRSTAT as Pa, isValidBranchName$1 as Pc, latin1ToPath as Pi, nullIdLike as Pl, bytesOf as Pn, MergeDriverFailedError as Po, readNoteBytes as Pr, compileWordRegex as Ps, moveHeadAsReset as Pt, formatStatusPorcelain as Q, RevisionResolver as Qa, entryNotUptodate as Qc, preparedMessageCleanup as Qi, wsCheckEmit as Ql, GrepPatternError as Qn, writePairCheck as Qo, trailerConfigOf as Qr, reflogLine as Qs, restoreWorktreeHard as Qt, StatusCommand as R, GitCommand as Ra, indexVersionConfigError as Rc, newFilePatch as Ri, sequencerPrepareMessage as Rl, parseBufferSignedByHeader as Rn, mergeDriversOf as Ro, mergesMode as Rr, DEFAULT_DIFF_COLORS as Rs, resetUnmergedToHead as Rt, runAddInteractive as S, DiffPickaxe as Sa, removeLegacyRemoteFile as Sc, GRAPH_COLUMN_COLORS_ANSI as Si, commonGitFileOf as Sl, NULL_OBJECT_ID as Sn, RerereError as So, expandLooseNotesRef as Sr, noIndexPair as Ss, loadRefDecorations as St, formatRfc2822Date as Su, runPatchSelection as T, parseOrderFile as Ta, MissingDefaultBranchValueError as Tc, ortResultEntries as Ti, gitCommitAfterHooks as Tl, openSubmoduleRepository as Tn, rerereDiff as To, initCopyNotesForRewrite as Tr, utf8$1 as Ts, parseColorSpec as Tt, deleteRefs as Tu, readSubmoduleDirt as U, resolveSigning as Ua, pushSparseWarnings as Uc, isMergeSuccessful as Ui, abbrevLengths as Ul, readStoredObjectBytes as Un, isBinaryContent as Uo, formatTrailersOf as Ur, WSEH_OLD as Us, StashCreateCommand as Ut, parseUntrackedFilesMode as V, SigningFailedError as Va, cleanTrackedSparseDirectories as Vc, MergeStatus as Vi, encodePacketized as Vl, parseSignedBuffer as Vn, detectRenames as Vo, appendSignoff as Vr, WSEH_CONTEXT as Vs, NoChangesSelectedError as Vt, submoduleNotSupportedWarning as W, signCommit as Wa, readSparseCheckoutFile as Wc, CleanupMode as Wi, coreBool as Wl, removeSignatureHeaders as Wn, IndexAdder as Wo, ignoredLogMessageBytes as Wr, coloredHunkHeader as Ws, StashPathspecResetError as Wt, statusCommitInfo as X, signingConfigOf as Xa, updateSparsity as Xc, editorCleanupMode as Xi, isGitSpace$1 as Xl, verifyTagBytes as Xn, conflictMarkerSizeOf as Xo, signoffLine as Xr, wsErrorHighlightOf as Xs, recordWrittenStat as Xt, formatStatusText as Y, signingConfigFromEntries as Ya, sparseWarningText as Yc, completeLine as Yi, checkBlankAtEof as Yl, verifyMergeSignature as Yn, DEFAULT_CONFLICT_MARKER_SIZE as Yo, processTrailers as Yr, writeColoredHunks as Ys, fsmonitorKeptEntries as Yt, StatusImpl as Z, signingKeyIdOf as Za, IndexCaseFolding as Zc, parseCleanupMode as Zi, wsBlankLine as Zl, CommitFilters as Zn, isConflictMarkerLine as Zo, trailerConfigFromEntries as Zr, committerIdent as Zs, restoreKeptEntries as Zt, formatBlamePorcelain as _, updateIndexCacheTree as _a, readAllBytes as _c, DEFAULT_DATE_MODE as _i, withTreePathRefusal as _l, shortBranchName as _n, verifyFilename as _o, copyNoteForRewrite as _r, formatPatch as _s, PrettyFormatError as _t, resolveAuthorIdent as _u, PushStatus as a, indexChanges as aa, hasPromisorRemote as ac, matchPathspecSeen as ai, statFollowingLinks as al, STASH_REF as an, guessRemoteBranch as ao, storedBase as ar, contentDriver as as, ExternalDiffTempFiles as at, configValue$1 as au, collapsedSparseDirectories as b, createRefDecorationFilter as ba, readMailmapFile as bc, parseDateMode as bi, HookSession as bl, worktreeAdminWorkingCopy as bn, parseRevisionArgs as bo, createNotesCommit as br, formatStat as bs, formatRefDecorations as bt, withoutCrud as bu, isPullSuccessful as c, planPathsRestore as ca, promisorRemotes as cc, pathspecCommonPrefix as ci, worktreeDiffers as cl, RevFilter as cn, pushTrackingPlan as co, forkPointOf as cr, diffDriverOf as cs, readDiffColorSettings as ct, DEFAULT_IDENT as cu, hasUpdates as d, rewriteIndex as da, promisorRemoteReplyOf as dc, pathspecItemMayMatch as di, planFlatRestore as dl, checkCandidatePath as dn, upstreamMissingError as do, patchIdOfChanges as dr, driverOf as ds, ConfigValueDeath as dt, InvalidIdentError as du, FlatTreeCache as ea, reflogSubject as ec, validateTrailerArgs as ei, flaggedEntryDiffers as el, recursesIntoSubmodules as en, ambiguousRemoteAdvice as eo, compileCommitGrep as er, LoadedSide as es, RevParseCommand as et, autoCommentCharLines as eu, CherryPickStatus as f, storeFlatTree as fa, httpClientSettingsOf as fc, pathspecName as fi, planTreeRestore as fl, findLinkedWorktree as fn, worktreeAmbiguityHints as fo, patchIdsOfPatchText as fr, externalDiffMetainfo as fs, formatConfigValue as ft, authorIdentOf as fu, formatBlameIncremental as g, treeDelta as ga, objectTypeOfMode as gc, untrackedScanPathspec as gi, treePathRefusal as gl, requireWorktrees as gn, parseRevisionAndPathArgs as go, commitNotes as gr, formatNumstat as gs, parseGitColor as gt, identConfigOf as gu, formatBlame as h, switchTrees as ha, concatBytes$3 as hc, treePathspec as hi, firstInvalidPath as hl, repositoryPlaceOf as hn, lstatExists as ho, NotesError as hr, formatNoIndexDiff as hs, normalizeConfigValue as ht, hostEnvironmentOf as hu, isRebaseSuccessful as i, flatTree as ia, createPromisorFetcher as ic, matchPathspec as ii, removeDirectoryIfEmpty as il, StashApplyCommand as in, endOfSymbolicChain as io, mergeStoredTrees as ir, computeDiffstat as is, ExternalDiffDiedError as it, configBool as iu, createPatchBackend as j, createDeleteEntry as ja, defaultBranchHint as jc, bytesToLatin1 as ji, hookSettingsCheck as jl, isSubmoduleIgnoreMode as jn, rerereStatus as jo, combineNotesConcatenate as jr, cutToLineRanges as js, applyAutostash as jt, promptIndex as k, createAddEntry as ka, UnsupportedObjectStorageError as kc, ApplyEngine as ki, hookHostOf as kl, showSubmoduleDiffSummary as kn, rerereHostOf as ko, NotesTree as kr, quotePath$1 as ks, wrapText as kt, RefUpdateStatus as l, readIndex as la, registerPartialClone as lc, pathspecErrors as li, worktreeModified as ll, WorktreeListCommand as ln, trackableStart as lo, PathspecAttributes as lr, diffOptsContext as ls, whitespaceRuleError as lt, IdentityUnknownError as lu, formatAnnotate as m, subjectOf$2 as ma, SHORT_MAGIC as mc, treeEntryInteresting as mi, writeTreeRestorePlan as ml, refuseIfCheckedOut as mn, looksLikePathspec as mo, isFullHexObjectId as mr, formatNameStatus as ms, gitConfigColorBool as mt, findIdent as mu, RebaseAction as n, conflictsComment as na, updateHeadExpecting as nc, latin1Bytes as ni, pruneEmptyParents as nl, ResetMode as nn, autoSetupRebase as no, remergeObjectsView as nr, blobIdOf as ns, installTextconvRunner as nt, attributesSourceResolver as nu, getFailedUpdates as o, indexChangesFromTree as oa, installPromisorFetcher as oc, parsePathspec as oi, statThroughLeadingLinks as ol, StashListCommand as on, installTracking as oo, MergeBaseGraph as or, contentSide as os, externalDiffProgramOf as ot, conflictStyleOf as ou, BlameColorError as p, storeFlatTreeOver as pa, CorruptTreeError as pc, psEqual as pi, restoreCaseOptions as pl, parseExpiry as pn, checkFilename as po, canonicalObjectId as pr, formatNameOnly as ps, gitConfigBool as pt, committerIdentOf as pu, formatTrackingInfo as q, signTagCompat as qa, sparseDirectoriesOf as qc, commitCleanupMode as qi, WS_BLANK_AT_EOF as ql, trustRank as qn, stageZeroClashes as qo, parseTrailerIfMissing as qr, parseColorMovedWs as qs, ResetCommand as qt, RebaseStatus as r, firstPlainError as ra, LAZY_FETCH_DISABLED_WARNING as rc, latin1String as ri, removeCaseVariants as rl, PathspecFile as rn, disableHint as ro, mergeBaseTree as rr, blobSide as rs, textconvRunnerOf as rt, bareAttributesResolver as ru, isPushSuccessful as s, plainUnpackError as sa, promisorOf as sc, parsePathspecItem as si, untrackedUnder as sl, LogCommand as sn, planTracking as so, commitsBaseSource as sr, countLines as ss, DEFAULT_DECORATION_COLORS as st, mergeVerbosityOf as su, RevertStatus as t, OperationState as ta, updateHead as tc, globalPathspecMagic as ti, overwriteMessage as tl, ListBranchMode as tn, applyRefspecs as to, RemergeTreeCommand as tr, attrPathOf as ts, revisionMergeBases as tt, checkAutoCommentChar as tu, getSuccessfulUpdates as u, refsWatched as ua, acceptedPromisorRemotes as uc, pathspecItemBytes as ui, checkoutFreshTree as ul, shortenUnambiguousRef as un, uniqueTrackingName as uo, PatchIds as ur, displayWidth$1 as us, CONFIG_VALUE_TYPES as ut, InvalidDateError as uu, AddCommand as v, writeIndexAsTree as va, Mailmap as vc, DateModeError as vi, worktreePathRules as vl, useRelativePaths as vn, verifyNonFilename as vo, copyNotesForAmend as vr, formatRawPair as vs, expandStringArg as vt, resolveCommitterIdent as vu, pathPatchMode as w, orderRank as wa, InvalidInitialBranchError as wc, graphColumnColors as wi, configuredHooks as wl, SubmoduleWalkError as wn, rerereClear as wo, finishCopyNotesForRewrite as wr, statSummary as ws, matchBoolArg as wt, parseGitDate as wu, sparseIndexAsRead as x, decorateFullRefs as xa, readRepositoryMailmap as xc, showDate as xi, LOCAL_REPO_ENV as xl, worktreeUsingBranch as xn, unknownRevisionMessage as xo, defaultNotesRef as xr, formatSummary as xs, humanDate as xt, approxidateCareful$1 as xu, SPARSE_INDEX_EXPANDED_HINT as y, StashApplyStatus as ya, readMailmapBlob as yc, hostZoneName as yi, markIndexUpdate as yl, usesBranch as yn, handleRevisionArg as yo, copyNotesForRebase as yr, formatShortstat as ys, formatCommitPretty as yt, resolveIdentDate as yu, cutLine as z, SIGNING_FAILED_LINES as za, takeIndexWarnings as zc, ContentMergeStrategy as zi, fsmonitorModeOf as zl, parseGpgOutput as zn, ortConfigOptions as zo, reencodedCommitParts as zr, DIFF_COLOR_SLOTS 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 };