@statewalker/vcs-commands 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (568) hide show
  1. package/dist/commands/add-command.d.ts +70 -0
  2. package/dist/commands/add-command.d.ts.map +1 -1
  3. package/dist/commands/add-patch/add-patch.d.ts +7 -0
  4. package/dist/commands/add-patch/add-patch.d.ts.map +1 -1
  5. package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
  6. package/dist/commands/am/am-command.d.ts +102 -1
  7. package/dist/commands/am/am-command.d.ts.map +1 -1
  8. package/dist/commands/am/index.d.ts +1 -0
  9. package/dist/commands/am/index.d.ts.map +1 -1
  10. package/dist/commands/am/mailsplit.d.ts +88 -0
  11. package/dist/commands/am/mailsplit.d.ts.map +1 -0
  12. package/dist/commands/apply/apply-command.d.ts +2 -0
  13. package/dist/commands/apply/apply-command.d.ts.map +1 -1
  14. package/dist/commands/apply/apply-engine.d.ts.map +1 -1
  15. package/dist/commands/apply/apply-parse.d.ts +7 -0
  16. package/dist/commands/apply/apply-parse.d.ts.map +1 -1
  17. package/dist/commands/apply/index.d.ts +1 -1
  18. package/dist/commands/apply/index.d.ts.map +1 -1
  19. package/dist/commands/bisect/bisect-command.d.ts +2 -0
  20. package/dist/commands/bisect/bisect-command.d.ts.map +1 -1
  21. package/dist/commands/blame-command.d.ts +303 -8
  22. package/dist/commands/blame-command.d.ts.map +1 -1
  23. package/dist/commands/blame-ignore.d.ts +48 -0
  24. package/dist/commands/blame-ignore.d.ts.map +1 -0
  25. package/dist/commands/branch-command.d.ts +148 -18
  26. package/dist/commands/branch-command.d.ts.map +1 -1
  27. package/dist/commands/branch-info-command.d.ts +55 -0
  28. package/dist/commands/branch-info-command.d.ts.map +1 -0
  29. package/dist/commands/branch-tracking.d.ts +106 -17
  30. package/dist/commands/branch-tracking.d.ts.map +1 -1
  31. package/dist/commands/branch-upstream-command.d.ts +83 -0
  32. package/dist/commands/branch-upstream-command.d.ts.map +1 -0
  33. package/dist/commands/check-mailmap-command.d.ts +49 -0
  34. package/dist/commands/check-mailmap-command.d.ts.map +1 -0
  35. package/dist/commands/checkout-command.d.ts +26 -3
  36. package/dist/commands/checkout-command.d.ts.map +1 -1
  37. package/dist/commands/checkout-paths.d.ts +4 -0
  38. package/dist/commands/checkout-paths.d.ts.map +1 -1
  39. package/dist/commands/cherry-command.d.ts +61 -0
  40. package/dist/commands/cherry-command.d.ts.map +1 -0
  41. package/dist/commands/cherry-pick-command.d.ts +82 -1
  42. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  43. package/dist/commands/clean-command.d.ts +44 -0
  44. package/dist/commands/clean-command.d.ts.map +1 -1
  45. package/dist/commands/clean-interactive.d.ts +56 -0
  46. package/dist/commands/clean-interactive.d.ts.map +1 -0
  47. package/dist/commands/clone-command.d.ts +116 -2
  48. package/dist/commands/clone-command.d.ts.map +1 -1
  49. package/dist/commands/commit-command.d.ts +239 -5
  50. package/dist/commands/commit-command.d.ts.map +1 -1
  51. package/dist/commands/commit-reuse.d.ts +33 -0
  52. package/dist/commands/commit-reuse.d.ts.map +1 -0
  53. package/dist/commands/config-command.d.ts +236 -0
  54. package/dist/commands/config-command.d.ts.map +1 -0
  55. package/dist/commands/config-value-types.d.ts +91 -0
  56. package/dist/commands/config-value-types.d.ts.map +1 -0
  57. package/dist/commands/core-config.d.ts +20 -0
  58. package/dist/commands/core-config.d.ts.map +1 -1
  59. package/dist/commands/describe-command.d.ts +71 -64
  60. package/dist/commands/describe-command.d.ts.map +1 -1
  61. package/dist/commands/diff-color-config.d.ts +73 -0
  62. package/dist/commands/diff-color-config.d.ts.map +1 -0
  63. package/dist/commands/diff-command.d.ts +369 -10
  64. package/dist/commands/diff-command.d.ts.map +1 -1
  65. package/dist/commands/fetch-command.d.ts +80 -0
  66. package/dist/commands/fetch-command.d.ts.map +1 -1
  67. package/dist/commands/fetch-multiple-command.d.ts +193 -0
  68. package/dist/commands/fetch-multiple-command.d.ts.map +1 -0
  69. package/dist/commands/fmt-merge-msg-command.d.ts +124 -0
  70. package/dist/commands/fmt-merge-msg-command.d.ts.map +1 -0
  71. package/dist/commands/fork-point.d.ts +38 -0
  72. package/dist/commands/fork-point.d.ts.map +1 -0
  73. package/dist/commands/format-patch-command.d.ts +69 -3
  74. package/dist/commands/format-patch-command.d.ts.map +1 -1
  75. package/dist/commands/fsck/fetch-fsck.d.ts +51 -0
  76. package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -1
  77. package/dist/commands/gc-command.d.ts +8 -0
  78. package/dist/commands/gc-command.d.ts.map +1 -1
  79. package/dist/commands/git-describe.d.ts +81 -4
  80. package/dist/commands/git-describe.d.ts.map +1 -1
  81. package/dist/commands/git-hooks.d.ts +50 -1
  82. package/dist/commands/git-hooks.d.ts.map +1 -1
  83. package/dist/commands/grep/grep-command.d.ts +210 -0
  84. package/dist/commands/grep/grep-command.d.ts.map +1 -0
  85. package/dist/commands/grep/grep-engine.d.ts +218 -0
  86. package/dist/commands/grep/grep-engine.d.ts.map +1 -0
  87. package/dist/commands/grep/index.d.ts +3 -0
  88. package/dist/commands/grep/index.d.ts.map +1 -0
  89. package/dist/commands/index-adder.d.ts +13 -2
  90. package/dist/commands/index-adder.d.ts.map +1 -1
  91. package/dist/commands/index.d.ts +38 -0
  92. package/dist/commands/index.d.ts.map +1 -1
  93. package/dist/commands/index.js +5 -3
  94. package/dist/commands/init-command.d.ts +89 -0
  95. package/dist/commands/init-command.d.ts.map +1 -1
  96. package/dist/commands/interpret-trailers-command.d.ts +90 -0
  97. package/dist/commands/interpret-trailers-command.d.ts.map +1 -0
  98. package/dist/commands/line-log.d.ts +161 -0
  99. package/dist/commands/line-log.d.ts.map +1 -0
  100. package/dist/commands/local-transport.d.ts +36 -5
  101. package/dist/commands/local-transport.d.ts.map +1 -1
  102. package/dist/commands/log-command.d.ts +527 -13
  103. package/dist/commands/log-command.d.ts.map +1 -1
  104. package/dist/commands/log-graph.d.ts +30 -3
  105. package/dist/commands/log-graph.d.ts.map +1 -1
  106. package/dist/commands/log-output.d.ts +199 -6
  107. package/dist/commands/log-output.d.ts.map +1 -1
  108. package/dist/commands/ls-remote-command.d.ts +2 -0
  109. package/dist/commands/ls-remote-command.d.ts.map +1 -1
  110. package/dist/commands/mailmap.d.ts +53 -0
  111. package/dist/commands/mailmap.d.ts.map +1 -1
  112. package/dist/commands/merge-base-command.d.ts +60 -0
  113. package/dist/commands/merge-base-command.d.ts.map +1 -0
  114. package/dist/commands/merge-bases.d.ts +23 -0
  115. package/dist/commands/merge-bases.d.ts.map +1 -1
  116. package/dist/commands/merge-command.d.ts +147 -10
  117. package/dist/commands/merge-command.d.ts.map +1 -1
  118. package/dist/commands/merge-drivers.d.ts +2 -0
  119. package/dist/commands/merge-drivers.d.ts.map +1 -1
  120. package/dist/commands/merge-strategy-options.d.ts +69 -0
  121. package/dist/commands/merge-strategy-options.d.ts.map +1 -0
  122. package/dist/commands/merge-support.d.ts +10 -0
  123. package/dist/commands/merge-support.d.ts.map +1 -1
  124. package/dist/commands/message-cleanup.d.ts +2 -0
  125. package/dist/commands/message-cleanup.d.ts.map +1 -1
  126. package/dist/commands/mv-command.d.ts +4 -0
  127. package/dist/commands/mv-command.d.ts.map +1 -1
  128. package/dist/commands/name-rev-command.d.ts +65 -0
  129. package/dist/commands/name-rev-command.d.ts.map +1 -0
  130. package/dist/commands/name-rev.d.ts +136 -0
  131. package/dist/commands/name-rev.d.ts.map +1 -0
  132. package/dist/commands/notes-command.d.ts.map +1 -1
  133. package/dist/commands/octopus-merge.d.ts +26 -1
  134. package/dist/commands/octopus-merge.d.ts.map +1 -1
  135. package/dist/commands/ort-merge.d.ts +16 -0
  136. package/dist/commands/ort-merge.d.ts.map +1 -1
  137. package/dist/commands/ort-recursive.d.ts.map +1 -1
  138. package/dist/commands/patch-id.d.ts +58 -0
  139. package/dist/commands/patch-id.d.ts.map +1 -1
  140. package/dist/commands/pathspec-file.d.ts +39 -0
  141. package/dist/commands/pathspec-file.d.ts.map +1 -0
  142. package/dist/commands/pathspec.d.ts +3 -0
  143. package/dist/commands/pathspec.d.ts.map +1 -1
  144. package/dist/commands/pretty-format.d.ts +43 -3
  145. package/dist/commands/pretty-format.d.ts.map +1 -1
  146. package/dist/commands/promisor-remote.d.ts.map +1 -1
  147. package/dist/commands/pull-command.d.ts +186 -32
  148. package/dist/commands/pull-command.d.ts.map +1 -1
  149. package/dist/commands/push-command.d.ts +225 -9
  150. package/dist/commands/push-command.d.ts.map +1 -1
  151. package/dist/commands/range-diff/index.d.ts +4 -0
  152. package/dist/commands/range-diff/index.d.ts.map +1 -0
  153. package/dist/commands/range-diff/linear-assignment.d.ts +27 -0
  154. package/dist/commands/range-diff/linear-assignment.d.ts.map +1 -0
  155. package/dist/commands/range-diff/range-diff-command.d.ts +121 -0
  156. package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -0
  157. package/dist/commands/range-diff/range-diff.d.ts +106 -0
  158. package/dist/commands/range-diff/range-diff.d.ts.map +1 -0
  159. package/dist/commands/read-tree-command.d.ts +20 -0
  160. package/dist/commands/read-tree-command.d.ts.map +1 -1
  161. package/dist/commands/rebase-command.d.ts +189 -8
  162. package/dist/commands/rebase-command.d.ts.map +1 -1
  163. package/dist/commands/ref-filter/for-each-ref-command.d.ts +121 -0
  164. package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -0
  165. package/dist/commands/ref-filter/index.d.ts +8 -0
  166. package/dist/commands/ref-filter/index.d.ts.map +1 -0
  167. package/dist/commands/ref-filter/ref-atoms.d.ts +88 -0
  168. package/dist/commands/ref-filter/ref-atoms.d.ts.map +1 -0
  169. package/dist/commands/ref-filter/ref-filter.d.ts +178 -0
  170. package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -0
  171. package/dist/commands/ref-filter/ref-format.d.ts +222 -0
  172. package/dist/commands/ref-filter/ref-format.d.ts.map +1 -0
  173. package/dist/commands/ref-filter/ref-listing-command.d.ts +56 -0
  174. package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -0
  175. package/dist/commands/ref-filter/ref-quote.d.ts +20 -0
  176. package/dist/commands/ref-filter/ref-quote.d.ts.map +1 -0
  177. package/dist/commands/ref-filter/version-compare.d.ts +20 -0
  178. package/dist/commands/ref-filter/version-compare.d.ts.map +1 -0
  179. package/dist/commands/reflog-command.d.ts +120 -0
  180. package/dist/commands/reflog-command.d.ts.map +1 -1
  181. package/dist/commands/reflog-walk.d.ts +72 -0
  182. package/dist/commands/reflog-walk.d.ts.map +1 -0
  183. package/dist/commands/remerge-diff.d.ts +59 -0
  184. package/dist/commands/remerge-diff.d.ts.map +1 -0
  185. package/dist/commands/remote-command.d.ts +179 -29
  186. package/dist/commands/remote-command.d.ts.map +1 -1
  187. package/dist/commands/remote-show-command.d.ts +204 -0
  188. package/dist/commands/remote-show-command.d.ts.map +1 -0
  189. package/dist/commands/remote-transport.d.ts +7 -1
  190. package/dist/commands/remote-transport.d.ts.map +1 -1
  191. package/dist/commands/reset-command.d.ts +21 -4
  192. package/dist/commands/reset-command.d.ts.map +1 -1
  193. package/dist/commands/restore-command.d.ts +9 -3
  194. package/dist/commands/restore-command.d.ts.map +1 -1
  195. package/dist/commands/rev-filter/commit-filter.d.ts +95 -0
  196. package/dist/commands/rev-filter/commit-filter.d.ts.map +1 -0
  197. package/dist/commands/rev-filter/commit-grep.d.ts +91 -0
  198. package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -0
  199. package/dist/commands/rev-filter/index.d.ts +3 -0
  200. package/dist/commands/rev-filter/index.d.ts.map +1 -0
  201. package/dist/commands/rev-list-command.d.ts +226 -2
  202. package/dist/commands/rev-list-command.d.ts.map +1 -1
  203. package/dist/commands/revert-command.d.ts +54 -1
  204. package/dist/commands/revert-command.d.ts.map +1 -1
  205. package/dist/commands/revision-range.d.ts +34 -1
  206. package/dist/commands/revision-range.d.ts.map +1 -1
  207. package/dist/commands/revision-resolver.d.ts +15 -0
  208. package/dist/commands/revision-resolver.d.ts.map +1 -1
  209. package/dist/commands/rm-command.d.ts +70 -2
  210. package/dist/commands/rm-command.d.ts.map +1 -1
  211. package/dist/commands/sequencer-pick.d.ts +186 -5
  212. package/dist/commands/sequencer-pick.d.ts.map +1 -1
  213. package/dist/commands/sequencer-support.d.ts +12 -1
  214. package/dist/commands/sequencer-support.d.ts.map +1 -1
  215. package/dist/commands/serve-repository.d.ts +7 -0
  216. package/dist/commands/serve-repository.d.ts.map +1 -1
  217. package/dist/commands/shortlog-command.d.ts +109 -0
  218. package/dist/commands/shortlog-command.d.ts.map +1 -0
  219. package/dist/commands/shortlog.d.ts +151 -0
  220. package/dist/commands/shortlog.d.ts.map +1 -0
  221. package/dist/commands/show-command.d.ts +130 -0
  222. package/dist/commands/show-command.d.ts.map +1 -0
  223. package/dist/commands/show-commit.d.ts +11 -0
  224. package/dist/commands/show-commit.d.ts.map +1 -0
  225. package/dist/commands/signature-check.d.ts +164 -0
  226. package/dist/commands/signature-check.d.ts.map +1 -0
  227. package/dist/commands/signing.d.ts +160 -0
  228. package/dist/commands/signing.d.ts.map +1 -0
  229. package/dist/commands/sparse-checkout-command.d.ts.map +1 -1
  230. package/dist/commands/sparse-index-view.d.ts +45 -0
  231. package/dist/commands/sparse-index-view.d.ts.map +1 -0
  232. package/dist/commands/ssh-signer.d.ts +29 -0
  233. package/dist/commands/ssh-signer.d.ts.map +1 -0
  234. package/dist/commands/ssh-verifier.d.ts +42 -0
  235. package/dist/commands/ssh-verifier.d.ts.map +1 -0
  236. package/dist/commands/stash-apply-command.d.ts +5 -0
  237. package/dist/commands/stash-apply-command.d.ts.map +1 -1
  238. package/dist/commands/stash-branch-command.d.ts +34 -0
  239. package/dist/commands/stash-branch-command.d.ts.map +1 -0
  240. package/dist/commands/stash-create-command.d.ts +17 -0
  241. package/dist/commands/stash-create-command.d.ts.map +1 -1
  242. package/dist/commands/stash-info.d.ts +93 -0
  243. package/dist/commands/stash-info.d.ts.map +1 -0
  244. package/dist/commands/stash-list-command.d.ts +16 -0
  245. package/dist/commands/stash-list-command.d.ts.map +1 -1
  246. package/dist/commands/stash-pop-command.d.ts +39 -0
  247. package/dist/commands/stash-pop-command.d.ts.map +1 -0
  248. package/dist/commands/stash-show-command.d.ts +48 -0
  249. package/dist/commands/stash-show-command.d.ts.map +1 -0
  250. package/dist/commands/stash-store-command.d.ts +29 -0
  251. package/dist/commands/stash-store-command.d.ts.map +1 -0
  252. package/dist/commands/stash-working-tree.d.ts.map +1 -1
  253. package/dist/commands/status-command.d.ts +31 -2
  254. package/dist/commands/status-command.d.ts.map +1 -1
  255. package/dist/commands/status-header.d.ts +5 -0
  256. package/dist/commands/status-header.d.ts.map +1 -1
  257. package/dist/commands/submodule-add-command.d.ts +89 -0
  258. package/dist/commands/submodule-add-command.d.ts.map +1 -0
  259. package/dist/commands/submodule-auth.d.ts +90 -0
  260. package/dist/commands/submodule-auth.d.ts.map +1 -0
  261. package/dist/commands/submodule-commands.d.ts +463 -0
  262. package/dist/commands/submodule-commands.d.ts.map +1 -0
  263. package/dist/commands/submodule-fetch.d.ts +149 -0
  264. package/dist/commands/submodule-fetch.d.ts.map +1 -0
  265. package/dist/commands/submodule-model.d.ts +296 -0
  266. package/dist/commands/submodule-model.d.ts.map +1 -0
  267. package/dist/commands/submodule-unpack.d.ts +120 -0
  268. package/dist/commands/submodule-unpack.d.ts.map +1 -0
  269. package/dist/commands/submodule-update-command.d.ts +206 -0
  270. package/dist/commands/submodule-update-command.d.ts.map +1 -0
  271. package/dist/commands/subtree-shift.d.ts +27 -0
  272. package/dist/commands/subtree-shift.d.ts.map +1 -0
  273. package/dist/commands/switch-command.d.ts +3 -0
  274. package/dist/commands/switch-command.d.ts.map +1 -1
  275. package/dist/commands/tag-command.d.ts +259 -10
  276. package/dist/commands/tag-command.d.ts.map +1 -1
  277. package/dist/commands/trailers.d.ts +218 -17
  278. package/dist/commands/trailers.d.ts.map +1 -1
  279. package/dist/commands/tree-restore.d.ts +7 -0
  280. package/dist/commands/tree-restore.d.ts.map +1 -1
  281. package/dist/commands/verify-command.d.ts +92 -0
  282. package/dist/commands/verify-command.d.ts.map +1 -0
  283. package/dist/commands/worktree-add-command.d.ts +79 -7
  284. package/dist/commands/worktree-add-command.d.ts.map +1 -1
  285. package/dist/commands/worktree-overwrite-checks.d.ts +2 -0
  286. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
  287. package/dist/commands/worktree-path-rules.d.ts +66 -0
  288. package/dist/commands/worktree-path-rules.d.ts.map +1 -0
  289. package/dist/commands/worktree-remove-command.d.ts +10 -3
  290. package/dist/commands/worktree-remove-command.d.ts.map +1 -1
  291. package/dist/commands/worktree-repair-command.d.ts +15 -2
  292. package/dist/commands/worktree-repair-command.d.ts.map +1 -1
  293. package/dist/commands/worktree-support.d.ts +5 -0
  294. package/dist/commands/worktree-support.d.ts.map +1 -1
  295. package/dist/{commands-DIJ91NnD.js → commands-CNvli5bl.js} +49442 -54941
  296. package/dist/errors/checkout-errors.d.ts +19 -0
  297. package/dist/errors/checkout-errors.d.ts.map +1 -1
  298. package/dist/errors/command-errors.d.ts +25 -0
  299. package/dist/errors/command-errors.d.ts.map +1 -1
  300. package/dist/errors/index.js +85 -3
  301. package/dist/errors/ref-errors.d.ts +19 -0
  302. package/dist/errors/ref-errors.d.ts.map +1 -1
  303. package/dist/errors/worktree-errors.d.ts +6 -1
  304. package/dist/errors/worktree-errors.d.ts.map +1 -1
  305. package/dist/fsck-CPeDh9fh.js +5138 -0
  306. package/dist/git-command.d.ts +58 -2
  307. package/dist/git-command.d.ts.map +1 -1
  308. package/dist/git.d.ts +363 -1
  309. package/dist/git.d.ts.map +1 -1
  310. package/dist/guarded-transport-command.d.ts +82 -0
  311. package/dist/guarded-transport-command.d.ts.map +1 -0
  312. package/dist/index.d.ts +1 -0
  313. package/dist/index.d.ts.map +1 -1
  314. package/dist/index.js +6 -5
  315. package/dist/remote-config/index.d.ts +1 -1
  316. package/dist/remote-config/index.d.ts.map +1 -1
  317. package/dist/remote-config/remote-config-store.d.ts +55 -0
  318. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  319. package/dist/remote-transport-CCmBadm-.js +1606 -0
  320. package/dist/rename/detect-renames.d.ts +20 -0
  321. package/dist/rename/detect-renames.d.ts.map +1 -1
  322. package/dist/rename/diffcore-break.d.ts +51 -0
  323. package/dist/rename/diffcore-break.d.ts.map +1 -0
  324. package/dist/rename/index.d.ts +1 -0
  325. package/dist/rename/index.d.ts.map +1 -1
  326. package/dist/results/blame-format.d.ts +62 -1
  327. package/dist/results/blame-format.d.ts.map +1 -1
  328. package/dist/results/clone-result.d.ts +9 -0
  329. package/dist/results/clone-result.d.ts.map +1 -1
  330. package/dist/results/combined-diff.d.ts +3 -0
  331. package/dist/results/combined-diff.d.ts.map +1 -1
  332. package/dist/results/diff-check.d.ts +38 -0
  333. package/dist/results/diff-check.d.ts.map +1 -0
  334. package/dist/results/diff-color.d.ts +135 -0
  335. package/dist/results/diff-color.d.ts.map +1 -0
  336. package/dist/results/diff-dirstat.d.ts +36 -0
  337. package/dist/results/diff-dirstat.d.ts.map +1 -0
  338. package/dist/results/diff-entry.d.ts +10 -0
  339. package/dist/results/diff-entry.d.ts.map +1 -1
  340. package/dist/results/diff-formatter.d.ts.map +1 -1
  341. package/dist/results/diff-output.d.ts +103 -1
  342. package/dist/results/diff-output.d.ts.map +1 -1
  343. package/dist/results/diff-pickaxe.d.ts +67 -0
  344. package/dist/results/diff-pickaxe.d.ts.map +1 -0
  345. package/dist/results/diff-words.d.ts +55 -0
  346. package/dist/results/diff-words.d.ts.map +1 -0
  347. package/dist/results/fetch-result.d.ts +12 -1
  348. package/dist/results/fetch-result.d.ts.map +1 -1
  349. package/dist/results/index.d.ts +6 -0
  350. package/dist/results/index.d.ts.map +1 -1
  351. package/dist/results/index.js +2 -2
  352. package/dist/results/init-result.d.ts +8 -1
  353. package/dist/results/init-result.d.ts.map +1 -1
  354. package/dist/results/line-range-hunks.d.ts +27 -0
  355. package/dist/results/line-range-hunks.d.ts.map +1 -0
  356. package/dist/results/merge-result.d.ts +8 -1
  357. package/dist/results/merge-result.d.ts.map +1 -1
  358. package/dist/results/pull-result.d.ts +11 -0
  359. package/dist/results/pull-result.d.ts.map +1 -1
  360. package/dist/results/push-result.d.ts +12 -0
  361. package/dist/results/push-result.d.ts.map +1 -1
  362. package/dist/results/rebase-result.d.ts +2 -0
  363. package/dist/results/rebase-result.d.ts.map +1 -1
  364. package/dist/results/stash-result.d.ts +6 -0
  365. package/dist/results/stash-result.d.ts.map +1 -1
  366. package/dist/results/status-result.d.ts +1 -1
  367. package/dist/results/status-result.d.ts.map +1 -1
  368. package/dist/results-BDuEgdLU.js +46847 -0
  369. package/dist/transport-command.d.ts +14 -0
  370. package/dist/transport-command.d.ts.map +1 -1
  371. package/dist/whitespace/index.d.ts +2 -0
  372. package/dist/whitespace/index.d.ts.map +1 -0
  373. package/dist/whitespace/whitespace-rule.d.ts +94 -0
  374. package/dist/whitespace/whitespace-rule.d.ts.map +1 -0
  375. package/package.json +12 -12
  376. package/src/commands/add-command.ts +293 -17
  377. package/src/commands/add-patch/add-patch.ts +8 -0
  378. package/src/commands/add-patch/patch-backend.ts +20 -2
  379. package/src/commands/am/am-command.ts +400 -46
  380. package/src/commands/am/index.ts +1 -0
  381. package/src/commands/am/mailsplit.ts +326 -0
  382. package/src/commands/apply/apply-command.ts +58 -15
  383. package/src/commands/apply/apply-engine.ts +1 -1
  384. package/src/commands/apply/apply-parse.ts +17 -8
  385. package/src/commands/apply/index.ts +8 -1
  386. package/src/commands/bisect/bisect-command.ts +18 -5
  387. package/src/commands/blame-command.ts +1450 -51
  388. package/src/commands/blame-ignore.ts +307 -0
  389. package/src/commands/branch-command.ts +528 -53
  390. package/src/commands/branch-info-command.ts +150 -0
  391. package/src/commands/branch-tracking.ts +335 -60
  392. package/src/commands/branch-upstream-command.ts +218 -0
  393. package/src/commands/check-mailmap-command.ts +129 -0
  394. package/src/commands/checkout-command.ts +166 -55
  395. package/src/commands/checkout-paths.ts +28 -0
  396. package/src/commands/cherry-command.ts +187 -0
  397. package/src/commands/cherry-pick-command.ts +185 -1
  398. package/src/commands/clean-command.ts +126 -15
  399. package/src/commands/clean-interactive.ts +522 -0
  400. package/src/commands/clone-command.ts +598 -45
  401. package/src/commands/commit-command.ts +925 -74
  402. package/src/commands/commit-reuse.ts +94 -0
  403. package/src/commands/config-command.ts +1256 -0
  404. package/src/commands/config-value-types.ts +358 -0
  405. package/src/commands/core-config.ts +40 -0
  406. package/src/commands/describe-command.ts +341 -254
  407. package/src/commands/diff-color-config.ts +274 -0
  408. package/src/commands/diff-command.ts +1619 -99
  409. package/src/commands/fetch-command.ts +495 -14
  410. package/src/commands/fetch-multiple-command.ts +665 -0
  411. package/src/commands/fmt-merge-msg-command.ts +715 -0
  412. package/src/commands/fork-point.ts +63 -0
  413. package/src/commands/format-patch-command.ts +496 -116
  414. package/src/commands/fsck/fetch-fsck.ts +172 -18
  415. package/src/commands/gc-command.ts +31 -1
  416. package/src/commands/git-describe.ts +460 -201
  417. package/src/commands/git-hooks.ts +123 -3
  418. package/src/commands/grep/grep-command.ts +1077 -0
  419. package/src/commands/grep/grep-engine.ts +1024 -0
  420. package/src/commands/grep/index.ts +2 -0
  421. package/src/commands/index-adder.ts +46 -7
  422. package/src/commands/index.ts +43 -0
  423. package/src/commands/init-command.ts +603 -49
  424. package/src/commands/interpret-trailers-command.ts +256 -0
  425. package/src/commands/line-log.ts +931 -0
  426. package/src/commands/local-transport.ts +109 -10
  427. package/src/commands/log-command.ts +2599 -326
  428. package/src/commands/log-graph.ts +129 -29
  429. package/src/commands/log-output.ts +449 -27
  430. package/src/commands/ls-remote-command.ts +5 -0
  431. package/src/commands/mailmap.ts +155 -0
  432. package/src/commands/merge-base-command.ts +170 -0
  433. package/src/commands/merge-bases.ts +63 -8
  434. package/src/commands/merge-command.ts +601 -95
  435. package/src/commands/merge-drivers.ts +3 -0
  436. package/src/commands/merge-strategy-options.ts +224 -0
  437. package/src/commands/merge-support.ts +115 -22
  438. package/src/commands/message-cleanup.ts +1 -1
  439. package/src/commands/mv-command.ts +6 -3
  440. package/src/commands/name-rev-command.ts +184 -0
  441. package/src/commands/name-rev.ts +762 -0
  442. package/src/commands/notes-command.ts +11 -1
  443. package/src/commands/octopus-merge.ts +35 -11
  444. package/src/commands/ort-merge.ts +41 -7
  445. package/src/commands/ort-recursive.ts +40 -2
  446. package/src/commands/patch-id.ts +109 -0
  447. package/src/commands/pathspec-file.ts +72 -0
  448. package/src/commands/pathspec.ts +14 -2
  449. package/src/commands/pretty-format.ts +103 -19
  450. package/src/commands/promisor-remote.ts +10 -1
  451. package/src/commands/pull-command.ts +734 -221
  452. package/src/commands/push-command.ts +1035 -68
  453. package/src/commands/range-diff/index.ts +3 -0
  454. package/src/commands/range-diff/linear-assignment.ts +203 -0
  455. package/src/commands/range-diff/range-diff-command.ts +433 -0
  456. package/src/commands/range-diff/range-diff.ts +617 -0
  457. package/src/commands/read-tree-command.ts +102 -4
  458. package/src/commands/rebase-command.ts +1074 -194
  459. package/src/commands/ref-filter/for-each-ref-command.ts +298 -0
  460. package/src/commands/ref-filter/index.ts +7 -0
  461. package/src/commands/ref-filter/ref-atoms.ts +581 -0
  462. package/src/commands/ref-filter/ref-filter.ts +651 -0
  463. package/src/commands/ref-filter/ref-format.ts +1070 -0
  464. package/src/commands/ref-filter/ref-listing-command.ts +421 -0
  465. package/src/commands/ref-filter/ref-quote.ts +69 -0
  466. package/src/commands/ref-filter/version-compare.ts +177 -0
  467. package/src/commands/reflog-command.ts +492 -2
  468. package/src/commands/reflog-walk.ts +234 -0
  469. package/src/commands/remerge-diff.ts +241 -0
  470. package/src/commands/remote-command.ts +537 -69
  471. package/src/commands/remote-show-command.ts +836 -0
  472. package/src/commands/remote-transport.ts +9 -1
  473. package/src/commands/reset-command.ts +114 -34
  474. package/src/commands/restore-command.ts +27 -41
  475. package/src/commands/rev-filter/commit-filter.ts +159 -0
  476. package/src/commands/rev-filter/commit-grep.ts +444 -0
  477. package/src/commands/rev-filter/index.ts +2 -0
  478. package/src/commands/rev-list-command.ts +578 -15
  479. package/src/commands/revert-command.ts +123 -1
  480. package/src/commands/revision-range.ts +207 -5
  481. package/src/commands/revision-resolver.ts +23 -8
  482. package/src/commands/rm-command.ts +282 -21
  483. package/src/commands/sequencer-pick.ts +818 -111
  484. package/src/commands/sequencer-support.ts +184 -4
  485. package/src/commands/serve-repository.ts +18 -3
  486. package/src/commands/shortlog-command.ts +354 -0
  487. package/src/commands/shortlog.ts +361 -0
  488. package/src/commands/show-command.ts +491 -0
  489. package/src/commands/show-commit.ts +24 -0
  490. package/src/commands/signature-check.ts +657 -0
  491. package/src/commands/signing.ts +385 -0
  492. package/src/commands/sparse-checkout-command.ts +2 -9
  493. package/src/commands/sparse-checkout-support.ts +2 -2
  494. package/src/commands/sparse-index-view.ts +135 -0
  495. package/src/commands/ssh-signer.ts +199 -0
  496. package/src/commands/ssh-verifier.ts +523 -0
  497. package/src/commands/stash-apply-command.ts +16 -4
  498. package/src/commands/stash-branch-command.ts +88 -0
  499. package/src/commands/stash-create-command.ts +28 -0
  500. package/src/commands/stash-info.ts +243 -0
  501. package/src/commands/stash-list-command.ts +33 -0
  502. package/src/commands/stash-pop-command.ts +83 -0
  503. package/src/commands/stash-show-command.ts +141 -0
  504. package/src/commands/stash-store-command.ts +82 -0
  505. package/src/commands/stash-working-tree.ts +2 -2
  506. package/src/commands/status-command.ts +120 -27
  507. package/src/commands/status-format.ts +1 -1
  508. package/src/commands/status-header.ts +41 -7
  509. package/src/commands/submodule-add-command.ts +509 -0
  510. package/src/commands/submodule-auth.ts +276 -0
  511. package/src/commands/submodule-commands.ts +1835 -0
  512. package/src/commands/submodule-fetch.ts +789 -0
  513. package/src/commands/submodule-model.ts +938 -0
  514. package/src/commands/submodule-unpack.ts +265 -0
  515. package/src/commands/submodule-update-command.ts +1126 -0
  516. package/src/commands/subtree-shift.ts +215 -0
  517. package/src/commands/switch-command.ts +12 -1
  518. package/src/commands/tag-command.ts +876 -64
  519. package/src/commands/trailers.ts +837 -100
  520. package/src/commands/tree-restore.ts +44 -11
  521. package/src/commands/verify-command.ts +235 -0
  522. package/src/commands/worktree-add-command.ts +268 -24
  523. package/src/commands/worktree-overwrite-checks.ts +5 -0
  524. package/src/commands/worktree-path-rules.ts +183 -0
  525. package/src/commands/worktree-remove-command.ts +39 -5
  526. package/src/commands/worktree-repair-command.ts +52 -5
  527. package/src/commands/worktree-support.ts +22 -1
  528. package/src/errors/checkout-errors.ts +29 -0
  529. package/src/errors/command-errors.ts +37 -1
  530. package/src/errors/ref-errors.ts +23 -0
  531. package/src/errors/worktree-errors.ts +8 -1
  532. package/src/git-command.ts +153 -2
  533. package/src/git.ts +550 -1
  534. package/src/guarded-transport-command.ts +171 -0
  535. package/src/index.ts +1 -0
  536. package/src/remote-config/index.ts +2 -0
  537. package/src/remote-config/remote-config-store.ts +101 -0
  538. package/src/rename/detect-renames.ts +42 -8
  539. package/src/rename/diffcore-break.ts +166 -0
  540. package/src/rename/index.ts +1 -0
  541. package/src/results/blame-format.ts +268 -43
  542. package/src/results/clone-result.ts +6 -0
  543. package/src/results/combined-diff.ts +38 -18
  544. package/src/results/diff-check.ts +185 -0
  545. package/src/results/diff-color.ts +868 -0
  546. package/src/results/diff-dirstat.ts +117 -0
  547. package/src/results/diff-entry.ts +12 -0
  548. package/src/results/diff-formatter.ts +1 -0
  549. package/src/results/diff-output.ts +322 -32
  550. package/src/results/diff-pickaxe.ts +304 -0
  551. package/src/results/diff-words.ts +395 -0
  552. package/src/results/fetch-result.ts +12 -1
  553. package/src/results/index.ts +6 -0
  554. package/src/results/init-result.ts +10 -1
  555. package/src/results/line-range-hunks.ts +126 -0
  556. package/src/results/merge-result.ts +9 -0
  557. package/src/results/pull-result.ts +7 -0
  558. package/src/results/push-result.ts +12 -0
  559. package/src/results/rebase-result.ts +3 -0
  560. package/src/results/stash-result.ts +7 -0
  561. package/src/results/status-result.ts +2 -2
  562. package/src/transport-command.ts +34 -3
  563. package/src/whitespace/index.ts +1 -0
  564. package/src/{commands/apply/whitespace.ts → whitespace/whitespace-rule.ts} +173 -23
  565. package/dist/commands/apply/whitespace.d.ts +0 -58
  566. package/dist/commands/apply/whitespace.d.ts.map +0 -1
  567. package/dist/git-command-BGiOJ8Zk.js +0 -7246
  568. package/dist/results-WVlBhVb1.js +0 -2935
