@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
@@ -19,6 +19,9 @@ import {
19
19
  } from "@statewalker/vcs-working-tree";
20
20
  import {
21
21
  EMPTY_AMEND_ADVICE,
22
+ EMPTY_CHERRY_PICK_ADVICE,
23
+ EMPTY_CHERRY_PICK_ADVICE_SINGLE,
24
+ EMPTY_REBASE_PICK_ADVICE,
22
25
  EmptyCommitError,
23
26
  GitApiError,
24
27
  HookFailedError,
@@ -130,6 +133,11 @@ export interface CommitResult extends Commit {
130
133
  * when it said nothing
131
134
  */
132
135
  rerereOutput?: string[];
136
+ /**
137
+ * What git printed on stderr as it started, line by line: git 2.5x's
138
+ * `core.commentChar=auto` deprecation warning and its advice. Absent when it said nothing.
139
+ */
140
+ warnings?: string[];
133
141
  }
134
142
 
135
143
  /**
@@ -600,7 +608,11 @@ export class CommitCommand extends GitCommand<CommitResult> {
600
608
  return this;
601
609
  }
602
610
 
603
- /** The git version whose patch-mode prompts {@link setPatch} reproduces (default 2.56). */
611
+ /**
612
+ * The git version followed (default 2.56): {@link setPatch}'s patch-mode prompts, and
613
+ * {@link callDryRun}'s status colors (2.43 knows no `#rgb` and leaves `-s -z`'s `??`
614
+ * uncolored).
615
+ */
604
616
  setCompatibility(version: PatchCompatibility): this {
605
617
  this.checkCallable();
606
618
  this.patchCompatibility = version;
@@ -953,15 +965,7 @@ export class CommitCommand extends GitCommand<CommitResult> {
953
965
  this.message !== undefined || this.reused || this.fixup
954
966
  ? undefined
955
967
  : await this.readTemplate(config);
956
- const rebasing = (await state.read("rebase-merge/head-name")) !== undefined;
957
- const whence: CommitWhence =
958
- ctx.mergeHeads.length > 0
959
- ? "merge"
960
- : ctx.pickHead
961
- ? rebasing && (await state.ref("REBASE_HEAD")) === ctx.pickHead
962
- ? "rebase-pick"
963
- : "cherry-pick"
964
- : "commit";
968
+ const whence = await this.commitWhence(state, ctx.mergeHeads, ctx.pickHead);
965
969
  // the message so far
966
970
  let sb = "";
967
971
  let cutLineAdded = false;
@@ -1263,7 +1267,7 @@ export class CommitCommand extends GitCommand<CommitResult> {
1263
1267
  const head = await this.commits.load(headId);
1264
1268
  status.setReferenceCommit(head?.parents[0] ?? null);
1265
1269
  }
1266
- return status.callText(options);
1270
+ return status.callText({ colorCompatibility: this.patchCompatibility, ...options });
1267
1271
  }
1268
1272
 
1269
1273
  /** {@link withFalseIndex} with the files of `tree` (a partial commit's stored tree). */
@@ -1316,6 +1320,11 @@ export class CommitCommand extends GitCommand<CommitResult> {
1316
1320
  return this;
1317
1321
  }
1318
1322
 
1323
+ /** git sets `warn_on_auto_comment_char`: 2.5x warns of `core.commentChar=auto` here. */
1324
+ protected override autoCommentCharWarningEntryPoints(): readonly string[] {
1325
+ return ["call", "callDryRun"];
1326
+ }
1327
+
1319
1328
  /**
1320
1329
  * Execute the commit.
1321
1330
  *
@@ -2149,7 +2158,10 @@ export class CommitCommand extends GitCommand<CommitResult> {
2149
2158
  await state.write("COMMIT_EDITMSG", sb);
2150
2159
  // amend_file_with_trailers over COMMIT_EDITMSG
2151
2160
  sb = await this.withTrailers(sb, state, undefined);
2152
- await this.refuseNothingToCommit(treeId, parents, mergeHeads, previousCommit, partialTree);
2161
+ await this.refuseNothingToCommit(treeId, parents, mergeHeads, previousCommit, partialTree, {
2162
+ state,
2163
+ pickHead,
2164
+ });
2153
2165
  // prepare-commit-msg and commit-msg, which may rewrite COMMIT_EDITMSG: the commit
2154
2166
  // takes the file's text (cmd_commit reads it back)
2155
2167
  // (git's hook arguments: read only when hooks can run)
@@ -2221,26 +2233,31 @@ export class CommitCommand extends GitCommand<CommitResult> {
2221
2233
  mergeHeads: ObjectId[],
2222
2234
  previousCommit: Commit | undefined,
2223
2235
  partialTree: ObjectId | undefined,
2236
+ pick: { state: OperationState; pickHead: ObjectId | undefined },
2224
2237
  ): Promise<void> {
2225
2238
  if (this.allowEmpty || mergeHeads.length > 0) return;
2239
+ const refusal = async () =>
2240
+ this.emptyCommitError(
2241
+ partialTree,
2242
+ await this.commitWhence(pick.state, mergeHeads, pick.pickHead),
2243
+ );
2226
2244
  if (parents.length === 0) {
2227
2245
  // no first parent (an initial commit, or --amend of a root commit): git counts the
2228
2246
  // index, `cache_nr - ita_nr > 0`; only intent-to-add entries (or none) leave the tree
2229
2247
  // empty
2230
- if (treeId === this.objectFormat.emptyTreeId) throw await this.emptyCommitError(partialTree);
2248
+ if (treeId === this.objectFormat.emptyTreeId) throw await refusal();
2231
2249
  return;
2232
2250
  }
2233
2251
  if (this.amend && (previousCommit?.parents.length ?? 0) > 1) return;
2234
2252
  const parentCommit = await this.commits.load(parents[0] as ObjectId);
2235
- if (parentCommit && parentCommit.tree === treeId) {
2236
- throw await this.emptyCommitError(partialTree);
2237
- }
2253
+ if (parentCommit && parentCommit.tree === treeId) throw await refusal();
2238
2254
  }
2239
2255
 
2240
2256
  /**
2241
2257
  * prepare_to_commit's refusal of an empty commit: run_status on stdout (the status of the
2242
2258
  * index the commit would record, against HEAD^1 when amending: `git commit --dry-run`'s
2243
- * text), then `empty_amend_advice` on stderr when amending; exit status 1, nothing written.
2259
+ * text), then on stderr `empty_amend_advice` when amending, else `empty_cherry_pick_advice`
2260
+ * and its sequel for a cherry-pick or rebase-pick whence; exit status 1, nothing written.
2244
2261
  */
2245
2262
  private async emptyCommitError(
2246
2263
  partialTree: ObjectId | undefined,
@@ -2257,10 +2274,33 @@ export class CommitCommand extends GitCommand<CommitResult> {
2257
2274
  ...(whence ? { whence } : {}),
2258
2275
  });
2259
2276
  const status = partialTree ? await this.withIndexOfTree(partialTree, run) : await run();
2260
- return new EmptyCommitError(undefined, {
2261
- stdout: status.text,
2262
- stderr: this.amend ? EMPTY_AMEND_ADVICE : "",
2263
- });
2277
+ const stderr = this.amend
2278
+ ? EMPTY_AMEND_ADVICE
2279
+ : whence === "cherry-pick"
2280
+ ? EMPTY_CHERRY_PICK_ADVICE + EMPTY_CHERRY_PICK_ADVICE_SINGLE
2281
+ : whence === "rebase-pick"
2282
+ ? EMPTY_CHERRY_PICK_ADVICE + EMPTY_REBASE_PICK_ADVICE
2283
+ : "";
2284
+ return new EmptyCommitError(undefined, { stdout: status.text, stderr });
2285
+ }
2286
+
2287
+ /**
2288
+ * git's whence (builtin/commit.c `determine_whence`, sequencer_determine_whence): a merge
2289
+ * (MERGE_HEAD), a rebase stopped at a pick (CHERRY_PICK_HEAD the commit REBASE_HEAD names),
2290
+ * a cherry-pick (CHERRY_PICK_HEAD; git's `FROM_CHERRY_PICK_MULTI` is overwritten by its
2291
+ * `else`, so a sequence of picks is a single one), else a plain commit.
2292
+ */
2293
+ private async commitWhence(
2294
+ state: OperationState,
2295
+ mergeHeads: ObjectId[],
2296
+ pickHead: ObjectId | undefined,
2297
+ ): Promise<CommitWhence> {
2298
+ if (mergeHeads.length > 0) return "merge";
2299
+ if (!pickHead) return "commit";
2300
+ const rebasing = (await state.read("rebase-merge/head-name")) !== undefined;
2301
+ return rebasing && (await state.ref("REBASE_HEAD")) === pickHead
2302
+ ? "rebase-pick"
2303
+ : "cherry-pick";
2264
2304
  }
2265
2305
 
2266
2306
  /** The commit of `treeId` made, HEAD moved to it, and what was in progress ended. */
@@ -425,6 +425,34 @@ export class ConfigCommand extends GitCommand<ConfigCommandResult> {
425
425
  }
426
426
  }
