@statewalker/vcs-commands 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/dist/commands/add-command.d.ts.map +1 -1
  2. package/dist/commands/add-patch/patch-backend.d.ts +1 -1
  3. package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
  4. package/dist/commands/archive/remote-archive-command.d.ts +4 -1
  5. package/dist/commands/archive/remote-archive-command.d.ts.map +1 -1
  6. package/dist/commands/branch-command.d.ts +14 -2
  7. package/dist/commands/branch-command.d.ts.map +1 -1
  8. package/dist/commands/cat-file/batch-format.d.ts +8 -12
  9. package/dist/commands/cat-file/batch-format.d.ts.map +1 -1
  10. package/dist/commands/cat-file/cat-file-command.d.ts +39 -5
  11. package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
  12. package/dist/commands/check-ignore-command.d.ts.map +1 -1
  13. package/dist/commands/checkout-command.d.ts +4 -0
  14. package/dist/commands/checkout-command.d.ts.map +1 -1
  15. package/dist/commands/checkout-paths.d.ts +9 -0
  16. package/dist/commands/checkout-paths.d.ts.map +1 -1
  17. package/dist/commands/cherry-pick-command.d.ts +3 -0
  18. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  19. package/dist/commands/clean-interactive.d.ts +0 -9
  20. package/dist/commands/clean-interactive.d.ts.map +1 -1
  21. package/dist/commands/clone-command.d.ts +2 -0
  22. package/dist/commands/clone-command.d.ts.map +1 -1
  23. package/dist/commands/column/column-config.d.ts +23 -0
  24. package/dist/commands/column/column-config.d.ts.map +1 -0
  25. package/dist/commands/column/column-layout.d.ts +129 -0
  26. package/dist/commands/column/column-layout.d.ts.map +1 -0
  27. package/dist/commands/column/index.d.ts +3 -0
  28. package/dist/commands/column/index.d.ts.map +1 -0
  29. package/dist/commands/column-command.d.ts +59 -0
  30. package/dist/commands/column-command.d.ts.map +1 -0
  31. package/dist/commands/comment-char-config.d.ts +15 -0
  32. package/dist/commands/comment-char-config.d.ts.map +1 -1
  33. package/dist/commands/commit-command.d.ts +21 -2
  34. package/dist/commands/commit-command.d.ts.map +1 -1
  35. package/dist/commands/config-command.d.ts +12 -0
  36. package/dist/commands/config-command.d.ts.map +1 -1
  37. package/dist/commands/credential-helper.d.ts +214 -0
  38. package/dist/commands/credential-helper.d.ts.map +1 -0
  39. package/dist/commands/default-branch.d.ts +17 -1
  40. package/dist/commands/default-branch.d.ts.map +1 -1
  41. package/dist/commands/diff-color-config.d.ts +4 -0
  42. package/dist/commands/diff-color-config.d.ts.map +1 -1
  43. package/dist/commands/diff-command.d.ts +12 -0
  44. package/dist/commands/diff-command.d.ts.map +1 -1
  45. package/dist/commands/fast-export/fast-export-command.d.ts +89 -2
  46. package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -1
  47. package/dist/commands/fast-export/fast-import-command.d.ts +113 -8
  48. package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -1
  49. package/dist/commands/fast-export/fast-stream-support.d.ts +0 -9
  50. package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -1
  51. package/dist/commands/fetch-command.d.ts +21 -0
  52. package/dist/commands/fetch-command.d.ts.map +1 -1
  53. package/dist/commands/git-hooks.d.ts +28 -0
  54. package/dist/commands/git-hooks.d.ts.map +1 -1
  55. package/dist/commands/history-command.d.ts +173 -7
  56. package/dist/commands/history-command.d.ts.map +1 -1
  57. package/dist/commands/index-host.d.ts +19 -0
  58. package/dist/commands/index-host.d.ts.map +1 -1
  59. package/dist/commands/index-refresh.d.ts +36 -0
  60. package/dist/commands/index-refresh.d.ts.map +1 -0
  61. package/dist/commands/index.d.ts +9 -0
  62. package/dist/commands/index.d.ts.map +1 -1
  63. package/dist/commands/index.js +7 -6
  64. package/dist/commands/init-command.d.ts +20 -0
  65. package/dist/commands/init-command.d.ts.map +1 -1
  66. package/dist/commands/local-transport.d.ts +29 -1
  67. package/dist/commands/local-transport.d.ts.map +1 -1
  68. package/dist/commands/log-command.d.ts +7 -0
  69. package/dist/commands/log-command.d.ts.map +1 -1
  70. package/dist/commands/log-output.d.ts +11 -0
  71. package/dist/commands/log-output.d.ts.map +1 -1
  72. package/dist/commands/maintenance-schedule-command.d.ts +122 -0
  73. package/dist/commands/maintenance-schedule-command.d.ts.map +1 -0
  74. package/dist/commands/merge-command.d.ts +2 -0
  75. package/dist/commands/merge-command.d.ts.map +1 -1
  76. package/dist/commands/merge-index-command.d.ts +42 -0
  77. package/dist/commands/merge-index-command.d.ts.map +1 -0
  78. package/dist/commands/merge-one-file.d.ts +129 -0
  79. package/dist/commands/merge-one-file.d.ts.map +1 -0
  80. package/dist/commands/merge-support.d.ts +21 -2
  81. package/dist/commands/merge-support.d.ts.map +1 -1
  82. package/dist/commands/object-disk-info.d.ts +35 -0
  83. package/dist/commands/object-disk-info.d.ts.map +1 -0
  84. package/dist/commands/octopus-merge.d.ts +3 -3
  85. package/dist/commands/octopus-merge.d.ts.map +1 -1
  86. package/dist/commands/promisor-remote.d.ts.map +1 -1
  87. package/dist/commands/pull-command.d.ts +55 -7
  88. package/dist/commands/pull-command.d.ts.map +1 -1
  89. package/dist/commands/push-command.d.ts +18 -1
  90. package/dist/commands/push-command.d.ts.map +1 -1
  91. package/dist/commands/range-diff/range-diff-command.d.ts +37 -1
  92. package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -1
  93. package/dist/commands/rebase-command.d.ts +13 -1
  94. package/dist/commands/rebase-command.d.ts.map +1 -1
  95. package/dist/commands/ref-filter/for-each-ref-command.d.ts +3 -2
  96. package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -1
  97. package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -1
  98. package/dist/commands/ref-filter/ref-format.d.ts +26 -1
  99. package/dist/commands/ref-filter/ref-format.d.ts.map +1 -1
  100. package/dist/commands/ref-filter/ref-listing-command.d.ts +9 -0
  101. package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -1
  102. package/dist/commands/remote-transport.d.ts +27 -0
  103. package/dist/commands/remote-transport.d.ts.map +1 -1
  104. package/dist/commands/repack-command.d.ts +18 -2
  105. package/dist/commands/repack-command.d.ts.map +1 -1
  106. package/dist/commands/repo-command.d.ts +2 -7
  107. package/dist/commands/repo-command.d.ts.map +1 -1
  108. package/dist/commands/reset-command.d.ts +4 -1
  109. package/dist/commands/reset-command.d.ts.map +1 -1
  110. package/dist/commands/restore-command.d.ts.map +1 -1
  111. package/dist/commands/rev-list-command.d.ts +65 -0
  112. package/dist/commands/rev-list-command.d.ts.map +1 -1
  113. package/dist/commands/revert-command.d.ts +3 -0
  114. package/dist/commands/revert-command.d.ts.map +1 -1
  115. package/dist/commands/revision-filenames.d.ts.map +1 -1
  116. package/dist/commands/revision-range.d.ts +17 -0
  117. package/dist/commands/revision-range.d.ts.map +1 -1
  118. package/dist/commands/revision-resolver.d.ts +12 -0
  119. package/dist/commands/revision-resolver.d.ts.map +1 -1
  120. package/dist/commands/serve-repository.d.ts +17 -1
  121. package/dist/commands/serve-repository.d.ts.map +1 -1
  122. package/dist/commands/served-lazy-fetch.d.ts +61 -0
  123. package/dist/commands/served-lazy-fetch.d.ts.map +1 -0
  124. package/dist/commands/signing.d.ts +10 -4
  125. package/dist/commands/signing.d.ts.map +1 -1
  126. package/dist/commands/status-color-config.d.ts +33 -0
  127. package/dist/commands/status-color-config.d.ts.map +1 -0
  128. package/dist/commands/status-command.d.ts +15 -0
  129. package/dist/commands/status-command.d.ts.map +1 -1
  130. package/dist/commands/status-format.d.ts +46 -4
  131. package/dist/commands/status-format.d.ts.map +1 -1
  132. package/dist/commands/tag-command.d.ts +15 -1
  133. package/dist/commands/tag-command.d.ts.map +1 -1
  134. package/dist/commands/tree-restore.d.ts +14 -0
  135. package/dist/commands/tree-restore.d.ts.map +1 -1
  136. package/dist/commands/verify-command.d.ts +22 -2
  137. package/dist/commands/verify-command.d.ts.map +1 -1
  138. package/dist/commands/worktree-add-command.d.ts.map +1 -1
  139. package/dist/commands/worktree-overwrite-checks.d.ts +31 -6
  140. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
  141. package/dist/{commands-C9M78Chn.js → commands-DT3VEv50.js} +14879 -16703
  142. package/dist/errors/commit-errors.d.ts +23 -3
  143. package/dist/errors/commit-errors.d.ts.map +1 -1
  144. package/dist/errors/git-api-error.d.ts +6 -0
  145. package/dist/errors/git-api-error.d.ts.map +1 -1
  146. package/dist/errors/index.js +30 -4
  147. package/dist/{fsck-C4US3l0B.js → fsck-BZ508Elg.js} +1 -1
  148. package/dist/git-command.d.ts +33 -1
  149. package/dist/git-command.d.ts.map +1 -1
  150. package/dist/git.d.ts +104 -1
  151. package/dist/git.d.ts.map +1 -1
  152. package/dist/index.js +8 -7
  153. package/dist/{remote-transport-C43eykfK.js → local-transport-D98U6p4d.js} +184 -683
  154. package/dist/{maintenance-run-command-CoJFKr2p.js → maintenance-run-command-DZFnbnbo.js} +2285 -79
  155. package/dist/remote-config/remote-config-store.d.ts +6 -0
  156. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  157. package/dist/remote-transport-zvSqwpOB.js +4865 -0
  158. package/dist/results/cherry-pick-result.d.ts +4 -3
  159. package/dist/results/cherry-pick-result.d.ts.map +1 -1
  160. package/dist/results/diff-output.d.ts +7 -0
  161. package/dist/results/diff-output.d.ts.map +1 -1
  162. package/dist/results/diff-words.d.ts +14 -3
  163. package/dist/results/diff-words.d.ts.map +1 -1
  164. package/dist/results/index.js +1 -1
  165. package/dist/results/line-prefix-sink.d.ts +50 -0
  166. package/dist/results/line-prefix-sink.d.ts.map +1 -0
  167. package/dist/results/merge-result.d.ts +4 -3
  168. package/dist/results/merge-result.d.ts.map +1 -1
  169. package/dist/results/rebase-result.d.ts +5 -0
  170. package/dist/results/rebase-result.d.ts.map +1 -1
  171. package/dist/results/revert-result.d.ts +4 -3
  172. package/dist/results/revert-result.d.ts.map +1 -1
  173. package/dist/{results-B0CWLCAp.js → results-rF81cQse.js} +1425 -202
  174. package/dist/transport-command.d.ts +10 -0
  175. package/dist/transport-command.d.ts.map +1 -1
  176. package/package.json +12 -12
  177. package/src/commands/add-command.ts +15 -2
  178. package/src/commands/add-patch/patch-backend.ts +6 -44
  179. package/src/commands/archive/remote-archive-command.ts +10 -3
  180. package/src/commands/branch-command.ts +57 -4
  181. package/src/commands/cat-file/batch-format.ts +17 -18
  182. package/src/commands/cat-file/cat-file-command.ts +181 -15
  183. package/src/commands/check-ignore-command.ts +61 -17
  184. package/src/commands/checkout-command.ts +149 -21
  185. package/src/commands/checkout-index-command.ts +2 -1
  186. package/src/commands/checkout-paths.ts +13 -0
  187. package/src/commands/cherry-pick-command.ts +9 -0
  188. package/src/commands/clean-interactive.ts +20 -74
  189. package/src/commands/clone-command.ts +13 -0
  190. package/src/commands/column/column-config.ts +63 -0
  191. package/src/commands/column/column-layout.ts +396 -0
  192. package/src/commands/column/index.ts +2 -0
  193. package/src/commands/column-command.ts +171 -0
  194. package/src/commands/comment-char-config.ts +42 -0
  195. package/src/commands/commit-command.ts +61 -21
  196. package/src/commands/config-command.ts +28 -0
  197. package/src/commands/credential-helper.ts +807 -0
  198. package/src/commands/default-branch.ts +38 -0
  199. package/src/commands/diff-color-config.ts +23 -10
  200. package/src/commands/diff-command.ts +25 -2
  201. package/src/commands/fast-export/fast-export-command.ts +661 -35
  202. package/src/commands/fast-export/fast-import-command.ts +694 -94
  203. package/src/commands/fast-export/fast-stream-support.ts +18 -1
  204. package/src/commands/fetch-command.ts +103 -14
  205. package/src/commands/git-hooks.ts +85 -0
  206. package/src/commands/history-command.ts +952 -20
  207. package/src/commands/index-host.ts +51 -0
  208. package/src/commands/index-refresh.ts +121 -0
  209. package/src/commands/index.ts +9 -0
  210. package/src/commands/init-command.ts +34 -1
  211. package/src/commands/legacy-remotes.ts +4 -20
  212. package/src/commands/local-transport.ts +130 -9
  213. package/src/commands/log-command.ts +39 -1
  214. package/src/commands/log-output.ts +31 -4
  215. package/src/commands/maintenance-schedule-command.ts +418 -0
  216. package/src/commands/merge-command.ts +10 -0
  217. package/src/commands/merge-index-command.ts +202 -0
  218. package/src/commands/merge-one-file.ts +451 -0
  219. package/src/commands/merge-support.ts +127 -11
  220. package/src/commands/object-disk-info.ts +169 -0
  221. package/src/commands/octopus-merge.ts +37 -128
  222. package/src/commands/promisor-remote.ts +14 -3
  223. package/src/commands/pull-command.ts +173 -27
  224. package/src/commands/push-command.ts +50 -5
  225. package/src/commands/range-diff/range-diff-command.ts +86 -3
  226. package/src/commands/rebase-command.ts +46 -1
  227. package/src/commands/ref-filter/for-each-ref-command.ts +4 -3
  228. package/src/commands/ref-filter/ref-filter.ts +59 -4
  229. package/src/commands/ref-filter/ref-format.ts +83 -10
  230. package/src/commands/ref-filter/ref-listing-command.ts +30 -0
  231. package/src/commands/remote-command.ts +2 -2
  232. package/src/commands/remote-transport.ts +66 -3
  233. package/src/commands/repack-command.ts +75 -9
  234. package/src/commands/repo-command.ts +6 -70
  235. package/src/commands/reset-command.ts +11 -1
  236. package/src/commands/restore-command.ts +1 -0
  237. package/src/commands/rev-list-command.ts +205 -3
  238. package/src/commands/revert-command.ts +9 -0
  239. package/src/commands/revision-filenames.ts +32 -4
  240. package/src/commands/revision-range.ts +2 -2
  241. package/src/commands/revision-resolver.ts +21 -1
  242. package/src/commands/serve-repository.ts +34 -8
  243. package/src/commands/served-lazy-fetch.ts +164 -0
  244. package/src/commands/signing.ts +18 -10
  245. package/src/commands/status-color-config.ts +92 -0
  246. package/src/commands/status-command.ts +50 -2
  247. package/src/commands/status-format.ts +198 -50
  248. package/src/commands/tag-command.ts +57 -2
  249. package/src/commands/tree-restore.ts +17 -0
  250. package/src/commands/verify-command.ts +84 -12
  251. package/src/commands/worktree-add-command.ts +2 -0
  252. package/src/commands/worktree-overwrite-checks.ts +75 -14
  253. package/src/errors/commit-errors.ts +31 -3
  254. package/src/errors/git-api-error.ts +7 -0
  255. package/src/git-command.ts +105 -4
  256. package/src/git.ts +153 -0
  257. package/src/remote-config/remote-config-store.ts +16 -0
  258. package/src/results/cherry-pick-result.ts +4 -3
  259. package/src/results/diff-output.ts +8 -0
  260. package/src/results/diff-words.ts +160 -32
  261. package/src/results/line-prefix-sink.ts +102 -0
  262. package/src/results/merge-result.ts +4 -3
  263. package/src/results/rebase-result.ts +5 -0
  264. package/src/results/revert-result.ts +4 -3
  265. package/src/transport-command.ts +48 -2