@@ -11,11 +11,17 @@
11
11
  * copies none (only `rebase --apply` does, through `rewritten`).
12
12
  */
13
13
 
14
- import { formatPersonIdent, type ObjectId, type PersonIdent } from "@statewalker/vcs-core";
15
-
14
+ import {
15
+ type Commit,
16
+ formatPersonIdent,
17
+ type ObjectId,
18
+ type PersonIdent,
19
+ } from "@statewalker/vcs-core";
20
+ import { parseGitBool } from "@statewalker/vcs-utils";
16
21
  import { compareGitPaths, encodeGitPath } from "@statewalker/vcs-utils/encoding";
17
-
22
+ import { wildmatch } from "@statewalker/vcs-working-tree";
18
23
  import { GitCommand } from "../../git-command.js";
24
+ import { RemoteConfigStore } from "../../remote-config/index.js";
19
25
  import { quotePath } from "../../results/quote-path.js";
20
26
  import { ApplyCommand } from "../apply/apply-command.js";
21
27
  import { ApplyEngine, type ApplyIO } from "../apply/apply-engine.js";
@@ -28,6 +34,7 @@ import {
28
34
  textToLatin1,
29
35
  } from "../apply/latin1.js";
30
36
  import { coreBool } from "../core-config.js";
37
+ import { DiffCommand } from "../diff-command.js";
31
38
  import { localTimezoneOffset, parseGitDate } from "../git-date.js";
