@statewalker/vcs-commands 0.9.0 → 0.11.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 (468) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/add-command.d.ts.map +1 -1
  3. package/dist/commands/add-patch/patch-backend.d.ts +2 -0
  4. package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
  5. package/dist/commands/add-patch/patch-modes.d.ts +6 -2
  6. package/dist/commands/add-patch/patch-modes.d.ts.map +1 -1
  7. package/dist/commands/add-patch/patch-session.d.ts +4 -0
  8. package/dist/commands/add-patch/patch-session.d.ts.map +1 -1
  9. package/dist/commands/am/am-command.d.ts +41 -2
  10. package/dist/commands/am/am-command.d.ts.map +1 -1
  11. package/dist/commands/apply/index.d.ts +1 -1
  12. package/dist/commands/apply/index.d.ts.map +1 -1
  13. package/dist/commands/archive/archive-command.d.ts +169 -0
  14. package/dist/commands/archive/archive-command.d.ts.map +1 -0
  15. package/dist/commands/archive/archive-entry.d.ts +60 -0
  16. package/dist/commands/archive/archive-entry.d.ts.map +1 -0
  17. package/dist/commands/archive/index.d.ts +8 -0
  18. package/dist/commands/archive/index.d.ts.map +1 -0
  19. package/dist/commands/archive/remote-archive-command.d.ts +56 -0
  20. package/dist/commands/archive/remote-archive-command.d.ts.map +1 -0
  21. package/dist/commands/archive/tar-archive.d.ts +31 -0
  22. package/dist/commands/archive/tar-archive.d.ts.map +1 -0
  23. package/dist/commands/archive/tar-commit-id.d.ts +13 -0
  24. package/dist/commands/archive/tar-commit-id.d.ts.map +1 -0
  25. package/dist/commands/archive/upload-archive-writer.d.ts +48 -0
  26. package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -0
  27. package/dist/commands/archive/zip-archive.d.ts +42 -0
  28. package/dist/commands/archive/zip-archive.d.ts.map +1 -0
  29. package/dist/commands/attributes-source.d.ts +10 -0
  30. package/dist/commands/attributes-source.d.ts.map +1 -1
  31. package/dist/commands/blame-command.d.ts +43 -1
  32. package/dist/commands/blame-command.d.ts.map +1 -1
  33. package/dist/commands/bundle/bundle-create-command.d.ts +67 -0
  34. package/dist/commands/bundle/bundle-create-command.d.ts.map +1 -0
  35. package/dist/commands/bundle/bundle-format.d.ts +89 -0
  36. package/dist/commands/bundle/bundle-format.d.ts.map +1 -0
  37. package/dist/commands/bundle/bundle-list.d.ts +92 -0
  38. package/dist/commands/bundle/bundle-list.d.ts.map +1 -0
  39. package/dist/commands/bundle/bundle-read-commands.d.ts +81 -0
  40. package/dist/commands/bundle/bundle-read-commands.d.ts.map +1 -0
  41. package/dist/commands/bundle/bundle-support.d.ts +32 -0
  42. package/dist/commands/bundle/bundle-support.d.ts.map +1 -0
  43. package/dist/commands/bundle/bundle-transport.d.ts +38 -0
  44. package/dist/commands/bundle/bundle-transport.d.ts.map +1 -0
  45. package/dist/commands/bundle/bundle-uri-host.d.ts +43 -0
  46. package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -0
  47. package/dist/commands/bundle/bundle-uri.d.ts +55 -0
  48. package/dist/commands/bundle/bundle-uri.d.ts.map +1 -0
  49. package/dist/commands/bundle/bundle-verify.d.ts +63 -0
  50. package/dist/commands/bundle/bundle-verify.d.ts.map +1 -0
  51. package/dist/commands/bundle/index.d.ts +14 -0
  52. package/dist/commands/bundle/index.d.ts.map +1 -0
  53. package/dist/commands/cat-file/batch-format.d.ts +58 -0
  54. package/dist/commands/cat-file/batch-format.d.ts.map +1 -0
  55. package/dist/commands/cat-file/cat-file-command.d.ts +144 -0
  56. package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -0
  57. package/dist/commands/cat-file/index.d.ts +3 -0
  58. package/dist/commands/cat-file/index.d.ts.map +1 -0
  59. package/dist/commands/check-attr-command.d.ts +66 -0
  60. package/dist/commands/check-attr-command.d.ts.map +1 -0
  61. package/dist/commands/check-ignore-command.d.ts +58 -0
  62. package/dist/commands/check-ignore-command.d.ts.map +1 -0
  63. package/dist/commands/check-ref-format-command.d.ts +60 -0
  64. package/dist/commands/check-ref-format-command.d.ts.map +1 -0
  65. package/dist/commands/checkout-command.d.ts.map +1 -1
  66. package/dist/commands/checkout-index-command.d.ts +96 -0
  67. package/dist/commands/checkout-index-command.d.ts.map +1 -0
  68. package/dist/commands/cherry-pick-command.d.ts +10 -0
  69. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  70. package/dist/commands/clone-command.d.ts +28 -0
  71. package/dist/commands/clone-command.d.ts.map +1 -1
  72. package/dist/commands/commit-command.d.ts +9 -1
  73. package/dist/commands/commit-command.d.ts.map +1 -1
  74. package/dist/commands/config-command.d.ts +2 -0
  75. package/dist/commands/config-command.d.ts.map +1 -1
  76. package/dist/commands/daemon-access-hook.d.ts +36 -0
  77. package/dist/commands/daemon-access-hook.d.ts.map +1 -0
  78. package/dist/commands/default-branch.d.ts +54 -0
  79. package/dist/commands/default-branch.d.ts.map +1 -1
  80. package/dist/commands/diff-command.d.ts +132 -5
  81. package/dist/commands/diff-command.d.ts.map +1 -1
  82. package/dist/commands/diff-external.d.ts +43 -0
  83. package/dist/commands/diff-external.d.ts.map +1 -0
  84. package/dist/commands/diff-plumbing/diff-pairs-command.d.ts +27 -0
  85. package/dist/commands/diff-plumbing/diff-pairs-command.d.ts.map +1 -0
  86. package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts +129 -0
  87. package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts.map +1 -0
  88. package/dist/commands/diff-plumbing/index.d.ts +3 -0
  89. package/dist/commands/diff-plumbing/index.d.ts.map +1 -0
  90. package/dist/commands/diff-textconv.d.ts +5 -1
  91. package/dist/commands/diff-textconv.d.ts.map +1 -1
  92. package/dist/commands/fast-export/fast-export-command.d.ts +135 -0
  93. package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -0
  94. package/dist/commands/fast-export/fast-import-command.d.ts +182 -0
  95. package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -0
  96. package/dist/commands/fast-export/fast-stream-support.d.ts +64 -0
  97. package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -0
  98. package/dist/commands/fast-export/index.d.ts +4 -0
  99. package/dist/commands/fast-export/index.d.ts.map +1 -0
  100. package/dist/commands/fetch-command.d.ts +65 -0
  101. package/dist/commands/fetch-command.d.ts.map +1 -1
  102. package/dist/commands/fetch-multiple-command.d.ts.map +1 -1
  103. package/dist/commands/format-rev-command.d.ts +60 -0
  104. package/dist/commands/format-rev-command.d.ts.map +1 -0
  105. package/dist/commands/fsck/fsck-command.d.ts.map +1 -1
  106. package/dist/commands/fsck/fsck-msg-ids.d.ts +18 -3
  107. package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -1
  108. package/dist/commands/fsmonitor-ipc.d.ts +30 -0
  109. package/dist/commands/fsmonitor-ipc.d.ts.map +1 -0
  110. package/dist/commands/fsmonitor-refresh.d.ts +69 -0
  111. package/dist/commands/fsmonitor-refresh.d.ts.map +1 -0
  112. package/dist/commands/gc-command.d.ts +5 -0
  113. package/dist/commands/gc-command.d.ts.map +1 -1
  114. package/dist/commands/git-hooks.d.ts +32 -0
  115. package/dist/commands/git-hooks.d.ts.map +1 -1
  116. package/dist/commands/git-paths.d.ts +26 -0
  117. package/dist/commands/git-paths.d.ts.map +1 -0
  118. package/dist/commands/grep/grep-command.d.ts +2 -1
  119. package/dist/commands/grep/grep-command.d.ts.map +1 -1
  120. package/dist/commands/history-command.d.ts +156 -0
  121. package/dist/commands/history-command.d.ts.map +1 -0
  122. package/dist/commands/http-config.d.ts +38 -0
  123. package/dist/commands/http-config.d.ts.map +1 -0
  124. package/dist/commands/index-adder.d.ts +12 -1
  125. package/dist/commands/index-adder.d.ts.map +1 -1
  126. package/dist/commands/index-host.d.ts.map +1 -1
  127. package/dist/commands/index.d.ts +45 -1
  128. package/dist/commands/index.d.ts.map +1 -1
  129. package/dist/commands/index.js +6 -5
  130. package/dist/commands/init-command.d.ts.map +1 -1
  131. package/dist/commands/last-modified-command.d.ts +102 -0
  132. package/dist/commands/last-modified-command.d.ts.map +1 -0
  133. package/dist/commands/lfs/go-url.d.ts +43 -0
  134. package/dist/commands/lfs/go-url.d.ts.map +1 -0
  135. package/dist/commands/lfs/index.d.ts +3 -0
  136. package/dist/commands/lfs/index.d.ts.map +1 -0
  137. package/dist/commands/lfs/lfs-config.d.ts +174 -0
  138. package/dist/commands/lfs/lfs-config.d.ts.map +1 -0
  139. package/dist/commands/lfs/lfs-endpoint-command.d.ts +83 -0
  140. package/dist/commands/lfs/lfs-endpoint-command.d.ts.map +1 -0
  141. package/dist/commands/local-transport.d.ts.map +1 -1
  142. package/dist/commands/log-command.d.ts +26 -0
  143. package/dist/commands/log-command.d.ts.map +1 -1
  144. package/dist/commands/log-output.d.ts +28 -1
  145. package/dist/commands/log-output.d.ts.map +1 -1
  146. package/dist/commands/ls-files-command.d.ts +153 -0
  147. package/dist/commands/ls-files-command.d.ts.map +1 -0
  148. package/dist/commands/ls-remote-command.d.ts +5 -0
  149. package/dist/commands/ls-remote-command.d.ts.map +1 -1
  150. package/dist/commands/ls-tree-command.d.ts +105 -0
  151. package/dist/commands/ls-tree-command.d.ts.map +1 -0
  152. package/dist/commands/maintenance-run-command.d.ts +122 -0
  153. package/dist/commands/maintenance-run-command.d.ts.map +1 -0
  154. package/dist/commands/merge-command.d.ts +7 -0
  155. package/dist/commands/merge-command.d.ts.map +1 -1
  156. package/dist/commands/merge-config.d.ts +7 -0
  157. package/dist/commands/merge-config.d.ts.map +1 -1
  158. package/dist/commands/merge-drivers.d.ts +67 -5
  159. package/dist/commands/merge-drivers.d.ts.map +1 -1
  160. package/dist/commands/merge-support.d.ts +6 -0
  161. package/dist/commands/merge-support.d.ts.map +1 -1
  162. package/dist/commands/merge-tree-command.d.ts +122 -0
  163. package/dist/commands/merge-tree-command.d.ts.map +1 -0
  164. package/dist/commands/mktag-command.d.ts +51 -0
  165. package/dist/commands/mktag-command.d.ts.map +1 -0
  166. package/dist/commands/object-store/count-objects-command.d.ts +58 -0
  167. package/dist/commands/object-store/count-objects-command.d.ts.map +1 -0
  168. package/dist/commands/object-store/index.d.ts +5 -0
  169. package/dist/commands/object-store/index.d.ts.map +1 -0
  170. package/dist/commands/object-store/objects-directory.d.ts +12 -0
  171. package/dist/commands/object-store/objects-directory.d.ts.map +1 -0
  172. package/dist/commands/object-store/prune-command.d.ts +38 -0
  173. package/dist/commands/object-store/prune-command.d.ts.map +1 -0
  174. package/dist/commands/object-store/show-index-command.d.ts +23 -0
  175. package/dist/commands/object-store/show-index-command.d.ts.map +1 -0
  176. package/dist/commands/ort-merge.d.ts +24 -0
  177. package/dist/commands/ort-merge.d.ts.map +1 -1
  178. package/dist/commands/patch-id-command.d.ts +30 -0
  179. package/dist/commands/patch-id-command.d.ts.map +1 -0
  180. package/dist/commands/patch-id.d.ts +24 -0
  181. package/dist/commands/patch-id.d.ts.map +1 -1
  182. package/dist/commands/plumbing-command.d.ts +66 -0
  183. package/dist/commands/plumbing-command.d.ts.map +1 -0
  184. package/dist/commands/plumbing-input.d.ts +38 -0
  185. package/dist/commands/plumbing-input.d.ts.map +1 -0
  186. package/dist/commands/promisor-remote-reply.d.ts +35 -0
  187. package/dist/commands/promisor-remote-reply.d.ts.map +1 -0
  188. package/dist/commands/promisor-remote.d.ts.map +1 -1
  189. package/dist/commands/pull-command.d.ts.map +1 -1
  190. package/dist/commands/push-command.d.ts +17 -2
  191. package/dist/commands/push-command.d.ts.map +1 -1
  192. package/dist/commands/rebase-command.d.ts +108 -2
  193. package/dist/commands/rebase-command.d.ts.map +1 -1
  194. package/dist/commands/refs-command.d.ts +81 -0
  195. package/dist/commands/refs-command.d.ts.map +1 -0
  196. package/dist/commands/remote-object-info-command.d.ts +55 -0
  197. package/dist/commands/remote-object-info-command.d.ts.map +1 -0
  198. package/dist/commands/remote-transport.d.ts +40 -3
  199. package/dist/commands/remote-transport.d.ts.map +1 -1
  200. package/dist/commands/repack-command.d.ts +115 -0
  201. package/dist/commands/repack-command.d.ts.map +1 -0
  202. package/dist/commands/replace-command.d.ts +143 -0
  203. package/dist/commands/replace-command.d.ts.map +1 -0
  204. package/dist/commands/replay-command.d.ts +117 -0
  205. package/dist/commands/replay-command.d.ts.map +1 -0
  206. package/dist/commands/repo-command.d.ts +158 -0
  207. package/dist/commands/repo-command.d.ts.map +1 -0
  208. package/dist/commands/request-pull-command.d.ts +82 -0
  209. package/dist/commands/request-pull-command.d.ts.map +1 -0
  210. package/dist/commands/rerere-command.d.ts +36 -0
  211. package/dist/commands/rerere-command.d.ts.map +1 -0
  212. package/dist/commands/rerere.d.ts +102 -0
  213. package/dist/commands/rerere.d.ts.map +1 -0
  214. package/dist/commands/reset-command.d.ts +19 -2
  215. package/dist/commands/reset-command.d.ts.map +1 -1
  216. package/dist/commands/rev-filter/commit-grep.d.ts +3 -1
  217. package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -1
  218. package/dist/commands/rev-list-command.d.ts +3 -0
  219. package/dist/commands/rev-list-command.d.ts.map +1 -1
  220. package/dist/commands/rev-parse-command.d.ts +5 -0
  221. package/dist/commands/rev-parse-command.d.ts.map +1 -1
  222. package/dist/commands/revert-command.d.ts +10 -0
  223. package/dist/commands/revert-command.d.ts.map +1 -1
  224. package/dist/commands/revision-range.d.ts +5 -0
  225. package/dist/commands/revision-range.d.ts.map +1 -1
  226. package/dist/commands/revision-resolver.d.ts +27 -1
  227. package/dist/commands/revision-resolver.d.ts.map +1 -1
  228. package/dist/commands/sequencer-pick.d.ts +18 -0
  229. package/dist/commands/sequencer-pick.d.ts.map +1 -1
  230. package/dist/commands/serve-repository.d.ts +23 -1
  231. package/dist/commands/serve-repository.d.ts.map +1 -1
  232. package/dist/commands/session-id.d.ts +18 -0
  233. package/dist/commands/session-id.d.ts.map +1 -0
  234. package/dist/commands/show-branch-command.d.ts +59 -0
  235. package/dist/commands/show-branch-command.d.ts.map +1 -0
  236. package/dist/commands/show-ref-command.d.ts +112 -0
  237. package/dist/commands/show-ref-command.d.ts.map +1 -0
  238. package/dist/commands/signature-check.d.ts +9 -2
  239. package/dist/commands/signature-check.d.ts.map +1 -1
  240. package/dist/commands/signing.d.ts +30 -2
  241. package/dist/commands/signing.d.ts.map +1 -1
  242. package/dist/commands/stash-apply-command.d.ts.map +1 -1
  243. package/dist/commands/stash-export-command.d.ts +115 -0
  244. package/dist/commands/stash-export-command.d.ts.map +1 -0
  245. package/dist/commands/status-command.d.ts +16 -2
  246. package/dist/commands/status-command.d.ts.map +1 -1
  247. package/dist/commands/stripspace-command.d.ts +44 -0
  248. package/dist/commands/stripspace-command.d.ts.map +1 -0
  249. package/dist/commands/submodule-add-command.d.ts +22 -1
  250. package/dist/commands/submodule-add-command.d.ts.map +1 -1
  251. package/dist/commands/submodule-auth.d.ts +3 -1
  252. package/dist/commands/submodule-auth.d.ts.map +1 -1
  253. package/dist/commands/submodule-commands.d.ts +9 -1
  254. package/dist/commands/submodule-commands.d.ts.map +1 -1
  255. package/dist/commands/submodule-update-command.d.ts +27 -1
  256. package/dist/commands/submodule-update-command.d.ts.map +1 -1
  257. package/dist/commands/tag-command.d.ts.map +1 -1
  258. package/dist/commands/textconv-cache.d.ts +58 -0
  259. package/dist/commands/textconv-cache.d.ts.map +1 -0
  260. package/dist/commands/tree-restore.d.ts +5 -0
  261. package/dist/commands/tree-restore.d.ts.map +1 -1
  262. package/dist/commands/unpack-objects-command.d.ts +47 -0
  263. package/dist/commands/unpack-objects-command.d.ts.map +1 -0
  264. package/dist/commands/update-index-command.d.ts +131 -0
  265. package/dist/commands/update-index-command.d.ts.map +1 -0
  266. package/dist/commands/uri-protocols.d.ts +13 -0
  267. package/dist/commands/uri-protocols.d.ts.map +1 -0
  268. package/dist/commands/url-parse-command.d.ts +30 -0
  269. package/dist/commands/url-parse-command.d.ts.map +1 -0
  270. package/dist/commands/var-command.d.ts +42 -0
  271. package/dist/commands/var-command.d.ts.map +1 -0
  272. package/dist/{commands-CNvli5bl.js → commands-bQQ9OmCh.js} +52514 -44630
  273. package/dist/errors/command-errors.d.ts +33 -0
  274. package/dist/errors/command-errors.d.ts.map +1 -1
  275. package/dist/errors/index.js +39 -1
  276. package/dist/{fsck-CPeDh9fh.js → fsck-BHT9bUS-.js} +184 -143
  277. package/dist/git-command.d.ts +66 -4
  278. package/dist/git-command.d.ts.map +1 -1
  279. package/dist/git.d.ts +532 -1
  280. package/dist/git.d.ts.map +1 -1
  281. package/dist/guarded-transport-command.d.ts +3 -1
  282. package/dist/guarded-transport-command.d.ts.map +1 -1
  283. package/dist/index.js +7 -6
  284. package/dist/maintenance-run-command-Cx2PlGV9.js +13544 -0
  285. package/dist/{remote-transport-CCmBadm-.js → remote-transport-BrQZfyHu.js} +1009 -10
  286. package/dist/results/cherry-pick-result.d.ts +6 -0
  287. package/dist/results/cherry-pick-result.d.ts.map +1 -1
  288. package/dist/results/diff-entry.d.ts +10 -0
  289. package/dist/results/diff-entry.d.ts.map +1 -1
  290. package/dist/results/diff-formatter.d.ts.map +1 -1
  291. package/dist/results/diff-output.d.ts +49 -3
  292. package/dist/results/diff-output.d.ts.map +1 -1
  293. package/dist/results/fetch-result.d.ts +12 -0
  294. package/dist/results/fetch-result.d.ts.map +1 -1
  295. package/dist/results/index.js +2 -2
  296. package/dist/results/merge-result.d.ts +5 -0
  297. package/dist/results/merge-result.d.ts.map +1 -1
  298. package/dist/results/push-result.d.ts +5 -0
  299. package/dist/results/push-result.d.ts.map +1 -1
  300. package/dist/results/rebase-result.d.ts +7 -0
  301. package/dist/results/rebase-result.d.ts.map +1 -1
  302. package/dist/results/revert-result.d.ts +6 -0
  303. package/dist/results/revert-result.d.ts.map +1 -1
  304. package/dist/results/stash-result.d.ts +5 -0
  305. package/dist/results/stash-result.d.ts.map +1 -1
  306. package/dist/{results-BDuEgdLU.js → results-CNHQnU5Y.js} +13707 -10608
  307. package/dist/transport-command.d.ts +79 -1
  308. package/dist/transport-command.d.ts.map +1 -1
  309. package/package.json +13 -13
  310. package/src/commands/add-command.ts +3 -0
  311. package/src/commands/add-patch/patch-backend.ts +4 -1
  312. package/src/commands/add-patch/patch-modes.ts +26 -2
  313. package/src/commands/add-patch/patch-session.ts +6 -0
  314. package/src/commands/am/am-command.ts +193 -22
  315. package/src/commands/apply/index.ts +1 -0
  316. package/src/commands/archive/archive-command.ts +1148 -0
  317. package/src/commands/archive/archive-entry.ts +93 -0
  318. package/src/commands/archive/index.ts +7 -0
  319. package/src/commands/archive/remote-archive-command.ts +140 -0
  320. package/src/commands/archive/tar-archive.ts +207 -0
  321. package/src/commands/archive/tar-commit-id.ts +72 -0
  322. package/src/commands/archive/upload-archive-writer.ts +213 -0
  323. package/src/commands/archive/zip-archive.ts +317 -0
  324. package/src/commands/attributes-source.ts +26 -12
  325. package/src/commands/blame-command.ts +118 -19
  326. package/src/commands/bundle/bundle-create-command.ts +405 -0
  327. package/src/commands/bundle/bundle-format.ts +228 -0
  328. package/src/commands/bundle/bundle-list.ts +276 -0
  329. package/src/commands/bundle/bundle-read-commands.ts +157 -0
  330. package/src/commands/bundle/bundle-support.ts +85 -0
  331. package/src/commands/bundle/bundle-transport.ts +107 -0
  332. package/src/commands/bundle/bundle-uri-host.ts +204 -0
  333. package/src/commands/bundle/bundle-uri.ts +236 -0
  334. package/src/commands/bundle/bundle-verify.ts +152 -0
  335. package/src/commands/bundle/index.ts +14 -0
  336. package/src/commands/cat-file/batch-format.ts +193 -0
  337. package/src/commands/cat-file/cat-file-command.ts +895 -0
  338. package/src/commands/cat-file/index.ts +2 -0
  339. package/src/commands/check-attr-command.ts +333 -0
  340. package/src/commands/check-ignore-command.ts +261 -0
  341. package/src/commands/check-ref-format-command.ts +129 -0
  342. package/src/commands/checkout-command.ts +61 -22
  343. package/src/commands/checkout-index-command.ts +568 -0
  344. package/src/commands/checkout-paths.ts +7 -0
  345. package/src/commands/cherry-pick-command.ts +21 -1
  346. package/src/commands/clone-command.ts +249 -9
  347. package/src/commands/commit-command.ts +22 -4
  348. package/src/commands/config-command.ts +9 -0
  349. package/src/commands/daemon-access-hook.ts +78 -0
  350. package/src/commands/default-branch.ts +118 -1
  351. package/src/commands/diff-command.ts +592 -47
  352. package/src/commands/diff-external.ts +131 -0
  353. package/src/commands/diff-plumbing/diff-pairs-command.ts +193 -0
  354. package/src/commands/diff-plumbing/diff-plumbing-command.ts +424 -0
  355. package/src/commands/diff-plumbing/index.ts +2 -0
  356. package/src/commands/diff-textconv.ts +5 -1
  357. package/src/commands/fast-export/fast-export-command.ts +911 -0
  358. package/src/commands/fast-export/fast-import-command.ts +1553 -0
  359. package/src/commands/fast-export/fast-stream-support.ts +162 -0
  360. package/src/commands/fast-export/index.ts +3 -0
  361. package/src/commands/fetch-command.ts +312 -8
  362. package/src/commands/fetch-multiple-command.ts +4 -1
  363. package/src/commands/format-rev-command.ts +267 -0
  364. package/src/commands/fsck/fsck-command.ts +47 -20
  365. package/src/commands/fsck/fsck-msg-ids.ts +19 -3
  366. package/src/commands/fsck/fsck-pack.ts +2 -2
  367. package/src/commands/fsmonitor-ipc.ts +121 -0
  368. package/src/commands/fsmonitor-refresh.ts +320 -0
  369. package/src/commands/gc-command.ts +10 -0
  370. package/src/commands/git-hooks.ts +123 -6
  371. package/src/commands/git-paths.ts +136 -0
  372. package/src/commands/grep/grep-command.ts +38 -15
  373. package/src/commands/history-command.ts +617 -0
  374. package/src/commands/http-config.ts +139 -0
  375. package/src/commands/index-adder.ts +37 -3
  376. package/src/commands/index-host.ts +6 -1
  377. package/src/commands/index.ts +46 -0
  378. package/src/commands/init-command.ts +14 -0
  379. package/src/commands/last-modified-command.ts +804 -0
  380. package/src/commands/lfs/go-url.ts +370 -0
  381. package/src/commands/lfs/index.ts +2 -0
  382. package/src/commands/lfs/lfs-config.ts +738 -0
  383. package/src/commands/lfs/lfs-endpoint-command.ts +180 -0
  384. package/src/commands/local-transport.ts +252 -4
  385. package/src/commands/log-command.ts +104 -5
  386. package/src/commands/log-output.ts +66 -5
  387. package/src/commands/ls-files-command.ts +1177 -0
  388. package/src/commands/ls-remote-command.ts +6 -0
  389. package/src/commands/ls-tree-command.ts +708 -0
  390. package/src/commands/maintenance-run-command.ts +949 -0
  391. package/src/commands/merge-command.ts +78 -32
  392. package/src/commands/merge-config.ts +23 -1
  393. package/src/commands/merge-drivers.ts +109 -20
  394. package/src/commands/merge-support.ts +29 -5
  395. package/src/commands/merge-tree-command.ts +786 -0
  396. package/src/commands/mktag-command.ts +149 -0
  397. package/src/commands/object-store/count-objects-command.ts +404 -0
  398. package/src/commands/object-store/index.ts +4 -0
  399. package/src/commands/object-store/objects-directory.ts +24 -0
  400. package/src/commands/object-store/prune-command.ts +129 -0
  401. package/src/commands/object-store/show-index-command.ts +151 -0
  402. package/src/commands/ort-merge.ts +92 -25
  403. package/src/commands/patch-id-command.ts +65 -0
  404. package/src/commands/patch-id.ts +218 -0
  405. package/src/commands/plumbing-command.ts +141 -0
  406. package/src/commands/plumbing-input.ts +87 -0
  407. package/src/commands/promisor-remote-reply.ts +276 -0
  408. package/src/commands/promisor-remote.ts +25 -2
  409. package/src/commands/pull-command.ts +2 -0
  410. package/src/commands/push-command.ts +87 -5
  411. package/src/commands/rebase-command.ts +507 -19
  412. package/src/commands/refs-command.ts +274 -0
  413. package/src/commands/remote-object-info-command.ts +109 -0
  414. package/src/commands/remote-transport.ts +116 -1
  415. package/src/commands/repack-command.ts +383 -0
  416. package/src/commands/replace-command.ts +816 -0
  417. package/src/commands/replay-command.ts +674 -0
  418. package/src/commands/repo-command.ts +1066 -0
  419. package/src/commands/request-pull-command.ts +356 -0
  420. package/src/commands/rerere-command.ts +179 -0
  421. package/src/commands/rerere.ts +925 -0
  422. package/src/commands/reset-command.ts +75 -3
  423. package/src/commands/rev-filter/commit-grep.ts +7 -2
  424. package/src/commands/rev-list-command.ts +9 -0
  425. package/src/commands/rev-parse-command.ts +49 -5
  426. package/src/commands/revert-command.ts +21 -1
  427. package/src/commands/revision-range.ts +7 -2
  428. package/src/commands/revision-resolver.ts +97 -14
  429. package/src/commands/sequencer-pick.ts +47 -0
  430. package/src/commands/serve-repository.ts +65 -0
  431. package/src/commands/session-id.ts +31 -0
  432. package/src/commands/show-branch-command.ts +981 -0
  433. package/src/commands/show-command.ts +1 -1
  434. package/src/commands/show-ref-command.ts +439 -0
  435. package/src/commands/signature-check.ts +37 -5
  436. package/src/commands/signing.ts +176 -23
  437. package/src/commands/stash-apply-command.ts +3 -0
  438. package/src/commands/stash-export-command.ts +397 -0
  439. package/src/commands/status-command.ts +74 -8
  440. package/src/commands/stripspace-command.ts +118 -0
  441. package/src/commands/submodule-add-command.ts +40 -2
  442. package/src/commands/submodule-auth.ts +61 -6
  443. package/src/commands/submodule-commands.ts +12 -2
  444. package/src/commands/submodule-update-command.ts +47 -1
  445. package/src/commands/tag-command.ts +33 -11
  446. package/src/commands/textconv-cache.ts +143 -0
  447. package/src/commands/tree-restore.ts +14 -0
  448. package/src/commands/unpack-objects-command.ts +235 -0
  449. package/src/commands/update-index-command.ts +1148 -0
  450. package/src/commands/uri-protocols.ts +13 -0
  451. package/src/commands/url-parse-command.ts +67 -0
  452. package/src/commands/var-command.ts +219 -0
  453. package/src/errors/command-errors.ts +45 -0
  454. package/src/git-command.ts +177 -3
  455. package/src/git.ts +808 -1
  456. package/src/guarded-transport-command.ts +6 -1
  457. package/src/results/cherry-pick-result.ts +6 -0
  458. package/src/results/diff-entry.ts +12 -0
  459. package/src/results/diff-formatter.ts +7 -4
  460. package/src/results/diff-output.ts +117 -11
  461. package/src/results/diff-pickaxe.ts +1 -1
  462. package/src/results/fetch-result.ts +12 -0
  463. package/src/results/merge-result.ts +5 -0
  464. package/src/results/push-result.ts +5 -0
  465. package/src/results/rebase-result.ts +7 -0
  466. package/src/results/revert-result.ts +6 -0
  467. package/src/results/stash-result.ts +6 -0
  468. package/src/transport-command.ts +182 -1