@@ -2,7 +2,7 @@ import type { FilesApi, ObjectId } from "@statewalker/vcs-core";
2
2
  import { parseGitBool } from "@statewalker/vcs-utils";
3
3
  import { type Checkout, isIndexUnborn } from "@statewalker/vcs-working-tree";
4
4
 
5
- import { GitApiError, NoHeadError } from "../errors/index.js";
5
+ import { GitApiError } from "../errors/index.js";
6
6
  import { GuardedTransportCommand } from "../guarded-transport-command.js";
7
7
  import { RemoteConfigStore } from "../remote-config/index.js";
8
8
  import type { FetchResult } from "../results/fetch-result.js";
@@ -17,16 +17,43 @@ import { isRebaseSuccessful, RebaseStatus } from "../results/rebase-result.js";
17
17
  import type { CommitEditor } from "./commit-command.js";
18
18
  import { FetchCommand, TagOption } from "./fetch-command.js";
19
19
  import { FetchMultipleCommand } from "./fetch-multiple-command.js";
20
+ import { findForkPoint } from "./fork-point.js";
20
21
  import { commitsBaseSource, MergeBaseGraph } from "./merge-bases.js";
21
22
  import { MergeCommand } from "./merge-command.js";
22
23
  import { configValue } from "./merge-config.js";