32
39
  import { withoutCrud } from "../git-ident.js";
33
40
  import { configValue, conflictStyleOf } from "../merge-config.js";
@@ -47,8 +54,11 @@ import { ortResultEntries } from "../ort-merge.js";
47
54
  import { mergeStoredTrees, storedBase } from "../ort-recursive.js";
48
55
  import { updateHead, updateHeadExpecting } from "../reflog-messages.js";
49
56
  import { removeBranchState, resetMerge, resetUnmergedToHead } from "../sequencer-support.js";
57
+ import { showCommitBytes } from "../show-commit.js";
58
+ import { SigningFailedError, signCommit, signPayload, signRequestOf } from "../signing.js";
50
59
  import { appendSignoff } from "../trailers.js";
51
- import { mailinfo, mailsplit } from "./mailinfo.js";
60
+ import { mailinfo } from "./mailinfo.js";
61
+ import { type MailsplitSource, splitMail } from "./mailsplit.js";
52
62
  import {
53
63
  type AmPatchFormat,
54
64
  detectPatchFormat,
@@ -66,7 +76,15 @@ export interface AmResult {
66
76
  errors: string;
67
77
  }
68
78
 
69
- type Resume = "apply" | "continue" | "allow-empty" | "skip" | "abort" | "quit";
79
+ type Resume =
80
+ | "apply"
81
+ | "continue"
82
+ | "allow-empty"
83
+ | "skip"
84
+ | "abort"
85
+ | "quit"
86
+ | "show-raw"
87
+ | "show-diff";
70
88
 
71
89
  /** The options `git am` passes to `git apply` (kept in `apply-opt`). */
72
90
  export interface AmApplyOptions {
@@ -86,6 +104,28 @@ export interface AmApplyOptions {
86
104
  reject?: boolean;
87
105
  /** `--ignore-whitespace` */
88
106
  ignoreWhitespace?: boolean;
107
+ /** `--ignore-space-change` */
108
+ ignoreSpaceChange?: boolean;
109
+ }
110
+
111
+ /**
112
+ * The `git apply` options `git am` keeps in `apply-opt`, set on an apply: both the first
113
+ * attempt and the 3-way fallback's apply to the fake ancestor take all of them
114
+ * (`run_apply`).
115
+ */
116
+ function configureApply(cmd: ApplyCommand, opts: string[]): ApplyCommand {
117
+ for (const a of opts) {
118
+ if (a.startsWith("-C")) cmd.setContext(Number(a.slice(2)));
119
+ else if (a.startsWith("-p")) cmd.setStrip(Number(a.slice(2)));
120
+ else if (a.startsWith("--whitespace=")) cmd.setWhitespace(a.slice(13));
121
+ else if (a.startsWith("--directory=")) cmd.setDirectory(a.slice(12));
122
+ else if (a.startsWith("--exclude=")) cmd.addExclude(a.slice(10));
123
+ else if (a.startsWith("--include=")) cmd.addInclude(a.slice(10));
124
+ else if (a === "--reject") cmd.setReject(true);
125
+ else if (a === "--ignore-whitespace" || a === "--ignore-space-change")
126
+ cmd.setIgnoreWhitespace(true);
127
+ }
128
+ return cmd;
89
129
  }
90
130
 
91
131
  /** `sq_quote_buf`. */
@@ -131,7 +171,11 @@ function sqDequoteAll(s: string): string[] {
131
171
  * ```
132
172
  */
133
173
  export class AmCommand extends GitCommand<AmResult> {
134
- private mboxes: { content: string; name?: string }[] = [];
174
+ private mboxes: {
175
+ content: string;
176
+ name?: string;
177
+ maildir?: { name: string; content: Uint8Array | string }[];
178
+ }[] = [];
135
179
  private patchFormat?: AmPatchFormat;
136
180
  private fixedClock?: number;
137
181
  private resume?: Resume;
@@ -141,8 +185,11 @@ export class AmCommand extends GitCommand<AmResult> {
141
185
  private keep: "t" | "b" | "f" = "f";
142
186
  private messageId?: boolean;
143
187
  private scissors?: boolean;
188
+ private quotedCr?: "nowarn" | "warn" | "strip";
144
189
  private quiet = false;
145
190
  private noVerify = false;
191
+ /** `-S[<keyid>]` / `--no-gpg-sign` (undefined: `commit.gpgSign`) */
192
+ private sign?: boolean | string;
146
193
  private utf8 = true;
147
194
  private ignoreDate = false;
148
195
  private committerDateIsAuthorDate = false;
@@ -150,6 +197,8 @@ export class AmCommand extends GitCommand<AmResult> {
150
197
  private emptyMode: "stop" | "drop" | "keep" = "stop";
151
198
  private applyOptions: AmApplyOptions = {};
152
199
  private legacyMessages = false;
200
+ private interactive?: AmInteractiveReader;
201
+ private editor?: AmMessageEditor;
153
202
  private out = "";
154
203
  private err = "";
155
204
 
@@ -164,6 +213,18 @@ export class AmCommand extends GitCommand<AmResult> {
164
213
  return this;
165
214
  }
166
215
 
216
+ /**
217
+ * A Maildir to apply, in order (`git am <dir>`): its messages, each named by its path in
218
+ * the Maildir (`cur/<file>`, `new/<file>`), split as `git mailsplit` splits a Maildir
219
+ * (`cur/` then `new/`, numbers in names compared as numbers). `name` is the directory as
220
+ * git names it in messages. A Maildir given first is read as mailboxes (git's format
221
+ * detection takes a directory for mbox).
222
+ */
223
+ addMaildir(messages: { name: string; content: Uint8Array | string }[], name: string): this {
224
+ this.mboxes.push({ content: "", name, maildir: messages });
225
+ return this;
226
+ }
227
+
167
228
  /**
168
229
  * `--patch-format=<format>`: mbox, mboxrd, stgit or hg (Mercurial); detected from the
169
230
  * first named mailbox when not given. An StGit series (`stgit-series`) names its patch
@@ -194,6 +255,17 @@ export class AmCommand extends GitCommand<AmResult> {
194
255
  return this;
195
256
  }
196
257
 
258
+ /**
259
+ * `--show-current-patch[=raw|diff]`: the mail of the patch that stopped (`raw`, the
260
+ * default) or its diff (`diff`, `rebase-apply/patch`) on stdout, as they stand in
261
+ * `.git/rebase-apply/`; a session of `rebase --apply` shows its original commit
262
+ * (`git show <original-commit>`).
263
+ */
264
+ setShowCurrentPatch(mode: "raw" | "diff" = "raw"): this {
265
+ this.resume = mode === "diff" ? "show-diff" : "show-raw";
266
+ return this;
267
+ }
268
+
197
269
  /** `-3` / `--3way` (default `am.threeWay`). */
198
270
  setThreeWay(value: boolean): this {
199
271
  this.threeWay = value;
@@ -224,12 +296,23 @@ export class AmCommand extends GitCommand<AmResult> {
224
296
  return this;
225
297
  }
226
298
 
227
- /** `-c` / `--scissors`, `--no-scissors`. */
299
+ /** `-c` / `--scissors`, `--no-scissors` (default `mailinfo.scissors`). */
228
300
  setScissors(value: boolean): this {
229
301
  this.scissors = value;
230
302
  return this;
231
303
  }
232
304
 
305
+ /**
306
+ * `--quoted-cr=<action>`: what mailinfo does with a CRLF line ending of a base64 or
307
+ * quoted-printable body (`warn`, the default from `mailinfo.quotedCr`, warns `quoted CRLF
308
+ * detected`; `strip` drops the CR; `nowarn` keeps it silently). Kept in `quoted-cr` for the
309
+ * whole session.
310
+ */
311
+ setQuotedCr(action: "nowarn" | "warn" | "strip"): this {
312
+ this.quotedCr = action;
313
+ return this;
314
+ }
315
+
233
316
  /** `--no-verify`: the applypatch-msg and pre-applypatch hooks do not run. */
234
317
  setNoVerify(value: boolean): this {
235
318
  this.checkCallable();
@@ -237,6 +320,27 @@ export class AmCommand extends GitCommand<AmResult> {
237
320
  return this;
238
321
  }
239
322
 
323
+ /**
324
+ * `-S` (true) / `--no-gpg-sign` (false): whether to sign the commits; undefined (the
325
+ * default) leaves it to `commit.gpgSign`. Each commit is signed through the host's signer
326
+ * (`GitHostEnvironment.signer`) as git's commit_tree signs it; when it cannot be signed the
327
+ * am fails as git's does (`error: gpg failed to sign the data:`, `fatal: failed to write
328
+ * commit object`, exit 128), the patch left applied to the index in `.git/rebase-apply`
329
+ * and nothing committed.
330
+ */
331
+ setSign(sign: boolean | undefined): this {
332
+ this.checkCallable();
333
+ this.sign = sign;
334
+ return this;
335
+ }
336
+
337
+ /** `-S<keyid>`: sign with this key (see {@link setSign}). */
338
+ setSigningKey(keyId: string): this {
339
+ this.checkCallable();
340
+ this.sign = keyId;
341
+ return this;
342
+ }
343
+
240
344
  /** `-q`. */
241
345
  setQuiet(value: boolean): this {
242
346
  this.quiet = value;
@@ -285,6 +389,100 @@ export class AmCommand extends GitCommand<AmResult> {
285
389
  return this;
286
390
  }
287
391
 
392
+ /**
393
+ * `git am -i` (`--interactive`): before each patch is applied (and before a resolved one
394
+ * is committed), builtin/am.c's `do_interactive` shows its message and asks "Apply?
395
+ * [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: ". `reader` answers each such read of
396
+ * standard input with the line typed (only its first letter counts, either case; others
397
+ * ask again), or undefined at the end of input, which stops the am as git dies ("unable to
398
+ * read from stdin; aborting"). `y` applies, `n` skips the patch, `a` applies this one and
399
+ * the rest without asking, `e` hands `final-commit` to {@link setEditor} and asks again
400
+ * with its result, `v` prints the patch (`rebase-apply/patch`, as git's pager shows it).
401
+ * Give it again with `setResume("continue")` to be asked about a resolved patch (git's
402
+ * `am -i --resolved`, which shows the index's diff from HEAD as the patch).
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * const answers = ["y", "n"];
407
+ * const { output } = await git.am().addMbox(mbox, "mbox")
408
+ * .setInteractive(() => answers.shift()).call();
409
+ * ```
410
+ */
411
+ setInteractive(reader: AmInteractiveReader | undefined): this {
412
+ this.checkCallable();
413
+ this.interactive = reader;
414
+ return this;
415
+ }
416
+
417
+ /**
418
+ * The editor of `git am -i`'s `e`: given the path of `final-commit` and the message, the
419
+ * edited message (taken as it stands), or undefined when it failed (the message is kept).
420
+ */
421
+ setEditor(editor: AmMessageEditor): this {
422
+ this.checkCallable();
423
+ this.editor = editor;
424
+ return this;
425
+ }
426
+
427
+ /**
428
+ * `do_interactive`: true when the patch is to be skipped (`n`); `a` turns the questions
429
+ * off for the rest of this run.
430
+ */
431
+ private async doInteractive(st: AmState): Promise<boolean> {
432
+ const reader = this.interactive as AmInteractiveReader;
433
+ for (;;) {
434
+ this.out += `Commit Body is:\n--------------------------\n${st.msg ?? ""}--------------------------\n`;
435
+ const prompt = "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: ";
436
+ this.out += prompt;
437
+ const reply = await reader({
438
+ prompt,
439
+ message: latin1ToText(st.msg ?? ""),
440
+ output: latin1ToText(this.out),
441
+ });
442
+ if (reply === undefined) this.fatal("unable to read from stdin; aborting");
443
+ const c = reply.charAt(0).toLowerCase();
444
+ if (c === "y") return false;
445
+ if (c === "a") {
446
+ this.interactive = undefined;
447
+ return false;
448
+ }
449
+ if (c === "n") return true;
450
+ if (c === "e") {
451
+ if (!this.editor) continue;
452
+ const path = await this.hooks.gitPath(`${DIR}/final-commit`);
453
+ const edited = await this.editor(
454
+ path,
455
+ latin1ToText((await this.read("final-commit")) ?? ""),
456
+ );
457
+ if (edited !== undefined) {
458
+ const text = textToLatin1(edited);
459
+ await this.write("final-commit", text);
460
+ st.msg = text;
461
+ }
462
+ } else if (c === "v") {
463
+ this.out += (await this.read("patch")) ?? "";
464
+ }
465
+ }
466
+ }
467
+
468
+ /** `write_index_patch`: the index's diff from HEAD's tree into `patch`. */
469
+ private async writeIndexPatch(): Promise<void> {
470
+ const head = await this.headId();
471
+ const diff = new DiffCommand(this.workingCopy)
472
+ .setCached(true)
473
+ .setOldTree(head ?? this.objectFormat.emptyTreeId)
474
+ .setRenames(false)
475
+ .setOptions({
476
+ defaultPrefix: true,
477
+ ignoreConfigNoPrefix: true,
478
+ textconv: false,
479
+ uiConfig: false,
480
+ submoduleFormat: "short",
481
+ orderFile: "",
482
+ });
483
+ await this.write("patch", bytesToLatin1(await diff.callBytes("patch")));
484
+ }
485
+
288
486
  private state(): OperationState {
289
487
  return new OperationState(this.workingCopy.checkout, this.refsStore);
290
488
  }
@@ -351,6 +549,7 @@ export class AmCommand extends GitCommand<AmResult> {
351
549
  }
352
550
  if (mode === "abort") return this.abort();
353
551
  const st = await this.load();
552
+ if (mode === "show-raw" || mode === "show-diff") return this.showPatch(st, mode);
354
553
  if (mode === "skip") {
355
554
  // am_skip: clean_index(HEAD, HEAD), then the next patch
356
555
  const head = await this.headId();
@@ -370,9 +569,29 @@ export class AmCommand extends GitCommand<AmResult> {
370
569
  this.fatal(`Stray .git/${DIR} directory found.\nUse "git am --abort" to remove it.`);
371
570
  }
372
571
  if (this.resume) this.fatal("Resolve operation not in progress, we are not resuming.");
572
+ if (this.interactive && !this.mboxes.length) {
573
+ this.fatal("interactive mode requires patches on the command line");
574
+ }
373
575
  return this.setup();
374
576
  }
375
577
 
578
+ /** git's show_patch. */
579
+ private async showPatch(st: AmState, mode: "show-raw" | "show-diff"): Promise<AmResult> {
580
+ const original = (await this.read("original-commit"))?.trim();
581
+ if (original) {
582
+ // `git show <original-commit> --`
583
+ this.out += bytesToLatin1(await showCommitBytes(this.workingCopy, original));
584
+ return this.result(0);
585
+ }
586
+ const name = mode === "show-raw" ? String(st.cur).padStart(4, "0") : "patch";
587
+ const content = await this.read(name);
588
+ if (content === undefined) {
589
+ this.fatal(`failed to read '.git/${DIR}/${name}': No such file or directory`);
590
+ }
591
+ this.out += content;
592
+ return this.result(0);
593
+ }
594
+
376
595
  private async setup(): Promise<AmResult> {
377
596
  const state = this.state();
378
597
  const bool = (k: string) => {
@@ -388,7 +607,7 @@ export class AmCommand extends GitCommand<AmResult> {
388
607
  this.patchFormat ??
389
608
  (this.mboxrd
390
609
  ? "mboxrd"
391
- : first?.name !== undefined
610
+ : first?.name !== undefined && !first.maildir
392
611
  ? detectPatchFormat(first.content)
393
612
  : "mbox");
394
613
  if (!format) {
@@ -403,15 +622,18 @@ export class AmCommand extends GitCommand<AmResult> {
403
622
  };
404
623
  const inputs = this.mboxes.length ? this.mboxes : [{ content: "" }];
405
624
  if (format === "mbox" || format === "mboxrd") {
406
- for (const mbox of inputs) {
407
- // mailsplit: an empty file (git's isspace: space, tab, LF, CR) is an error, empty
408
- // standard input is not
409
- if (mbox.name !== undefined && /^[ \t\n\r]*$/.test(mbox.content)) {
410
- this.err += `error: empty mbox: '${mbox.name}'\n`;
411
- failSplit(`cannot split patches from ${mbox.name}`);
412
- }
413
- mails.push(...mailsplit(mbox.content, { keepCr, mboxrd: format === "mboxrd" }));
625
+ // split_mail_mbox: git mailsplit -d4 -b [--keep-cr] [--mboxrd] -- <paths>
626
+ const sources: MailsplitSource[] = inputs.map((m) =>
627
+ m.maildir
628
+ ? { maildir: m.maildir, name: m.name as string }
629
+ : { mbox: latin1ToBytes(m.content), ...(m.name !== undefined ? { name: m.name } : {}) },
630
+ );
631
+ const split = splitMail(sources, { allowBare: true, keepCr, mboxrd: format === "mboxrd" });
632
+ if (split.exitCode) {
633
+ this.err += split.errors;
634
+ this.fatal("Failed to split patches.");
414
635
  }
636
+ for (const f of split.files) mails.push(bytesToLatin1(f.content));
415
637
  } else if (format === "stgit-series") {
416
638
  // split_mail_stgit_series: one named series file, whose patches are files next to it
417
639
  // (this command reads no files: the first one cannot be opened)
@@ -430,6 +652,7 @@ export class AmCommand extends GitCommand<AmResult> {
430
652
  mails.push(stgitPatchToMail(""));
431
653
  } else {
432
654
  for (const mbox of inputs) {
655
+ if (mbox.maildir) failSplit(`could not open '${mbox.name}' for reading: Is a directory`);
433
656
  if (format === "stgit") mails.push(stgitPatchToMail(mbox.content));
434
657
  else {
435
658
  const r = hgPatchToMail(mbox.content);
@@ -450,7 +673,7 @@ export class AmCommand extends GitCommand<AmResult> {
450
673
  await this.writeText("keep", this.keep);
451
674
  await this.writeText("messageid", messageId ? "t" : "f");
452
675
  await this.writeText("scissors", this.scissors === undefined ? "" : this.scissors ? "t" : "f");
453
- await this.writeText("quoted-cr", "");
676
+ await this.writeText("quoted-cr", this.quotedCr ?? "");
454
677
  await this.writeText(
455
678
  "apply-opt",
456
679
  this.applyArgs()
@@ -482,6 +705,7 @@ export class AmCommand extends GitCommand<AmResult> {
482
705
  for (const e of o.include ?? []) args.push(`--include=${e}`);
483
706
  if (o.reject) args.push("--reject");
484
707
  if (o.ignoreWhitespace) args.push("--ignore-whitespace");
708
+ if (o.ignoreSpaceChange) args.push("--ignore-space-change");
485
709
  return args;
486
710
  }
487
711
 
@@ -497,6 +721,7 @@ export class AmCommand extends GitCommand<AmResult> {
497
721
  keep: ((await t("keep")) || "f") as "t" | "b" | "f",
498
722
  messageId: (await t("messageid")) === "t",
499
723
  scissors: await t("scissors"),
724
+ quotedCr: await t("quoted-cr"),
500
725
  applyOpts: sqDequoteAll(await t("apply-opt")),
501
726
  };
502
727
  const script = await this.read("author-script");
@@ -551,13 +776,14 @@ export class AmCommand extends GitCommand<AmResult> {
551
776
  (await this.patchIsEmpty()) &&
552
777
  (await this.indexHasChanges()).length === 0;
553
778
  if (bool("advice.mergeConflict") === false && !this.legacyMessages) throw new AmStop(128);
779
+ const cmd = this.interactive ? "git am -i" : "git am";
554
780
  const lines = [
555
- 'When you have resolved this problem, run "git am --continue".',
556
- 'If you prefer to skip this patch, run "git am --skip" instead.',
781
+ `When you have resolved this problem, run "${cmd} --continue".`,
782
+ `If you prefer to skip this patch, run "${cmd} --skip" instead.`,
557
783
  ...(patchEmptyAndClean
558
- ? ['To record the empty patch as an empty commit, run "git am --allow-empty".']
784
+ ? [`To record the empty patch as an empty commit, run "${cmd} --allow-empty".`]
559
785
  : []),
560
- 'To restore the original branch and stop patching, run "git am --abort".',
786
+ `To restore the original branch and stop patching, run "${cmd} --abort".`,
561
787
  ];
562
788
  if (this.legacyMessages) this.out += `${lines.join("\n")}\n`;
563
789
  else {
@@ -594,11 +820,16 @@ export class AmCommand extends GitCommand<AmResult> {
594
820
  this.fatal(`cannot resume: .git/${DIR}/final-commit does not exist.`);
595
821
  if (!st.author) this.fatal(`cannot resume: .git/${DIR}/author-script does not exist.`);
596
822
  } else {
823
+ // setup_mailinfo: mailinfo.scissors and mailinfo.quotedCr, then the session's options
824
+ const config = this.mailinfoConfig();
825
+ const quotedCr = (st.quotedCr || config.quotedCr) as "nowarn" | "warn" | "strip";
826
+ const useScissors = st.scissors ? st.scissors === "t" : config.scissors;
597
827
  const mi = mailinfo(mail, {
598
828
  keepSubject: st.keep === "t",
599
829
  keepNonPatchBrackets: st.keep === "b",
600
830
  addMessageId: st.messageId,
601
- ...(st.scissors ? { useScissors: st.scissors === "t" } : {}),
831
+ useScissors,
832
+ quotedCr,
602
833
  utf8: st.utf8,
603
834
  // metainfo_charset: get_commit_output_encoding()
604
835
  charset: configValue(this.workingCopy, "i18n.commitEncoding") ?? "UTF-8",
@@ -629,6 +860,11 @@ export class AmCommand extends GitCommand<AmResult> {
629
860
  );
630
861
  await this.write("final-commit", msg);
631
862
  }
863
+ if (this.interactive && (await this.doInteractive(st))) {
864
+ await this.next(st);
865
+ resume = false;
866
+ continue;
867
+ }
632
868
  let msg = st.msg as string;
633
869
  let toKeep = false;
634
870
  if (await this.patchIsEmpty()) {
@@ -689,22 +925,54 @@ export class AmCommand extends GitCommand<AmResult> {
689
925
  return this.result(0);
690
926
  }
691
927
 
928
+ /**
929
+ * `setup_mailinfo`'s config (`git_mailinfo_config`, in config order): `mailinfo.scissors`
930
+ * and `mailinfo.quotedCr`; a value git refuses dies as git's config callback does.
931
+ */
932
+ private mailinfoConfig(): { scissors: boolean; quotedCr: "nowarn" | "warn" | "strip" } {
933
+ const out: { scissors: boolean; quotedCr: "nowarn" | "warn" | "strip" } = {
934
+ scissors: false,
935
+ quotedCr: "warn",
936
+ };
937
+ if (!this.workingCopy.config) return out;
938
+ const store = RemoteConfigStore.from(this.workingCopy);
939
+ const where = (key: string, file?: string, line?: number) =>
940
+ file !== undefined && line !== undefined
941
+ ? `bad config variable '${key}' in file '${file}' at line ${line}`
942
+ : `unable to parse '${key}' from command-line config`;
943
+ const entries = store.entriesWithOriginFor(["mailinfo.scissors", "mailinfo.quotedcr"]) ?? [
944
+ ...store
945
+ .valuesWithOrigin("mailinfo.scissors")
946
+ .map((e) => ({ ...e, key: "mailinfo.scissors" })),
947
+ ...store
948
+ .valuesWithOrigin("mailinfo.quotedcr")
949
+ .map((e) => ({ ...e, key: "mailinfo.quotedcr" })),
950
+ ];
951
+ for (const e of entries) {
952
+ if (e.key === "mailinfo.scissors") {
953
+ const v = e.text === undefined ? true : parseGitBool(e.text);
954
+ if (v === undefined) this.fatal(`bad boolean config value '${e.text}' for '${e.key}'`);
955
+ out.scissors = v;
956
+ } else if (e.text === undefined) {
957
+ this.err += `error: missing value for '${e.key}'\n`;
958
+ this.fatal(where(e.key, e.file, e.line));
959
+ } else if (e.text === "nowarn" || e.text === "warn" || e.text === "strip") {
960
+ out.quotedCr = e.text;
961
+ } else {
962
+ this.err += `error: bad action '${e.text}' for '${e.key}'\n`;
963
+ this.fatal(where(e.key, e.file, e.line));
964
+ }
965
+ }
966
+ return out;
967
+ }
968
+
692
969
  private async runApply(st: AmState): Promise<number> {
693
970
  const patch = (await this.read("patch")) ?? "";
694
971
  const cmd = new ApplyCommand(this.workingCopy)
695
972
  .addPatch(latin1ToBytes(patch), `.git/${DIR}/patch`)
696
973
  .setIndex(true)
697
974
  .setLegacyMessages(this.legacyMessages);
698
- for (const a of st.applyOpts) {
699
- if (a.startsWith("-C")) cmd.setContext(Number(a.slice(2)));
700
- else if (a.startsWith("-p")) cmd.setStrip(Number(a.slice(2)));
701
- else if (a.startsWith("--whitespace=")) cmd.setWhitespace(a.slice(13));
702
- else if (a.startsWith("--directory=")) cmd.setDirectory(a.slice(12));
703
- else if (a.startsWith("--exclude=")) cmd.addExclude(a.slice(10));
704
- else if (a.startsWith("--include=")) cmd.addInclude(a.slice(10));
705
- else if (a === "--reject") cmd.setReject(true);
706
- else if (a === "--ignore-whitespace") cmd.setIgnoreWhitespace(true);
707
- }
975
+ configureApply(cmd, st.applyOpts);
708
976
  if (st.threeway) cmd.setVerbose(false);
709
977
  const r = await cmd.call();
710
978
  this.out += pathToLatin1(r.output);
@@ -722,10 +990,15 @@ export class AmCommand extends GitCommand<AmResult> {
722
990
  undefined as unknown as ApplyIO,
723
991
  () => undefined,
724
992
  async () => 0,
725
- () => false,
993
+ (pattern, text) => wildmatch(latin1ToPath(pattern), latin1ToPath(text)),
726
994
  );
727
995
  for (const a of st.applyOpts) {
728
- if (a.startsWith("-p")) {
996
+ // --include/--exclude limit the patches the fake ancestor is built from too
997
+ if (a.startsWith("--exclude=") || a.startsWith("--include=")) {
998
+ const include = a.startsWith("--include=");
999
+ parser.limitByName.push({ pattern: pathToLatin1(a.slice(10)), include });
1000
+ if (include) parser.hasInclude = true;
1001
+ } else if (a.startsWith("-p")) {
729
1002
  parser.pValue = Number(a.slice(2));
730
1003
  parser.pValueKnown = true;
731
1004
  } else if (a.startsWith("--directory="))
@@ -803,12 +1076,7 @@ export class AmCommand extends GitCommand<AmResult> {
803
1076
  .addPatch(latin1ToBytes(patch), `.git/${DIR}/patch`)
804
1077
  .setTemporaryIndex(fake)
805
1078
  .setLegacyMessages(this.legacyMessages);
806
- for (const a of st.applyOpts) {
807
- if (a.startsWith("-C")) apply.setContext(Number(a.slice(2)));
808
- else if (a.startsWith("-p")) apply.setStrip(Number(a.slice(2)));
809
- else if (a.startsWith("--whitespace=")) apply.setWhitespace(a.slice(13));
810
- else if (a.startsWith("--directory=")) apply.setDirectory(a.slice(12));
811
- }
1079
+ configureApply(apply, st.applyOpts);
812
1080
  const applied = await apply.call();
813
1081
  this.out += pathToLatin1(applied.output);
814
1082
  this.err += pathToLatin1(applied.errors);
@@ -921,17 +1189,49 @@ export class AmCommand extends GitCommand<AmResult> {
921
1189
  author = { ...author, name: latin1ToPath(author.name), email: latin1ToPath(author.email) };
922
1190
  const message = latin1ToPath(msg);
923
1191
  const parents = head ? [head] : [];
1192
+ // commit_tree_extended signs before writing: when it cannot, git's failure and nothing
1193
+ // written
1194
+ const sign = signRequestOf(this.workingCopy, this.sign);
924
1195
  const objects = this.workingCopy.history?.objects;
925
1196
  let id: ObjectId;
926
1197
  if (!isUtf8Encoding(commitEncoding) && objects) {
927
1198
  // commit_tree_extended: the `encoding` header, the message and idents as their bytes
928
- let text = `tree ${tree}\n`;
929
- for (const p of parents) text += `parent ${p}\n`;
930
- text += `author ${formatPersonIdent(author)}\ncommitter ${formatPersonIdent(committer)}\n`;
931
- text += `encoding ${commitEncoding}\n\n${message}`;
932
- id = await objects.putUnsized("commit", [encodeGitPath(text)]);
1199
+ let head = `tree ${tree}\n`;
1200
+ for (const p of parents) head += `parent ${p}\n`;
1201
+ head += `author ${formatPersonIdent(author)}\ncommitter ${formatPersonIdent(committer)}\n`;
1202
+ head += `encoding ${commitEncoding}\n`;
1203
+ const body = `\n${message}`;
1204
+ let header = "";
1205
+ if (sign !== undefined) {
1206
+ const payload = encodeGitPath(head + body);
1207
+ const signature = latin1ToPath(
1208
+ bytesToLatin1(
1209
+ await this.signOrDie((cwd) =>
1210
+ signPayload(this.workingCopy, sign, payload, {
1211
+ committer,
1212
+ tail: [],
1213
+ ...(cwd !== undefined ? { cwd } : {}),
1214
+ }),
1215
+ ),
1216
+ ),
1217
+ );
1218
+ // add_header_signature: the repository's header (`gpgsig`, `gpgsig-sha256` in a
1219
+ // SHA-256 repository) after the other headers, continuation lines indented
1220
+ const lines = (signature.endsWith("\n") ? signature.slice(0, -1) : signature).split("\n");
1221
+ header = `${this.objectFormat.signatureHeader} ${lines.join("\n ")}\n`;
1222
+ }
1223
+ id = await objects.putUnsized("commit", [encodeGitPath(head + header + body)]);
933
1224
  } else {
934
- id = await this.commits.store({ tree, parents, author, committer, message });
1225
+ let commit: Commit = { tree, parents, author, committer, message };
1226
+ if (sign !== undefined) {
1227
+ commit = await this.signOrDie((cwd) =>
1228
+ signCommit(this.workingCopy, sign, commit, {
1229
+ tail: [],
1230
+ ...(cwd !== undefined ? { cwd } : {}),
1231
+ }),
1232
+ );
1233
+ }
1234
+ id = await this.commits.store(commit);
935
1235
  }
936
1236
  const action = this.reflogAction("am");
937
1237
  // do_commit's update_ref("HEAD", commit, old_oid): HEAD expecting the commit it left
@@ -945,6 +1245,30 @@ export class AmCommand extends GitCommand<AmResult> {
945
1245
  await this.runAmHook("post-applypatch");
946
1246
  }
947
1247
 
1248
+ /**
1249
+ * Runs a signing (`run(cwd)`, the signing program in the worktree top) as do_commit's
1250
+ * commit_tree: a signature that cannot be made adds gpg's lines and dies with `fatal:
1251
+ * failed to write commit object` (exit 128), or as the signing itself died.
1252
+ */
1253
+ private async signOrDie<T>(run: (cwd: string | undefined) => Promise<T>): Promise<T> {
1254
+ let cwd: string | undefined;
1255
+ try {
1256
+ cwd = await this.hooks.hostWorkingDirectory();
1257
+ } catch {
1258
+ cwd = undefined;
1259
+ }
1260
+ try {
1261
+ return await run(cwd);
1262
+ } catch (error) {
1263
+ if (!(error instanceof SigningFailedError)) throw error;
1264
+ const lines = error.message.split("\n");
1265
+ this.err += `${lines.map(pathToLatin1).join("\n")}\n`;
1266
+ // the signing died itself (ssh without a key): nothing follows
1267
+ if (lines[lines.length - 1]?.startsWith("fatal: ")) throw new AmStop(128);
1268
+ this.fatal("failed to write commit object");
1269
+ }
1270
+ }
1271
+
948
1272
  private async resolve(st: AmState, allowEmpty: boolean): Promise<AmResult> {
949
1273
  if (st.msg === undefined) this.fatal(`cannot resume: .git/${DIR}/final-commit does not exist.`);
950
1274
  if (!st.author) this.fatal(`cannot resume: .git/${DIR}/author-script does not exist.`);
@@ -964,6 +1288,13 @@ export class AmCommand extends GitCommand<AmResult> {
964
1288
  "You still have unmerged paths in your index.\nYou should 'git add' each file with resolved conflicts to mark them as such.\nYou might run `git rm` on a file to accept \"deleted by them\" for it.\n";
965
1289
  await this.dieUserResolve();
966
1290
  }
1291
+ if (this.interactive) {
1292
+ await this.writeIndexPatch();
1293
+ if (await this.doInteractive(st)) {
1294
+ await this.next(st);
1295
+ return this.amRun(await this.load(), false);
1296
+ }
1297
+ }
967
1298
  await this.doCommit(st);
968
1299
  await this.next(st);
969
1300
  return this.amRun(await this.load(), false);
@@ -1026,6 +1357,27 @@ export class AmCommand extends GitCommand<AmResult> {
1026
1357
  }
1027
1358
  }
1028
1359
 
1360
+ /** A read of `git am -i`'s "Apply?" prompt (see `AmCommand.setInteractive`). */
1361
+ export interface AmInteractiveRequest {
1362
+ /** The prompt as git prints it */
1363
+ prompt: string;
1364
+ /** The commit message shown ("Commit Body is:") */
1365
+ message: string;
1366
+ /** What `git am` printed so far on standard output */
1367
+ output: string;
1368
+ }
1369
+
1370
+ /** Answers `git am -i`'s question: the line typed, or undefined at the end of input. */
1371
+ export type AmInteractiveReader = (
1372
+ request: AmInteractiveRequest,
1373
+ ) => string | undefined | Promise<string | undefined>;
1374
+
1375
+ /** The editor of `git am -i`'s `e`: the edited message, or undefined when it failed. */
1376
+ export type AmMessageEditor = (
1377
+ path: string,
1378
+ message: string,
1379
+ ) => string | undefined | Promise<string | undefined>;
1380
+
1029
1381
  interface AmState {
1030
1382
  cur: number;
1031
1383
  last: number;
@@ -1036,6 +1388,8 @@ interface AmState {
1036
1388
  keep: "t" | "b" | "f";
1037
1389
  messageId: boolean;
1038
1390
  scissors: string;
1391
+ /** `quoted-cr`: nowarn, warn, strip, or empty (`mailinfo.quotedCr`) */
1392
+ quotedCr: string;
1039
1393
  applyOpts: string[];
1040
1394
  author?: { name: string; email: string; date: string };
1041
1395
  msg?: string;