@@ -277,6 +277,17 @@ const WORKTREE_CHECK_BATCH = 32;
277
277
  /** The state directory of git's merge backend. */
278
278
  const DIR = "rebase-merge";
279
279
 
280
+ /** The state directory of git's apply backend (`git am --rebasing`'s). */
281
+ const APPLY_DIR = "rebase-apply";
282
+
283
+ /** sequencer.c's rebase_resolvemsg: the advice `git am --rebasing` gives where it stops. */
284
+ const REBASE_RESOLVEMSG = [
285
+ "Resolve all conflicts manually, mark them as resolved with",
286
+ '"git add/rm <conflicted_files>", then run "git rebase --continue".',
287
+ 'You can instead skip this commit: run "git rebase --skip".',
288
+ 'To abort and get back to the state before "git rebase", run "git rebase --abort".',
289
+ ].join("\n");
290
+
280
291
  /** sequencer.c's GIT_MAX_LABEL_LENGTH (NAME_MAX - ".lock" - 16) */
281
292
  const MAX_LABEL_LENGTH = 255 - 5 - 16;
282
293
 
@@ -293,6 +304,8 @@ const sq = (value: string) => `'${value.replaceAll("'", "'\\''")}'`;
293
304
  * git's state (`.git/rebase-merge/`, `REBASE_HEAD`, `MERGE_MSG`, `AUTO_MERGE`), so native