23
24
  import { OperationState, readIndex } from "./merge-support.js";
24
25
  import { type CleanupMode, parseCleanupMode } from "./message-cleanup.js";
25
- import { RebaseCommand } from "./rebase-command.js";
26
+ import { type InteractiveHandler, RebaseCommand } from "./rebase-command.js";
26
27
  import { SubmoduleCommandError, type SubmoduleCommandResult } from "./submodule-commands.js";
27
28
  import { type FetchRecurseSubmodules, submoduleTouchesInRange } from "./submodule-fetch.js";
28
29
  import { SubmoduleUpdateCommand } from "./submodule-update-command.js";
29
30
 
31
+ /**
32
+ * How a pull reconciles (rebase.c's `enum rebase_type`): merge (false), rebase (true),
33
+ * rebase keeping merges (`merges`, `--rebase-merges`), or rebase interactively
34
+ * (`interactive`, `--interactive`).
35
+ */
36
+ export type PullRebaseMode = boolean | "merges" | "interactive";
37
+
38
+ /**
39
+ * rebase.c's `rebase_parse_value`: a boolean, `merges`/`m`, `interactive`/`i`; undefined
40
+ * for anything else, with git's error line for `preserve`/`p` (superseded by `merges`).
41
+ */
42
+ export function parseRebaseValue(value: string | undefined): {
43
+ mode?: PullRebaseMode;
44
+ error?: string;
45
+ } {
46
+ // git_parse_maybe_bool: a valueless key is true
47
+ const bool = value === undefined ? true : parseGitBool(value);
48
+ if (bool !== undefined) return { mode: bool };
49
+ if (value === "merges" || value === "m") return { mode: "merges" };
50
+ if (value === "interactive" || value === "i") return { mode: "interactive" };
51
+ if (value === "preserve" || value === "p") {
52
+ return { error: `error: ${value}: 'preserve' superseded by 'merges'` };
53
+ }
54
+ return {};
55
+ }
56
+
30
57
  /** One `FETCH_HEAD` entry to merge (pull.c's get_merge_heads). */