427
427
 
428
+ /**
429
+ * The values of the key {@link get} names, as git's `git_configset_get_string_multi` reads
430
+ * them before checking them: in order, `undefined` for a key written without a value. Reads
431
+ * what `get` reads (the scope's file or `--file`, else the whole configuration); a file it
432
+ * cannot open has no values.
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * const repos = await new ConfigCommand(wc).setScope("global").get("maintenance.repo").callValues();
437
+ * ```
438
+ */
439
+ async callValues(): Promise<(string | undefined)[]> {
440
+ this.checkCallable();
441
+ this.setCallable(false);
442
+ const action = this.action;
443
+ if (action?.kind !== "get") throw new GitApiError("callValues() needs a key: call get()");
444
+ const parsed = parseConfigKey(action.key);
445
+ if ("status" in parsed) throw new GitApiError(parsed.error);
446
+ try {
447
+ return (await this.readEntries(false)).filter((e) => e.key === parsed.key).map((e) => e.text);
448
+ } catch (error) {
449
+ if (error instanceof Refusal) {
450
+ throw new GitApiError(error.lines.join("\n"), { exitCode: error.exitCode });
451
+ }
452
+ throw error;
453
+ }
454
+ }
455
+
428
456
  private async run(action: ConfigAction): Promise<ConfigCommandResult> {
429
457
  if (this.type !== undefined && !CONFIG_VALUE_TYPES.includes(this.type)) {
430
458
  throw fatal(`unrecognized --type argument, ${this.type}`);