294
305
  * `git rebase --continue / --skip / --abort` resumes what we started, and we resume what
295
306
  * native git started. A rebase is refused on unstaged or staged changes, as git refuses it.
307
+ * {@link RebaseCommand.setBackend}`("apply")` (`--apply`, also chosen by `--whitespace`/`-C`
308
+ * or `rebase.backend=apply`) runs git's am-based backend instead (`rebase-apply/`).
296
309
  * With {@link RebaseCommand.setRebaseMerges} (`--rebase-merges`) the merges are kept: git's
297
310
  * todo list of `label`, `reset` and `merge -C` commands, run as git's sequencer runs them.
298
311
  *
@@ -327,6 +340,10 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
327
340
  private ignoreDate = false;
328
341
  /** `--signoff` (kept in `rebase-merge/signoff`) */
329
342
  private signoff = false;
343
+ /** `--[no-]rerere-autoupdate` (undefined: `rerere.autoUpdate`) */
344
+ private rerereAutoUpdate?: boolean;
345
+ /** What rerere printed on stderr during this run */
346
+ private readonly rerereLines: string[] = [];
330
347
  /** `--force-rebase` (REBASE_FORCE) */
331
348
  private forceRebase = false;
332
349
  /** `-S[<keyid>]` / `--no-gpg-sign` (undefined: `commit.gpgSign`; kept in `gpg_sign_opt`) */