31
58
  interface MergeHead {
32
59
  objectId: ObjectId;
@@ -75,8 +102,10 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
75
102
  private remoteGiven = false;
76
103
  /** The refspecs after the remote (`git pull <remote> <refspec>...`) */
77
104
  private refSpecs: string[] = [];
78
- /** `--rebase` / `--no-rebase`; undefined: branch.<name>.rebase, then pull.rebase */
79
- private rebase?: boolean;
105
+ /** `--rebase[=<mode>]` / `--no-rebase`; undefined: branch.<name>.rebase, then pull.rebase */
106
+ private rebase?: PullRebaseMode;
107
+ /** The editors of an interactive rebase (`--rebase=interactive`) */
108
+ private interactiveHandler?: InteractiveHandler;
80
109
  /** `--verify-signatures` / `--no-verify-signatures`, passed to the merge */
81
110
  private verifySignatures?: boolean;
82
111
  /** `--autostash` / `--no-autostash`; undefined: pull.autoStash, then rebase.autoStash */
@@ -187,11 +216,21 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
187
216
  * configuration decides, as in git: `branch.<name>.rebase`, else `pull.rebase`, else merge
188
217
  * (a pull that cannot fast-forward then refuses unless `pull.ff` or a fast-forward mode
189
218
  * is given: git's "Need to specify how to reconcile divergent branches.").
190
- * Only this option puts `--rebase` in the reflog lines (git's are the command line's).
219
+ * Only this option puts `--rebase[=<mode>]` in the reflog lines (git's are the command
220
+ * line's).
221
+ *
222
+ * `"merges"` is `--rebase=merges` (the rebase keeps the branch's merges, `--rebase-merges`),
223
+ * `"interactive"` is `--rebase=interactive` (the rebase runs interactively: the handler of
224
+ * {@link runInteractively}, else git's sequence editor program). The configuration takes
225
+ * the same values (`merges`/`m`, `interactive`/`i`); any other dies as git's does.
191
226
  *
192
- * @param rebase Whether to use rebase
227
+ * The rebase goes onto what was fetched; its upstream is git's fork point of the branch
228
+ * (`git merge-base --fork-point` of the upstream's tracking ref, read before the fetch),
229
+ * so commits the upstream rewrote away are not replayed.
230
+ *
231
+ * @param rebase Whether to use rebase, or the rebase mode
193
232
  */
194
- setRebase(rebase: boolean): this {
233
+ setRebase(rebase: PullRebaseMode): this {
195
234
  this.checkCallable();
196
235
  this.rebase = rebase;
197
236
  return this;
@@ -201,7 +240,18 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
201
240
  * Whether rebase mode was requested with {@link setRebase} (the configuration aside).
202
241
  */
203
242
  isRebase(): boolean {
204
- return this.rebase ?? false;
243
+ return this.rebase !== undefined && this.rebase !== false;
244
+ }
245
+
246
+ /**
247
+ * The editors of an interactive rebasing pull (`--rebase=interactive`, `pull.rebase=
248
+ * interactive`; see `RebaseCommand.runInteractively`). Without one the rebase runs git's
249
+ * sequence editor program (`GIT_SEQUENCE_EDITOR`, `sequence.editor`, ...).
250
+ */
251
+ runInteractively(handler: InteractiveHandler): this {
252
+ this.checkCallable();
253
+ this.interactiveHandler = handler;
254
+ return this;
205
255
  }
206
256
 
207
257
  /**
@@ -435,7 +485,6 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
435
485
  * Execute the pull operation.
436
486
  *
437
487
  * @returns Pull result with fetch and merge results
438
- * @throws NoHeadError if HEAD is detached and no refspec is given
439
488
  * @throws GitApiError with git's stderr where git's pull dies (exit 128, or 1 when nothing
440
489
  * fetched is to be merged)
441
490
  */
@@ -448,10 +497,8 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
448
497
  await this.readCurrentIndex();
449
498
 
450
499
  // Get current branch
500
+ // a detached HEAD without refspec is refused after the fetch (die_no_merge_candidates)
451
501
  const currentBranch = await this.getCurrentBranch();
452
- if (!currentBranch && this.refSpecs.length === 0) {
453
- throw new NoHeadError("Cannot pull with detached HEAD");
454
- }
455
502
  const localBranchName = currentBranch?.replace(/^refs\/heads\//, "");
456
503
 
457
504
  const store = RemoteConfigStore.from(this._workingCopy);
@@ -487,9 +534,9 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
487
534
  if (this.rebase !== undefined && ff === FastForwardMode.FF_ONLY) ff = FastForwardMode.FF;
488
535
  }
489
536
  // git's pull.c: the option, else the configuration
490
- const configured =
491
- localBranchName !== undefined ? this.configRebase(localBranchName) : undefined;
492
- let rebase = this.rebase ?? configured ?? false;
537
+ // config_get_rebase only without --rebase / --no-rebase (`if (opt_rebase < 0)`)
538
+ const configured = this.rebase === undefined ? this.configRebase(localBranchName) : undefined;
539
+ let rebase: PullRebaseMode = this.rebase ?? configured ?? false;
493
540
  const rebaseUnspecified = this.rebase === undefined && configured === undefined;
494
541
 
495
542
  // an index with unmerged entries, or a merge in progress, dies before the fetch
@@ -549,6 +596,11 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
549
596
  };
550
597
  }
551
598
  }
599
+ // get_rebase_fork_point, before the fetch moves the tracking ref
600
+ const forkPoint =
601
+ rebase && localBranchName !== undefined && origHead !== undefined
602
+ ? await this.rebaseForkPoint(localBranchName, origHead)
603
+ : undefined;
552
604
 
553
605
  // a remote read from .git/remotes/ or .git/branches/ (git 2.x) is fetched with its own
554
606
  // refspecs, as any other: `git fetch <remote> [<refspec>...]`
@@ -601,7 +653,7 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
601
653
  const shown = () => (warnings.length > 0 ? { warnings } : {});
602
654
 
603
655
  const { heads, text: fetchHead } = await this.mergeHeadsFromFetchHead(checkout);
604
- if (heads.length === 0) this.dieNoMergeCandidates(localBranchName, rebase);
656
+ if (heads.length === 0) this.dieNoMergeCandidates(localBranchName, rebase !== false);
605
657
  const mergeIds = heads.map((h) => h.objectId);
606
658
 
607
659
  // pull_into_void: an unborn branch (rebasing or not) branches off what was fetched, a
@@ -697,10 +749,17 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
697
749
  // pull.c: recurse_submodules from the command line, else submodule.recurse
698
750
  const recurse = this.recurseSubmodules ?? this.configRecurseSubmodules();
699
751
  const updatesSubmodules = recurse === "yes" || recurse === "on-demand";
752
+ // get_rebase_newbase_and_upstream: onto the fetched head, from the fork point unless
753
+ // every side already shares it
754
+ const currHead = (await this.refsStore.resolve("HEAD").catch(() => undefined))?.objectId;
755
+ const newbase = mergeIds[0] as ObjectId;
756
+ const upstream = rebase
757
+ ? await this.rebaseUpstream(currHead ?? origHead, newbase, forkPoint)
758
+ : newbase;
700
759
  if (
701
760
  rebase &&
702
761
  updatesSubmodules &&
703
- (await submoduleTouchesInRange(this._workingCopy, mergeIds[0] as ObjectId, origHead)) > 0
762
+ (await submoduleTouchesInRange(this._workingCopy, upstream, currHead ?? origHead)) > 0
704
763
  ) {
705
764
  throw new GitApiError("fatal: cannot rebase with locally recorded submodule modifications", {
706
765
  exitCode: 128,
@@ -720,11 +779,17 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
720
779
  if (this.verifySignatures === true) {
721
780
  warnings = [...warnings, "warning: ignoring --verify-signatures for rebase"];
722
781
  }
782
+ // run_rebase: `git rebase [--rebase-merges|--interactive] --onto <newbase> <upstream>`
723
783
  const rebaseCommand = new RebaseCommand(this._workingCopy)
724
784
  .shareHooksOf(this)
725
- .setUpstream(mergeIds[0] as ObjectId)
785
+ .setOnto(newbase)
786
+ .setUpstream(upstream)
726
787
  .setReflogAction(action)
727
- .setAutoStash(autoStash === true);
788
+ .setAutoStash(autoStash === true)
789
+ // the child `git rebase` is the git pull runs (its warnings, its advice)
790
+ .setCompatibility(this.compatibility ?? this.hooks.compatibility);
791
+ if (rebase === "merges") rebaseCommand.setRebaseMerges(true);
792
+ if (rebase === "interactive") rebaseCommand.runInteractively(this.interactiveHandler ?? {});
728
793
  if (this.strategy) rebaseCommand.setStrategy(this.strategy);
729
794
  if (this.strategyOptions.length > 0) rebaseCommand.setStrategyOptions(this.strategyOptions);
730
795
  if (this.signoff !== undefined) rebaseCommand.setSignoff(this.signoff);
@@ -845,7 +910,9 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
845
910
  value === true ? [`--${name}`] : value === false ? [`--no-${name}`] : [];
846
911
  return [
847
912
  "pull",
848
- ...flag(this.rebase, "rebase"),
913
+ ...(typeof this.rebase === "string"
914
+ ? [`--rebase=${this.rebase}`]
915
+ : flag(this.rebase, "rebase")),
849
916
  ...flag(this.autoStash, "autostash"),
850
917
  ...(this.log === undefined
851
918
  ? []
@@ -1041,18 +1108,77 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
1041
1108
  }
1042
1109
 
1043
1110
  /**
1044
- * git's config_get_rebase: `branch.<name>.rebase`, else `pull.rebase`; any value other
1045
- * than false (`true`, `merges`, `interactive`) rebases. Undefined when neither is set.
1111
+ * git's config_get_rebase: `branch.<name>.rebase` (on a branch), else `pull.rebase`, read
1112
+ * by rebase_parse_value. Undefined when neither is set.
1113
+ *
1114
+ * @throws GitApiError `fatal: invalid value for '<key>': '<value>'` (exit 128), after
1115
+ * rebase_parse_value's `preserve` error line
1046
1116
  */
1047
- private configRebase(branch: string): boolean | undefined {
1048
- for (const key of [`branch.${branch}.rebase`, "pull.rebase"]) {
1049
- const value = this.config(key);
1050
- if (value === undefined) continue;
1051
- return parseGitBool(value) ?? true;
1117
+ private configRebase(branch: string | undefined): PullRebaseMode | undefined {
1118
+ const keys =
1119
+ branch !== undefined ? [`branch.${branch}.rebase`, "pull.rebase"] : ["pull.rebase"];
1120
+ const store = RemoteConfigStore.from(this._workingCopy);
1121
+ for (const key of keys) {
1122
+ const values = store.valuesWithOrigin(key);
1123
+ if (values.length === 0) continue;
1124
+ const text = values[values.length - 1]?.text;
1125
+ const { mode, error } = parseRebaseValue(text);
1126
+ if (mode !== undefined) return mode;
1127
+ throw new GitApiError(
1128
+ [...(error ? [error] : []), `fatal: invalid value for '${key}': '${text}'`].join("\n"),
1129
+ { exitCode: 128 },
1130
+ );
1052
1131
  }
1053
1132
  return undefined;
1054
1133
  }
1055
1134
 
1135
+ /**
1136
+ * pull.c's get_rebase_fork_point: `git merge-base --fork-point <tracking> <branch>`, where
1137
+ * the tracking ref is the first refspec's (get_tracking_branch) or, without refspec, the
1138
+ * branch's upstream when the pull is from the branch's remote (get_upstream_branch).
1139
+ * Undefined when there is none or the search fails (git hides its stderr).
1140
+ */
1141
+ private async rebaseForkPoint(branch: string, head: ObjectId): Promise<ObjectId | undefined> {
1142
+ const store = RemoteConfigStore.from(this._workingCopy);
1143
+ let tracking: string | undefined;
1144
+ const refspec = this.refSpecs[0];
1145
+ if (refspec !== undefined) {
1146
+ tracking = trackingBranchOf(this.remote, refspec);
1147
+ } else {
1148
+ // remote_get(repo)'s name against remote_for_branch
1149
+ if (this.remote !== store.remoteForBranch(branch)) return undefined;
1150
+ tracking = await this.revisionResolver()
1151
+ .upstreamOf(branch)
1152
+ .catch(() => undefined);
1153
+ }
1154
+ if (tracking === undefined) return undefined;
1155
+ try {
1156
+ const graph = new MergeBaseGraph(commitsBaseSource(this.commits, async () => new Map()));
1157
+ return await findForkPoint(this.forkPointSource(graph), tracking, head);
1158
+ } catch {
1159
+ return undefined;
1160
+ }
1161
+ }
1162
+
1163
+ /**
1164
+ * get_rebase_newbase_and_upstream's upstream: the fork point, unless the octopus merge
1165
+ * base of HEAD, the fetched head and the fork point is the fork point itself; else the
1166
+ * fetched head.
1167
+ */
1168
+ private async rebaseUpstream(
1169
+ head: ObjectId,
1170
+ mergeHead: ObjectId,
1171
+ forkPoint: ObjectId | undefined,
1172
+ ): Promise<ObjectId> {
1173
+ if (forkPoint === undefined) return mergeHead;
1174
+ const graph = new MergeBaseGraph(commitsBaseSource(this.commits, async () => new Map()));
1175
+ // commit_list_insert prepends: the fork point first, then the merge head, then HEAD
1176
+ const bases = await graph.octopusMergeBases(
1177
+ [forkPoint, mergeHead, head].map((id) => graph.commit(id)),
1178
+ );
1179
+ return bases[0]?.id === forkPoint ? mergeHead : forkPoint;
1180
+ }
1181
+
1056
1182
  /**
1057
1183
  * Whether `ancestor` is an ancestor of `commit` (git's repo_is_descendant_of), by git's
1058
1184
  * date-ordered paint walk, which stops once the sides meet.
@@ -1064,3 +1190,23 @@ export class PullCommand extends GuardedTransportCommand<PullResult> {
1064
1190
  return bases.some((b) => b.id === ancestor);
1065
1191
  }
1066
1192
  }
1193
+
1194
+ /**
1195
+ * pull.c's get_tracking_branch: the ref the first refspec's source is tracked as
1196
+ * (`refs/remotes/<remote>/<branch>`, `refs/heads/<branch>` for `.`; HEAD for an empty
1197
+ * source), undefined for sources under `refs/`, `tags/` or `remotes/` that are no branch.
1198
+ */
1199
+ function trackingBranchOf(remote: string, refspec: string): string | undefined {
1200
+ let spec = refspec.startsWith("+") ? refspec.slice(1) : refspec;
1201
+ const colon = spec.indexOf(":");
1202
+ if (colon >= 0) spec = spec.slice(0, colon);
1203
+ let src = spec;
1204
+ if (src === "" || src === "HEAD") src = "HEAD";
1205
+ else if (src.startsWith("heads/")) src = src.slice("heads/".length);
1206
+ else if (src.startsWith("refs/heads/")) src = src.slice("refs/heads/".length);
1207
+ else if (src.startsWith("refs/") || src.startsWith("tags/") || src.startsWith("remotes/")) {
1208
+ src = "";
1209
+ }
1210
+ if (src === "") return undefined;
1211
+ return remote === "." ? `refs/heads/${src}` : `refs/remotes/${remote}/${src}`;
1212
+ }
@@ -199,6 +199,7 @@ export class PushCommand extends TransportCommand<PushResult> {
199
199
  private useBitmaps?: boolean;
200
200
  private pushOptions: string[] = [];
201
201
  private receivePack?: string;
202
+ private localReceiveMaxObjectSize?: number;
202
203
  private prune = false;
203
204
  private streamRequestBody?: boolean;
204
205
  /** Leases (an entry without a ref: every other pushed ref at its tracking value) */
@@ -648,6 +649,24 @@ export class PushCommand extends TransportCommand<PushResult> {
648
649
  return this.receivePack;
649
650
  }
650
651
 
652
+ /**
653
+ * The largest object a local repository's receive-pack (run in process for a path remote)
654
+ * takes in the pushed pack, in bytes: a pack holding a larger one is refused as git reports
655
+ * its child's death (`unpack index-pack abnormal exit` / `unpack-objects abnormal exit`,
656
+ * every ref `unpacker error`). JGit's `ReceivePack.setMaxObjectSizeLimit`; git has no such
657
+ * setting, so no config key gives it. Absent: 1 GiB. A remote server applies its own.
658
+ *
659
+ * @example
660
+ * ```ts
661
+ * await git.push().setRemote("../bare.git").setLocalReceiveMaxObjectSize(1 << 20).call();
662
+ * ```
663
+ */
664
+ setLocalReceiveMaxObjectSize(bytes: number | undefined): this {
665
+ this.checkCallable();
666
+ this.localReceiveMaxObjectSize = bytes;
667
+ return this;
668
+ }
669
+
651
670
  /**
652
671
  * Execute the push.
653
672
  *
@@ -877,6 +896,9 @@ export class PushCommand extends TransportCommand<PushResult> {
877
896
  host: {
878
897
  ...(environment ? { environment } : {}),
879
898
  compatibility: this.hooks.compatibility,
899
+ ...(this.localReceiveMaxObjectSize !== undefined
900
+ ? { maxObjectSize: this.localReceiveMaxObjectSize }
901
+ : {}),
880
902
  },
881
903
  // receive-pack's config warnings reach the shared stderr
882
904
  onWarning: (line) => receiveWarnings.push(line),
@@ -1365,16 +1387,37 @@ export class PushCommand extends TransportCommand<PushResult> {
1365
1387
  /**
1366
1388
  * get_commons_through_negotiation: `git fetch --negotiate-only --negotiation-tip=<id>...
1367
1389
  * <url>` run as git's child, its acknowledged commits the commons; its warnings (stderr)
1368
- * passed on, and no commons when it fails (git's "push negotiation failed").
1390
+ * passed on, and no commons when it fails (git's "push negotiation failed"). git 2.56 passes
1391
+ * the pushed remote's `remote.<name>.negotiationRestrict` values in place of the pushed ids
1392
+ * when it has any, and its `negotiationInclude` values as `--negotiation-include`; with
1393
+ * nothing to pass the child is not run (undefined).
1369
1394
  */
1370
1395
  private async negotiateCommons(
1371
1396
  url: string,
1372
1397
  tips: readonly string[],
1373
- ): Promise<{ commons?: readonly string[]; warnings?: readonly string[] }> {
1398
+ ): Promise<{ commons?: readonly string[]; warnings?: readonly string[] } | undefined> {
1399
+ const compatibility = this.compatibility ?? this.hooks.compatibility;
1400
+ const option = (key: string): string[] => {
1401
+ if (compatibility === "2.43") return [];
1402
+ const list: string[] = [];
1403
+ // parse_transport_option: an empty value clears the list
1404
+ for (const value of RemoteConfigStore.from(this._workingCopy).values(
1405
+ `remote.${this.remote}.${key}`,
1406
+ )) {
1407
+ if (value === "") list.length = 0;
1408
+ else list.push(value);
1409
+ }
1410
+ return list;
1411
+ };
1412
+ const restrict = option("negotiationRestrict");
1413
+ const include = option("negotiationInclude");
1414
+ const restricting = restrict.length > 0 ? restrict : tips;
1415
+ if (restricting.length + include.length === 0) return undefined;
1374
1416
  const fetch = this.configureChild(new FetchCommand(this._workingCopy))
1375
1417
  .setRemote(url)
1376
- .setNegotiationTips(...tips)
1418
+ .setNegotiationTips(...restricting)
1377
1419
  .setNegotiateOnly(true);
1420
+ if (include.length > 0) fetch.setNegotiationIncludes(...include);
1378
1421
  try {
1379
1422
  const result = await fetch.call();
1380
1423
  return {
@@ -1820,9 +1863,11 @@ export class PushCommand extends TransportCommand<PushResult> {
1820
1863
  if (matches.length !== 1) return () => undefined;
1821
1864
  tracking = matches[0] as string;
1822
1865
  }
1866
+ // remote->fetch as configured: no default refspec (a remote made of `remote.<x>.*`
1867
+ // settings alone tracks nothing)
1823
1868
  const specs = store
1824
- .read(tracking)
1825
- .fetchRefspecs.map((spec) => parseRefSpec(spec))
1869
+ .configuredFetchRefspecs(tracking)
1870
+ .map((spec) => parseRefSpec(spec))
1826
1871
  .filter((spec) => !spec.negative && spec.source && spec.destination);
1827
1872
  return (remoteRef) => {
1828
1873
  const spec = specs.find((s) => matchSource(s, remoteRef));
@@ -20,9 +20,10 @@ import type { ObjectId } from "@statewalker/vcs-core";
20
20
 
21
21
  import { GitApiError } from "../../errors/index.js";
22
22
  import { GitCommand } from "../../git-command.js";
23
+ import { RemoteConfigStore } from "../../remote-config/index.js";
23
24
  import { bytesToLatin1, latin1ToBytes } from "../apply/latin1.js";
24
25
  import { readDiffColorSettings } from "../diff-color-config.js";
25
- import type { LogOutputOptions } from "../log-output.js";
26
+ import { type LogDiffMerges, type LogOutputOptions, mergesMode } from "../log-output.js";
26
27
  import { formatCommitPretty } from "../pretty-format.js";
27
28
  import { RevListCommand } from "../rev-list-command.js";
28
29
  import {
@@ -80,11 +81,43 @@ export function rangeDiffNotesOptions(
80
81
  return { notesRefs: refs };
81
82
  }
82
83
 
84
+ /**
85
+ * What the `git log` reading a range is told of merges by range-diff's `--diff-merges` and
86
+ * `--remerge-diff` (git 2.48, passed through in order): diff-merges.c's `func_by_opt` over each
87
+ * value, the last one winning (`m`/`on` is `-m`, which follows `log.diffMerges`, given as
88
+ * `configured`). `fullHistory` is whether any value turned `simplify_history` off
89
+ * (`set_separate` and `set_remerge_diff`, which no later value turns back on). Undefined for
90
+ * none given (merges left out); a value git refuses throws the log's death.
91
+ */
92
+ export function rangeDiffMergesOptions(
93
+ given: readonly string[],
94
+ configured?: string,
95
+ ): { log: Pick<LogOutputOptions, "diffMerges" | "m">; fullHistory: boolean } | undefined {
96
+ let log: Pick<LogOutputOptions, "diffMerges" | "m"> | undefined;
97
+ let fullHistory = false;
98
+ for (const value of given) {
99
+ const byDefault = value === "m" || value === "on";
100
+ const mode = byDefault ? (configured ? mergesMode(configured) : "separate") : mergesMode(value);
101
+ if (mode === undefined && !byDefault)
102
+ throw new GitApiError(`fatal: invalid value for '--diff-merges': '${value}'`, {
103
+ exitCode: 128,
104
+ });
105
+ if (mode === "separate" || mode === "first-parent" || mode === "remerge") fullHistory = true;
106
+ log = byDefault ? { m: true } : { diffMerges: mode };
107
+ }
108
+ return log ? { log, fullHistory } : undefined;
109
+ }
110
+
83
111
  /** What reads the patches of a range and prints the pairs (shared with format-patch). */
84
112
  export interface RangeDiffRun {
85
113
  creationFactor: number;
86
114
  /** `--notes`... passed to the log reading each range */
87
115
  notes: readonly RangeDiffNotesOption[];
116
+ /**
117
+ * `--diff-merges=<format>` values (`--remerge-diff` as `remerge`), in order: merges are then
118
+ * read too, diffed by that format (git 2.48; format-patch passes none)
119
+ */
120
+ diffMerges?: readonly string[];
88
121
  /** More arguments of that log (paths after `--`) */
89
122
  logArgs?: readonly string[];
90
123
  dualColor: boolean;
@@ -149,8 +182,9 @@ export abstract class RangeDiffBase<T> extends GitCommand<T> {
149
182
  }
150
183
 
151
184
  private async readPatches(range: string, run: RangeDiffRun): Promise<RangeDiffPatch[]> {
185
+ const includeMerges = (run.diffMerges?.length ?? 0) > 0;
152
186
  const log = new RevListCommand(this._workingCopy)
153
- .setNoMerges(true)
187
+ .setNoMerges(!includeMerges)
154
188
  .setOrder("date")
155
189
  .setReverse(true)
156
190
  .setDiffOptions({ color: false, noPrefix: true, submoduleFormat: "short" });
@@ -158,7 +192,15 @@ export abstract class RangeDiffBase<T> extends GitCommand<T> {
158
192
  for (const arg of run.logArgs ?? []) log.addArgument(arg);
159
193
  let bytes: Uint8Array;
160
194
  try {
195
+ const merges = includeMerges
196
+ ? rangeDiffMergesOptions(
197
+ run.diffMerges ?? [],
198
+ RemoteConfigStore.from(this._workingCopy).value("log.diffMerges"),
199
+ )
200
+ : undefined;
201
+ if (merges?.fullHistory) log.setFullHistory(true);
161
202
  bytes = await log.callLogBytes({
203
+ ...merges?.log,
162
204
  patch: true,
163
205
  pretty: "medium",
164
206
  decorate: "no",
@@ -172,7 +214,7 @@ export abstract class RangeDiffBase<T> extends GitCommand<T> {
172
214
  });
173
215
  }
174
216
  try {
175
- return readRangeDiffPatches(bytesToLatin1(bytes));
217
+ return readRangeDiffPatches(bytesToLatin1(bytes), includeMerges);
176
218
  } catch (error) {
177
219
  if (error instanceof RangeDiffError)
178
220
  throw new GitApiError(
@@ -239,6 +281,9 @@ export class RangeDiffCommand extends RangeDiffBase<Uint8Array> {
239
281
  private patch = false;
240
282
  private abbrev?: number;
241
283
  private maxMemory?: string | bigint;
284
+ /** `--diff-merges=<v>` (`--remerge-diff` as `remerge`) and the option as written */
285
+ private readonly diffMerges: { value: string; option: string }[] = [];
286
+ private compatibility?: "2.43" | "2.56";
242
287
 
243
288
  /**
244
289
  * A positional argument as git takes it: a range, a commit, `--`, or what follows the
@@ -339,10 +384,47 @@ export class RangeDiffCommand extends RangeDiffBase<Uint8Array> {
339
384
  return this;
340
385
  }
341
386
 
387
+ /**
388
+ * `--diff-merges=<format>` (git 2.48): merge commits of both ranges are read too, each
389
+ * diffed as `git log --diff-merges=<format>` diffs it (`first-parent`/`1`, `separate`,
390
+ * `combined`/`c`, `dense-combined`/`cc`, `remerge`/`r`, `off`/`none`, `m`/`on`), and paired
391
+ * like the other commits. Several calls are passed on in order, the last winning; a value
392
+ * git refuses fails the call as git's log dies (exit 255). Refused under 2.43, which lacks
393
+ * the option.
394
+ */
395
+ setDiffMerges(format: LogDiffMerges | string): this {
396
+ this.checkCallable();
397
+ this.diffMerges.push({ value: format, option: `diff-merges=${format}` });
398
+ return this;
399
+ }
400
+
401
+ /** `--remerge-diff` (git 2.48): `--diff-merges=remerge`. */
402
+ setRemergeDiff(value: boolean): this {
403
+ this.checkCallable();
404
+ if (value) this.diffMerges.push({ value: "remerge", option: "remerge-diff" });
405
+ return this;
406
+ }
407
+
408
+ /**
409
+ * The git version whose options this follows (default the hook runner's): 2.43 has no
410
+ * `--diff-merges` or `--remerge-diff`.
411
+ */
412
+ setCompatibility(version: "2.43" | "2.56"): this {
413
+ this.checkCallable();
414
+ this.compatibility = version;
415
+ return this;
416
+ }
417
+
342
418
  /** The output as bytes. */
343
419
  async call(): Promise<Uint8Array> {
344
420
  this.checkCallable();
345
421
  this.setCallable(false);
422
+ if (this.diffMerges.length > 0 && (this.compatibility ?? this.gitCompatibility()) === "2.43") {
423
+ // parse_options of 2.43, which has neither option
424
+ throw new GitApiError(`error: unknown option \`${this.diffMerges[0]?.option}'`, {
425
+ exitCode: 129,
426
+ });
427
+ }
346
428
  let maxMemory: bigint | undefined;
347
429
  if (typeof this.maxMemory === "string") {
348
430
  maxMemory = parseRangeDiffMaxMemory(this.maxMemory);
@@ -356,6 +438,7 @@ export class RangeDiffCommand extends RangeDiffBase<Uint8Array> {
356
438
  return this.showRangeDiff(range1, range2, {
357
439
  creationFactor: this.creationFactor,
358
440
  notes: this.notes,
441
+ diffMerges: this.diffMerges.map((d) => d.value),
359
442
  logArgs,
360
443
  dualColor: this.simpleColor < 1,
361
444
  ...(color !== undefined ? { color } : {}),