@@ -378,6 +395,65 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
378
395
  private noVerify = false;
379
396
  /** `--trailer` arguments (kept in `rebase-merge/trailer`, one per line) */
380
397
  private trailerArgs: string[] = [];
398
+ /** `--apply` / `--merge` as given (undefined: implied by the options, else `rebase.backend`) */
399
+ private backend?: "apply" | "merge";
400
+ /** The death of `--apply` and `--merge` given together (in git's order of parsing) */
401
+ private backendConflict?: string;
402
+ /** `--whitespace=<action>`, passed to `git am` (apply backend) */
403
+ private whitespace?: string;
404
+ /** `-C<n>`, passed to `git am` (apply backend) */
405
+ private contextLines?: string;
406
+ /** `--ignore-whitespace`: am's `--ignore-whitespace`, or `-Xignore-space-change` */
407
+ private ignoreWhitespace = false;
408
+
409
+ /**
410
+ * `--apply` / `--merge` (`-m`): the backend. `apply` is git's am-based one (`git
411
+ * format-patch | git am --rebasing`, its state in `rebase-apply/`): each commit's diff
412
+ * is applied as a patch, with the three-way fallback, so `--whitespace`, `-C` and
413
+ * `--ignore-whitespace` act as on `git am`; commits empty from the start and commits
414
+ * upstream already has are dropped, merges are flattened away. Options only the merge
415
+ * backend has (`-i`, `--exec`, `--empty`, `-s`/`-X`, `--rebase-merges`, `--update-refs`,
416
+ * `--autosquash`, `--root` without `--onto`, `--trailer`, `--[no-]reapply-cherry-picks`
417
+ * without `--keep-base`) are refused with it (`<option> requires the merge backend`).
418
+ * Without either, `--whitespace`/`-C` choose `apply`, the merge-only options `merge`,
419
+ * else `rebase.backend` (default `merge`).
420
+ */
421
+ setBackend(backend: "apply" | "merge"): this {
422
+ this.checkCallable();
423
+ if (this.backend !== undefined && this.backend !== backend && !this.backendConflict) {
424
+ this.backendConflict = "fatal: apply options and merge options cannot be used together";
425
+ }
426
+ this.backend = backend;
427
+ return this;
428
+ }
429
+
430
+ /**
431
+ * `--whitespace=<action>` (`nowarn`, `warn`, `fix`, `strip`, `error`, `error-all`): passed
432
+ * to `git am` and so `git apply`; it implies the apply backend. `fix` and `strip` rewrite
433
+ * every commit (no fast-forward when already up to date).
434
+ */
435
+ setWhitespace(action: string): this {
436
+ this.checkCallable();
437
+ this.whitespace = action;
438
+ return this;
439
+ }
440
+
441
+ /** `-C<n>`: the context lines that must match, passed to `git am`; implies the apply backend. */
442
+ setContext(lines: number | string): this {
443
+ this.checkCallable();
444
+ this.contextLines = String(lines);
445
+ return this;
446
+ }
447
+
448
+ /**
449
+ * `--ignore-whitespace`: with `--apply`, `git am --ignore-whitespace` (context lines
450
+ * compared ignoring whitespace); otherwise the merge backend's `-X ignore-space-change`.
451
+ */
452
+ setIgnoreWhitespace(value: boolean): this {
453
+ this.checkCallable();
454
+ this.ignoreWhitespace = value;
455
+ return this;
456
+ }
381
457
 
382
458
  /**
383
459
  * `--trailer <token>[(=|:)<value>]` (git 2.46+): each rebased commit's message gets the
@@ -386,8 +462,7 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
386
462
  * git, it implies `--force-rebase` and is kept in `rebase-merge/trailer` for `--continue`;
387
463
  * an empty argument or one without a key is refused before anything is done, and under
388
464
  * 2.43 compatibility the option itself (`error: unknown option \`trailer'`, exit 129).
389
- * git's apply backend refuses it (`--trailer requires the merge backend`); ours has only
390
- * the merge backend.
465
+ * The apply backend refuses it (`--trailer requires the merge backend`).
391
466
  */
392
467
  addTrailer(trailer: string): this {
393
468
  this.checkCallable();
@@ -585,7 +660,8 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
585
660
  : this.contentStrategy === ContentMergeStrategy.THEIRS
586
661
  ? ["theirs"]
587
662
  : [];
588
- return [...favor, ...this.strategyOptions];
663
+ const space = this.ignoreWhitespace && this.backend !== "apply" ? ["ignore-space-change"] : [];
664
+ return [...favor, ...this.strategyOptions, ...space];
589
665
  }
590
666
 
591
667
  /** The run's `-s` (`ort` when only `-X` was given) as builtin/rebase.c settles it. */
@@ -748,6 +824,17 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
748
824
  return this;
749
825
  }
750
826
 
827
+ /**
828
+ * `--rerere-autoupdate` (true) / `--no-rerere-autoupdate` (false): whether resolutions
829
+ * rerere replays at a stopped pick are staged (default `rerere.autoUpdate`); kept in
830
+ * `rebase-merge/allow_rerere_autoupdate` for `--continue`.
831
+ */
832
+ setRerereAutoUpdate(value: boolean): this {
833
+ this.checkCallable();
834
+ this.rerereAutoUpdate = value;
835
+ return this;
836
+ }
837
+
751
838
  /**
752
839
  * `-S` (true) / `--no-gpg-sign` (false): whether to sign the commits the rebase makes;
753
840
  * undefined (the default) leaves it to `commit.gpgSign`. Kept in
@@ -935,7 +1022,10 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
935
1022
  await this.readCurrentIndex();
936
1023
  const worktree = this.worktreeAccess;
937
1024
  const run = () => this.run(worktree);
938
- return worktree?.batch ? worktree.batch(run) : run();
1025
+ const result = await (worktree?.batch ? worktree.batch(run) : run());
1026
+ return this.rerereLines.length > 0
1027
+ ? { ...result, rerereOutput: [...this.rerereLines] }
1028
+ : result;
939
1029
  }
940
1030
 
941
1031
  private async run(worktree: Worktree | undefined): Promise<RebaseResult> {
@@ -979,6 +1069,24 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
979
1069
  }
980
1070
  }
981
1071
 
1072
+ /**
1073
+ * The sequencer's `repo_rerere(r, opts->allow_rerere_auto)` at a stopped pick or merge:
1074
+ * `rebase-merge/allow_rerere_autoupdate` (`--[no-]rerere-autoupdate`), else
1075
+ * `rerere.autoUpdate`. Returns rerere's lines (kept for the result's `rerereOutput` too).
1076
+ */
1077
+ private async pickRerere(state: OperationState): Promise<string[]> {
1078
+ const saved = (await state.read(`${DIR}/allow_rerere_autoupdate`))?.trim();
1079
+ const autoUpdate =
1080
+ saved === "--rerere-autoupdate"
1081
+ ? true
1082
+ : saved === "--no-rerere-autoupdate"
1083
+ ? false
1084
+ : undefined;
1085
+ const lines = await this.rerere(autoUpdate === undefined ? {} : { autoUpdate });
1086
+ this.rerereLines.push(...lines);
1087
+ return lines;
1088
+ }
1089
+
982
1090
  private context(worktree: Worktree | undefined) {
983
1091
  return {
984
1092
  workingCopy: this.workingCopy,
@@ -1253,13 +1361,22 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
1253
1361
  worktree: Worktree | undefined,
1254
1362
  ): Promise<RebaseResult> {
1255
1363
  const forkPoint = this.checkBeginOptions();
1256
- if (await this.inProgress(state)) {
1364
+ if (this.backendConflict) throw new GitApiError(this.backendConflict);
1365
+ const applyRunning = await this.applyInProgress(state);
1366
+ if (applyRunning === "am") {
1257
1367
  return {
1258
1368
  status: RebaseStatus.FAILED,
1259
- message:
1260
- "fatal: It seems that there is already a rebase-merge directory, and\nI wonder if you are in the middle of another rebase.",
1369
+ message: "fatal: It looks like 'git am' is in progress. Cannot rebase.",
1261
1370
  };
1262
1371
  }
1372
+ if (applyRunning || (await this.inProgress(state))) {
1373
+ const dir = applyRunning ? APPLY_DIR : DIR;
1374
+ return {
1375
+ status: RebaseStatus.FAILED,
1376
+ message: `fatal: It seems that there is already a ${dir} directory, and\nI wonder if you are in the middle of another rebase. If that is the\ncase, please try\n\tgit rebase (--continue | --abort | --skip)\nIf that is not the case, please\n\trm -fr ".git/${dir}"\nand run me again. I am stopping in case you still have something\nvaluable there.`,
1377
+ };
1378
+ }
1379
+ const backend = this.settleBackend();
1263
1380
  // check_exec_cmd
1264
1381
  for (const command of this.execCommands) {
1265
1382
  if (command.includes("\n")) {
@@ -1346,7 +1463,12 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
1346
1463
  this.ignoreDate ||
1347
1464
  this.signoff ||
1348
1465
  this.trailerArgs.length > 0;
1349
- const preemptive = !interactive && execs.length === 0 && this.autosquash !== true;
1466
+ const preemptive =
1467
+ !interactive &&
1468
+ execs.length === 0 &&
1469
+ this.autosquash !== true &&
1470
+ this.whitespace !== "fix" &&
1471
+ this.whitespace !== "strip";
1350
1472
  if (preemptive && (await this.canFastForward(onto, upstream, restrict, origHead, branchBase))) {
1351
1473
  const upToDate =
1352
1474
  branchName === "HEAD" ? "HEAD is up to date" : `Current branch ${branchName} is up to date`;
@@ -1384,6 +1506,22 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
1384
1506
  }
1385
1507
  }
1386
1508
 
1509
+ if (backend === "apply") {
1510
+ return this.beginApply(state, worktree, {
1511
+ headId,
1512
+ origHead,
1513
+ headName,
1514
+ branchName,
1515
+ onto,
1516
+ ontoName,
1517
+ base: upstream ?? onto,
1518
+ restrict,
1519
+ branchBase,
1520
+ autostash,
1521
+ output,
1522
+ });
1523
+ }
1524
+
1387
1525
  const headTree = await flatTree(this.trees, await this.commits.getTree(headId));
1388
1526
  const ontoTreeId = await this.commits.getTree(onto);
1389
1527
  const ontoTree = await flatTree(this.trees, ontoTreeId);
@@ -1503,6 +1641,12 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
1503
1641
  this.runSign = { key: sign };
1504
1642
  if (sign !== undefined) await state.write(`${DIR}/gpg_sign_opt`, `-S${sign}\n`);
1505
1643
  if (this.signoff) await state.write(`${DIR}/signoff`, "--signoff\n");
1644
+ if (this.rerereAutoUpdate !== undefined) {
1645
+ await state.write(
1646
+ `${DIR}/allow_rerere_autoupdate`,
1647
+ `--${this.rerereAutoUpdate ? "" : "no-"}rerere-autoupdate\n`,
1648
+ );
1649
+ }
1506
1650
  if (emptyMode === "drop") await state.write(`${DIR}/drop_redundant_commits`, "");
1507
1651
  if (emptyMode === "keep") await state.write(`${DIR}/keep_redundant_commits`, "");
1508
1652
  if (this.committerDateIsAuthorDate) await state.write(`${DIR}/cdate_is_adate`, "");
@@ -2138,7 +2282,12 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
2138
2282
  !merge.external || (this.compatibility ?? this.hooks.compatibility) === "2.43"
2139
2283
  ? `${merged}\n`
2140
2284
  : merged,
2141
- lines: [`error: could not apply ${short}... ${subject}`, ...this.mergeConflictAdvice()],
2285
+ lines: [
2286
+ `error: could not apply ${short}... ${subject}`,
2287
+ ...this.mergeConflictAdvice(),
2288
+ // do_pick_commit's repo_rerere, after the advice
2289
+ ...(await this.pickRerere(state)),
2290
+ ],
2142
2291
  };
2143
2292
  }
2144
2293
  await state.write("MERGE_MSG", pickedMessage);
@@ -2812,11 +2961,16 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
2812
2961
  await state.write(`${DIR}/patch`, "");
2813
2962
  }
2814
2963
  const short = item.id ? await this.abbreviateObjectId(item.id) : "";
2964
+ // do_merge's repo_rerere, before the stop is reported
2965
+ const rerere = await this.pickRerere(state);
2815
2966
  return {
2816
2967
  status: RebaseStatus.STOPPED,
2817
2968
  ...(item.id ? { currentCommit: item.id } : {}),
2818
2969
  conflicts: [...new Set(merge.conflicts.keys())].sort(),
2819
- message: item.id ? `Could not apply ${short}... ${arg}` : `Could not merge ${arg}`,
2970
+ message: [
2971
+ ...rerere,
2972
+ item.id ? `Could not apply ${short}... ${arg}` : `Could not merge ${arg}`,
2973
+ ].join("\n"),
2820
2974
  };
2821
2975
  }
2822
2976
  // git commit -n -F MERGE_MSG --cleanup=verbatim (whitespace with --signoff, which the
@@ -2910,6 +3064,8 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
2910
3064
  };
2911
3065
  }
2912
3066
  output.push(...(result.output ?? []));
3067
+ // git merge's suggest_conflicts runs rerere (no --rerere-autoupdate passed to it)
3068
+ if (result.status === MergeStatus.CONFLICTING) this.rerereLines.push(...(await this.rerere()));
2913
3069
  if (result.status === MergeStatus.MERGED || result.status === MergeStatus.ALREADY_UP_TO_DATE) {
2914
3070
  // remove_merge_branch_state
2915
3071
  await state.remove("MERGE_MSG", "MERGE_HEAD", "MERGE_MODE");
@@ -3304,7 +3460,10 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3304
3460
  state: OperationState,
3305
3461
  worktree: Worktree | undefined,
3306
3462
  ): Promise<RebaseResult> {
3307
- if (!(await this.inProgress(state))) throw new NoRebaseInProgressError();
3463
+ const apply = await this.applyInProgress(state);
3464
+ if (apply === "am")
3465
+ throw new GitApiError("fatal: It looks like 'git am' is in progress. Cannot rebase.");
3466
+ if (!apply && !(await this.inProgress(state))) throw new NoRebaseInProgressError();
3308
3467
  const { unmerged } = await readIndex(this.staging);
3309
3468
  if (unmerged.length > 0) {
3310
3469
  // builtin/rebase.c: refresh_index's `<path>: needs merge`, then has_unstaged_changes
@@ -3335,6 +3494,7 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3335
3494
  };
3336
3495
  }
3337
3496
  }
3497
+ if (apply) return this.resumeApply(state, worktree, "continue");
3338
3498
  return this.resume(state, worktree);
3339
3499
  }
3340
3500
 
@@ -3549,6 +3709,8 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3549
3709
  }
3550
3710
  // git commit's cleanup (SQUASH_MSG of a final squash too), then commit_staged_changes'
3551
3711
  await state.remove(`${DIR}/amend`, "MERGE_HEAD", "MERGE_MODE", "MERGE_MSG", "SQUASH_MSG");
3712
+ // git commit's repo_rerere: the resolutions recorded
3713
+ this.rerereLines.push(...(await this.rerere()));
3552
3714
  await state.removeRef("CHERRY_PICK_HEAD");
3553
3715
  // commit_staged_changes deletes AUTO_MERGE once git commit is done, whether it exists
3554
3716
  await state.deleteRef("AUTO_MERGE");
@@ -3559,7 +3721,11 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3559
3721
 
3560
3722
  /** `git rebase --skip`: the stopped pick dropped (`reset --hard`), then as `--continue`. */
3561
3723
  private async skip(state: OperationState, worktree: Worktree | undefined): Promise<RebaseResult> {
3562
- if (!(await this.inProgress(state))) throw new NoRebaseInProgressError();
3724
+ const apply = await this.applyInProgress(state);
3725
+ if (apply === "am")
3726
+ throw new GitApiError("fatal: It looks like 'git am' is in progress. Cannot rebase.");
3727
+ if (!apply && !(await this.inProgress(state))) throw new NoRebaseInProgressError();
3728
+ await this.rerereClear();
3563
3729
  const headId = await this.resolveHead();
3564
3730
  const refused = await resetMerge(this.context(worktree), headId, "HEAD", { hard: true });
3565
3731
  if (refused) {
@@ -3571,9 +3737,279 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3571
3737
  // remove_branch_state (REBASE_HEAD stays: the next command removes it, so a skip of the
3572
3738
  // last one leaves it, as git does); AUTO_MERGE deleted twice, as git's hook hears it
3573
3739
  await removeBranchState(this.context(worktree), state);
3740
+ if (apply) return this.resumeApply(state, worktree, "skip");
3574
3741
  return this.resume(state, worktree);
3575
3742
  }
3576
3743
 
3744
+ /**
3745
+ * The apply backend's session found as cmd_rebase finds it: `rebase-apply/` (a rebase),
3746
+ * `am` when it holds `applying` (git am's), else false.
3747
+ */
3748
+ private async applyInProgress(state: OperationState): Promise<false | "rebase" | "am"> {
3749
+ if (!(await state.exists(APPLY_DIR))) return false;
3750
+ return (await state.exists(`${APPLY_DIR}/applying`)) ? "am" : "rebase";
3751
+ }
3752
+
3753
+ /**
3754
+ * cmd_rebase's choice of backend: `--apply`/`--merge` as given, the options only one
3755
+ * backend has (imply_merge dies on an explicit `--apply`), the am options (`--whitespace`,
3756
+ * `-C`) choosing `apply`, then `rebase.backend`.
3757
+ */
3758
+ private settleBackend(): "apply" | "merge" {
3759
+ const die = (message: string) => new GitApiError(`fatal: ${message}`);
3760
+ let type = this.backend ?? (this.interactiveHandler ? "merge" : undefined);
3761
+ if (this.backend === "apply" && this.interactiveHandler) {
3762
+ throw die("apply options and merge options cannot be used together");
3763
+ }
3764
+ if (this.contextLines !== undefined && !/^\d*$/.test(this.contextLines)) {
3765
+ throw die("switch `C' expects a numerical value");
3766
+ }
3767
+ const ws = this.whitespace;
3768
+ if (
3769
+ ws !== undefined &&
3770
+ !["", "fix", "strip", "warn", "nowarn", "error", "error-all"].includes(ws)
3771
+ ) {
3772
+ throw die(`Invalid whitespace option: '${ws}'`);
3773
+ }
3774
+ const implyMerge = (option: string) => {
3775
+ if (type === "apply") throw die(`${option} requires the merge backend`);
3776
+ type = "merge";
3777
+ };
3778
+ if (this.emptyMode !== undefined) implyMerge("--empty");
3779
+ if (this.reapplyCherryPicks !== undefined && !this.keepBase) {
3780
+ implyMerge(this.reapplyCherryPicks ? "--reapply-cherry-picks" : "--no-reapply-cherry-picks");
3781
+ }
3782
+ if (this.execCommands.length > 0) implyMerge("--exec");
3783
+ if (this.givenStrategyName() !== undefined) implyMerge("--strategy");
3784
+ if (this.root && this.ontoName === undefined && this.upstreamCommit === undefined) {
3785
+ implyMerge("--root without --onto");
3786
+ }
3787
+ if (this.trailerArgs.length > 0) implyMerge("--trailer");
3788
+ const amOptions = this.whitespace !== undefined || this.contextLines !== undefined;
3789
+ if (amOptions || type === "apply") {
3790
+ if (type === "merge") throw die("apply options and merge options cannot be used together");
3791
+ if (
3792
+ this.rebaseMerges === undefined &&
3793
+ configBool(this.workingCopy, "rebase.rebaseMerges", false)
3794
+ ) {
3795
+ throw die(
3796
+ "apply options are incompatible with rebase.rebaseMerges. Consider adding --no-rebase-merges",
3797
+ );
3798
+ }
3799
+ if (
3800
+ this.updateRefs === undefined &&
3801
+ configBool(this.workingCopy, "rebase.updateRefs", false)
3802
+ ) {
3803
+ throw die(
3804
+ "apply options are incompatible with rebase.updateRefs. Consider adding --no-update-refs",
3805
+ );
3806
+ }
3807
+ type = "apply";
3808
+ }
3809
+ if (this.updateRefs === true) implyMerge("--update-refs");
3810
+ if (this.rebaseMerges === true) implyMerge("--rebase-merges");
3811
+ if (this.autosquash === true) implyMerge("--autosquash");
3812
+ if (type === undefined) {
3813
+ const configured = configValue(this.workingCopy, "rebase.backend") ?? "merge";
3814
+ if (configured === "merge") type = "merge";
3815
+ else if (configured === "apply") type = "apply";
3816
+ else throw die(`Unknown rebase backend: ${configured}`);
3817
+ }
3818
+ if (this.rescheduleFailedExec === true && type !== "merge") {
3819
+ throw die("--reschedule-failed-exec requires --exec or --interactive");
3820
+ }
3821
+ this.backend = type;
3822
+ return type;
3823
+ }
3824
+
3825
+ /**
3826
+ * The apply backend from HEAD's start on (cmd_rebase after the pre-rebase hook, then
3827
+ * run_am): HEAD detached at onto (`rebase (start): checkout <onto>`, ORIG_HEAD the branch,
3828
+ * post-checkout told), the commits upstream lacks (merges, commits empty from the start
3829
+ * and those upstream has a copy of left out, as `format-patch --cherry-pick
3830
+ * --right-only` lists them) applied by `git am --rebasing`, then the branch moved back
3831
+ * (`move_to_original_branch`) and the state removed; a stop keeps `rebase-apply/` with
3832
+ * the rebase's own files (`rebase_write_basic_state`).
3833
+ */
3834
+ private async beginApply(
3835
+ state: OperationState,
3836
+ worktree: Worktree | undefined,
3837
+ run: {
3838
+ headId: ObjectId;
3839
+ origHead: ObjectId;
3840
+ headName: string;
3841
+ branchName: string;
3842
+ onto: ObjectId;
3843
+ ontoName: string;
3844
+ base: ObjectId;
3845
+ restrict?: ObjectId;
3846
+ branchBase?: ObjectId;
3847
+ autostash?: ObjectId;
3848
+ output: string[];
3849
+ },
3850
+ ): Promise<RebaseResult> {
3851
+ const { headId, origHead, headName, onto, output } = run;
3852
+ const unstash = async () => {
3853
+ if (run.autostash) {
3854
+ output.push(...(await applyAutostash(this.context(worktree), run.autostash)));
3855
+ }
3856
+ };
3857
+ output.push("First, rewinding head to replay your work on top of it...");
3858
+ const headTree = await flatTree(this.trees, await this.commits.getTree(headId));
3859
+ const ontoTreeId = await this.commits.getTree(onto);
3860
+ const ontoTree = await flatTree(this.trees, ontoTreeId);
3861
+ const refused = await switchTrees(this.context(worktree), headTree, ontoTree, {
3862
+ action: "checkout",
3863
+ operation: "rebase",
3864
+ targetTree: ontoTreeId,
3865
+ });
3866
+ if (refused) {
3867
+ await unstash();
3868
+ return {
3869
+ status: RebaseStatus.FAILED,
3870
+ message: `${refused.message}\nerror: Could not detach HEAD`,
3871
+ output,
3872
+ };
3873
+ }
3874
+ await state.setRef("ORIG_HEAD", origHead);
3875
+ await this.refsStore.set("HEAD", onto, this.startLog());
3876
+ await runPostCheckoutHook(this.hooks, headId, onto, true);
3877
+ if (run.autostash) await state.write(`${APPLY_DIR}/autostash`, `${run.autostash}\n`);
3878
+ const basic = { headName, onto, origHead };
3879
+ // onto a proper descendant of the branch: it was a fast-forward
3880
+ if (run.branchBase === origHead) {
3881
+ output.push(`Fast-forwarded ${run.branchName} to ${run.ontoName}.`);
3882
+ return this.finishApply(state, worktree, basic, output);
3883
+ }
3884
+ // format-patch's list: no merges, no commits empty from the start, none upstream has
3885
+ const excluded = [run.base, run.restrict].filter((id): id is ObjectId => id !== undefined);
3886
+ const range = await this.commitsToRebase(origHead, excluded, false);
3887
+ const skipped = await this.appliedUpstream(origHead, run.base, range, run.restrict);
3888
+ const ids: ObjectId[] = [];
3889
+ for (const id of range) {
3890
+ if (!skipped.has(id) && !(await this.originallyEmpty(id))) ids.push(id);
3891
+ }
3892
+ // `git am --rebasing` reads nothing of a mail but its `From <id>` line (the commit gives
3893
+ // the author, the message and the diff), so the mails carry only that
3894
+ const mbox = ids.map((id) => `From ${id} Mon Sep 17 00:00:00 2001\n\n`).join("");
3895
+ const am = this.amForRebase()
3896
+ .addMbox(mbox)
3897
+ .setPatchFormat("mboxrd")
3898
+ .setApplyOptions({
3899
+ ...(this.contextLines !== undefined ? { context: Number(this.contextLines || "0") } : {}),
3900
+ ...(this.whitespace !== undefined ? { whitespace: this.whitespace } : {}),
3901
+ ...(this.ignoreWhitespace ? { ignoreWhitespace: true } : {}),
3902
+ })
3903
+ .setIgnoreDate(this.ignoreDate)
3904
+ .setCommitterDateIsAuthorDate(this.committerDateIsAuthorDate)
3905
+ .setSignoff(this.signoff);
3906
+ if (this.rerereAutoUpdate !== undefined) am.setRerereAutoUpdate(this.rerereAutoUpdate);
3907
+ return this.runAmForRebase(state, worktree, am, basic, output, true);
3908
+ }
3909
+
3910
+ /** `git am --rebasing`'s command as run_am starts it (`GIT_REFLOG_ACTION=rebase (pick)`). */
3911
+ private amForRebase(): AmCommand {
3912
+ const am = new AmCommand(this.workingCopy)
3913
+ .shareHooksOf(this)
3914
+ .setRebasing(true)
3915
+ .setResolveMessage(REBASE_RESOLVEMSG)
3916
+ .setReflogAction(`${this.reflogAction("rebase")} (pick)`)
3917
+ .setLegacyMessages((this.compatibility ?? this.hooks.compatibility) === "2.43");
3918
+ if (typeof this.sign === "string") am.setSigningKey(this.sign);
3919
+ else am.setSign(this.sign);
3920
+ if (this.committer) am.setCommitter(this.committer);
3921
+ return am;
3922
+ }
3923
+
3924
+ /**
3925
+ * run_am's end: am's lines given on, the branch moved back and the state removed when it
3926
+ * applied everything, else (a new run) the rebase's state written beside am's.
3927
+ */
3928
+ private async runAmForRebase(
3929
+ state: OperationState,
3930
+ worktree: Worktree | undefined,
3931
+ am: AmCommand,
3932
+ basic: { headName: string; onto: ObjectId; origHead: ObjectId },
3933
+ output: string[],
3934
+ writeBasicState: boolean,
3935
+ ): Promise<RebaseResult> {
3936
+ const result = await am.call();
3937
+ const lines = (text: string) => text.split("\n").filter((l) => l !== "");
3938
+ output.push(...lines(result.output), ...lines(result.errors));
3939
+ if (result.exitCode === 0) return this.finishApply(state, worktree, basic, output);
3940
+ if (writeBasicState && (await state.exists(APPLY_DIR))) {
3941
+ // rebase_write_basic_state
3942
+ await state.write(`${APPLY_DIR}/head-name`, `${basic.headName}\n`);
3943
+ await state.write(`${APPLY_DIR}/onto`, `${basic.onto}\n`);
3944
+ await state.write(`${APPLY_DIR}/orig-head`, `${basic.origHead}\n`);
3945
+ if (this.rerereAutoUpdate !== undefined) {
3946
+ await state.write(
3947
+ `${APPLY_DIR}/allow_rerere_autoupdate`,
3948
+ `--${this.rerereAutoUpdate ? "" : "no-"}rerere-autoupdate\n`,
3949
+ );
3950
+ }
3951
+ const sign = signRequestOf(this.workingCopy, this.sign);
3952
+ if (sign !== undefined) await state.write(`${APPLY_DIR}/gpg_sign_opt`, `-S${sign}\n`);
3953
+ if (this.signoff) await state.write(`${APPLY_DIR}/signoff`, "--signoff\n");
3954
+ }
3955
+ const { unmerged } = await readIndex(this.staging);
3956
+ return {
3957
+ status: RebaseStatus.STOPPED,
3958
+ ...(unmerged.length > 0 ? { conflicts: [...new Set(unmerged)] } : {}),
3959
+ output,
3960
+ };
3961
+ }
3962
+
3963
+ /**
3964
+ * `--continue` (`git am --resolved`) and `--skip` (`git am --skip`) of the apply backend,
3965
+ * the state read back as read_basic_state reads it.
3966
+ */
3967
+ private async resumeApply(
3968
+ state: OperationState,
3969
+ worktree: Worktree | undefined,
3970
+ mode: "continue" | "skip",
3971
+ ): Promise<RebaseResult> {
3972
+ const headName = (await state.read(`${APPLY_DIR}/head-name`))?.trim();
3973
+ const onto = (await state.read(`${APPLY_DIR}/onto`))?.trim();
3974
+ const origHead =
3975
+ (await state.read(`${APPLY_DIR}/orig-head`))?.trim() ??
3976
+ (await state.read(`${APPLY_DIR}/head`))?.trim();
3977
+ if (headName === undefined || !onto || !origHead) {
3978
+ return { status: RebaseStatus.FAILED, message: "error: could not read rebase-apply state" };
3979
+ }
3980
+ const saved = (await state.read(`${APPLY_DIR}/allow_rerere_autoupdate`))?.trim();
3981
+ if (saved === "--rerere-autoupdate") this.rerereAutoUpdate = true;
3982
+ else if (saved === "--no-rerere-autoupdate") this.rerereAutoUpdate = false;
3983
+ // run_am: `--resolved` gets the run's gpg_sign_opt (read_basic_state), `--skip` none
3984
+ if (mode === "continue" && this.sign === undefined) {
3985
+ const saved = (await state.read(`${APPLY_DIR}/gpg_sign_opt`))?.trim();
3986
+ if (saved?.startsWith("-S")) this.sign = saved.length > 2 ? saved.slice(2) : true;
3987
+ }
3988
+ const am = this.amForRebase().setResume(mode === "continue" ? "resolved" : "skip");
3989
+ if (mode === "skip") am.setSign(undefined);
3990
+ return this.runAmForRebase(state, worktree, am, { headName, onto, origHead }, [], false);
3991
+ }
3992
+
3993
+ /**
3994
+ * move_to_original_branch and finish_rebase: the branch at HEAD and HEAD on it again,
3995
+ * REBASE_HEAD and AUTO_MERGE deleted, the autostash applied, `rebase-apply/` removed.
3996
+ */
3997
+ private async finishApply(
3998
+ state: OperationState,
3999
+ worktree: Worktree | undefined,
4000
+ basic: { headName: string; onto: ObjectId },
4001
+ output: string[],
4002
+ ): Promise<RebaseResult> {
4003
+ const head = await this.resolveHead();
4004
+ if (basic.headName.startsWith("refs/"))
4005
+ await this.finishBranch(basic.headName, head, basic.onto);
4006
+ await state.deleteRef("REBASE_HEAD", "AUTO_MERGE");
4007
+ const autostash = (await state.read(`${APPLY_DIR}/autostash`))?.trim();
4008
+ if (autostash) output.push(...(await applyAutostash(this.context(worktree), autostash)));
4009
+ await state.remove(APPLY_DIR);
4010
+ return { status: RebaseStatus.OK, newHead: head, output };
4011
+ }
4012
+
3577
4013
  /**
3578
4014
  * `git rebase --quit` and `--show-current-patch` (builtin/rebase.c's ACTION_QUIT and
3579
4015
  * ACTION_SHOW_CURRENT_PATCH): the backend found as cmd_rebase finds it (`rebase-apply/`
@@ -3584,7 +4020,6 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3584
4020
  worktree: Worktree | undefined,
3585
4021
  operation: RebaseOperation,
3586
4022
  ): Promise<RebaseResult> {
3587
- const APPLY_DIR = "rebase-apply";
3588
4023
  if (await state.exists(`${APPLY_DIR}/applying`)) {
3589
4024
  return {
3590
4025
  status: RebaseStatus.FAILED,
@@ -3636,9 +4071,14 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3636
4071
  state: OperationState,
3637
4072
  worktree: Worktree | undefined,
3638
4073
  ): Promise<RebaseResult> {
3639
- if (!(await this.inProgress(state))) return { status: RebaseStatus.ABORTED };
3640
- const origHead = (await state.read(`${DIR}/orig-head`))?.trim();
3641
- const headName = (await state.read(`${DIR}/head-name`))?.trim() ?? "detached HEAD";
4074
+ const apply = await this.applyInProgress(state);
4075
+ if (apply === "am")
4076
+ throw new GitApiError("fatal: It looks like 'git am' is in progress. Cannot rebase.");
4077
+ if (!apply && !(await this.inProgress(state))) return { status: RebaseStatus.ABORTED };
4078
+ const stateDir = apply ? APPLY_DIR : DIR;
4079
+ await this.rerereClear();
4080
+ const origHead = (await state.read(`${stateDir}/orig-head`))?.trim();
4081
+ const headName = (await state.read(`${stateDir}/head-name`))?.trim() ?? "detached HEAD";
3642
4082
  if (!origHead)
3643
4083
  return { status: RebaseStatus.FAILED, message: "fatal: could not read orig-head" };
3644
4084
  const refused = await resetMerge(this.context(worktree), origHead, origHead, { hard: true });
@@ -3649,13 +4089,13 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
3649
4089
  };
3650
4090
  }
3651
4091
  await this.finishBranch(headName, origHead, undefined, true);
3652
- const autostash = (await state.read(`${DIR}/autostash`))?.trim();
4092
+ const autostash = (await state.read(`${stateDir}/autostash`))?.trim();
3653
4093
  // remove_branch_state, then finish_rebase's unconditional deletions of REBASE_HEAD and
3654
4094
  // AUTO_MERGE (git 2.5x's reference-transaction hook hears each)
3655
4095
  await removeBranchState(this.context(worktree), state);
3656
4096
  await state.deleteRef("REBASE_HEAD", "AUTO_MERGE");
3657
- await this.deleteRewrittenRefs(state);
3658
- await state.remove("MERGE_HEAD", "MERGE_MODE", "MERGE_MSG", "SQUASH_MSG", DIR);
4097
+ if (!apply) await this.deleteRewrittenRefs(state);
4098
+ await state.remove("MERGE_HEAD", "MERGE_MODE", "MERGE_MSG", "SQUASH_MSG", stateDir);
3659
4099
  const output = autostash ? await applyAutostash(this.context(worktree), autostash) : [];
3660
4100
  return { status: RebaseStatus.ABORTED, newHead: origHead, output };
3661
4101
  }
@@ -4221,6 +4661,49 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
4221
4661
  return new Map(ids.map((id) => [id, id.slice(0, lengths.get(id) ?? 7)]));
4222
4662
  }
4223
4663
 
4664
+ /**
4665
+ * The sequence editor program git would launch (`git_sequence_editor`):
4666
+ * `$GIT_SEQUENCE_EDITOR`, `sequence.editor`, then git's editor (`$GIT_EDITOR`,
4667
+ * `core.editor`, `$VISUAL` unless the terminal is dumb, `$EDITOR`); undefined where only the
4668
+ * build's default editor is left (a library never starts an interactive `vi` on its own).
4669
+ */
4670
+ private sequenceEditorProgram(): string | undefined {
4671
+ const programs = hostEnvironmentOf(this.workingCopy)?.programVariables ?? {};
4672
+ const config = RemoteConfigStore.from(this.workingCopy);
4673
+ const sequence = programs.GIT_SEQUENCE_EDITOR ?? config.value("sequence.editor");
4674
+ if (sequence !== undefined) return sequence;
4675
+ const dumb = programs.TERM === undefined || programs.TERM === "dumb";
4676
+ let editor = programs.GIT_EDITOR ?? config.value("core.editor");
4677
+ if (editor === undefined && !dumb) editor = programs.VISUAL;
4678
+ return editor ?? programs.EDITOR;
4679
+ }
4680
+
4681
+ /**
4682
+ * launch_sequence_editor without an interactive handler's `editTodo`: the program of
4683
+ * {@link sequenceEditorProgram} edits `rebase-merge/git-rebase-todo` (already holding
4684
+ * `text`) through the host's hook runner, as git's `launch_specified_editor` runs it (`:`
4685
+ * edits nothing); the file's new content, or undefined when no program runs (no program,
4686
+ * no runner). A failing program throws git's "there was a problem with the editor".
4687
+ */
4688
+ private async runSequenceEditorProgram(text: string): Promise<string | undefined> {
4689
+ const program = this.sequenceEditorProgram();
4690
+ if (program === undefined || program === ":") return undefined;
4691
+ const todo = `${DIR}/git-rebase-todo`;
4692
+ const state = new OperationState(this.workingCopy.checkout, this.refsStore);
4693
+ await state.write(todo, text);
4694
+ const path = await this.hooks.gitPath(todo);
4695
+ const run = await this.hooks.runShellCommand("sequence-editor", program, [path]);
4696
+ if (!run) return undefined;
4697
+ // launch_specified_editor's error (2.43's wording, capitalised with a period)
4698
+ if (run.exitCode !== 0)
4699
+ throw new EditorProgramFailure(
4700
+ (this.compatibility ?? this.hooks.compatibility) === "2.43"
4701
+ ? `error: There was a problem with the editor '${program}'.`
4702
+ : `error: there was a problem with the editor '${program}'`,
4703
+ );
4704
+ return (await state.read(todo)) ?? "";
4705
+ }
4706
+
4224
4707
  /**
4225
4708
  * launch_sequence_editor: the interactive handler edits the list (editTodo, then the
4226
4709
  * steps of prepareSteps); without one the list is kept.
@@ -4233,6 +4716,7 @@ export class RebaseCommand extends GitCommand<RebaseResult> {
4233
4716
  const handler = this.interactiveHandler;
4234
4717
  let out = text;
4235
4718
  if (handler?.editTodo) out = await handler.editTodo(out);
4719
+ else out = (await this.runSequenceEditorProgram(out)) ?? out;
4236
4720
  if (handler?.prepareSteps) {
4237
4721
  const comment = commentPrefixOf(this.workingCopy);
4238
4722
  const items = parseTodo(stripspace(out, comment), comment).items.filter(
@@ -4957,6 +5441,7 @@ function editorFailure(error: unknown): Extract<PickOutcome, { kind: "conflicts"
4957
5441
 
4958
5442
  /** launch_sequence_editor failing (the interactive handler's editTodo or prepareSteps threw). */
4959
5443
  function sequenceEditorFailure(error: unknown): string {
5444
+ if (error instanceof EditorProgramFailure) return error.message;
4960
5445
  return error instanceof HandlerFailure
4961
5446
  ? editorProblem(error.editor, error.reason)
4962
5447
  : editorProblem("editTodo", error);
@@ -4971,6 +5456,9 @@ function editorProblem(editor: string, error: unknown): string {
4971
5456
  return `error: there was a problem with the editor '${editor}': ${reason}`;
4972
5457
  }
4973
5458
 
5459
+ /** The sequence editor program failed: git's line as its message. */
5460
+ class EditorProgramFailure extends Error {}
5461
+
4974
5462
  /** An interactive handler's method that threw, named. */
4975
5463
  class HandlerFailure extends Error {
4976
5464
  constructor(