@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.
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
- package/dist/commands/archive/remote-archive-command.d.ts +4 -1
- package/dist/commands/archive/remote-archive-command.d.ts.map +1 -1
- package/dist/commands/branch-command.d.ts +14 -2
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/cat-file/batch-format.d.ts +8 -12
- package/dist/commands/cat-file/batch-format.d.ts.map +1 -1
- package/dist/commands/cat-file/cat-file-command.d.ts +39 -5
- package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
- package/dist/commands/check-ignore-command.d.ts.map +1 -1
- package/dist/commands/checkout-command.d.ts +4 -0
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-paths.d.ts +9 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -1
- package/dist/commands/cherry-pick-command.d.ts +3 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-interactive.d.ts +0 -9
- package/dist/commands/clean-interactive.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +2 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/column/column-config.d.ts +23 -0
- package/dist/commands/column/column-config.d.ts.map +1 -0
- package/dist/commands/column/column-layout.d.ts +129 -0
- package/dist/commands/column/column-layout.d.ts.map +1 -0
- package/dist/commands/column/index.d.ts +3 -0
- package/dist/commands/column/index.d.ts.map +1 -0
- package/dist/commands/column-command.d.ts +59 -0
- package/dist/commands/column-command.d.ts.map +1 -0
- package/dist/commands/comment-char-config.d.ts +15 -0
- package/dist/commands/comment-char-config.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +21 -2
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/config-command.d.ts +12 -0
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/credential-helper.d.ts +214 -0
- package/dist/commands/credential-helper.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +17 -1
- package/dist/commands/default-branch.d.ts.map +1 -1
- package/dist/commands/diff-color-config.d.ts +4 -0
- package/dist/commands/diff-color-config.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +12 -0
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/fast-export/fast-export-command.d.ts +89 -2
- package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -1
- package/dist/commands/fast-export/fast-import-command.d.ts +113 -8
- package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -1
- package/dist/commands/fast-export/fast-stream-support.d.ts +0 -9
- package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +21 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +28 -0
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/history-command.d.ts +173 -7
- package/dist/commands/history-command.d.ts.map +1 -1
- package/dist/commands/index-host.d.ts +19 -0
- package/dist/commands/index-host.d.ts.map +1 -1
- package/dist/commands/index-refresh.d.ts +36 -0
- package/dist/commands/index-refresh.d.ts.map +1 -0
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +7 -6
- package/dist/commands/init-command.d.ts +20 -0
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/local-transport.d.ts +29 -1
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +7 -0
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +11 -0
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/maintenance-schedule-command.d.ts +122 -0
- package/dist/commands/maintenance-schedule-command.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +2 -0
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-index-command.d.ts +42 -0
- package/dist/commands/merge-index-command.d.ts.map +1 -0
- package/dist/commands/merge-one-file.d.ts +129 -0
- package/dist/commands/merge-one-file.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +21 -2
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/object-disk-info.d.ts +35 -0
- package/dist/commands/object-disk-info.d.ts.map +1 -0
- package/dist/commands/octopus-merge.d.ts +3 -3
- package/dist/commands/octopus-merge.d.ts.map +1 -1
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts +55 -7
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +18 -1
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/range-diff/range-diff-command.d.ts +37 -1
- package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +13 -1
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/ref-filter/for-each-ref-command.d.ts +3 -2
- package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -1
- package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -1
- package/dist/commands/ref-filter/ref-format.d.ts +26 -1
- package/dist/commands/ref-filter/ref-format.d.ts.map +1 -1
- package/dist/commands/ref-filter/ref-listing-command.d.ts +9 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -1
- package/dist/commands/remote-transport.d.ts +27 -0
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/repack-command.d.ts +18 -2
- package/dist/commands/repack-command.d.ts.map +1 -1
- package/dist/commands/repo-command.d.ts +2 -7
- package/dist/commands/repo-command.d.ts.map +1 -1
- package/dist/commands/reset-command.d.ts +4 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts.map +1 -1
- package/dist/commands/rev-list-command.d.ts +65 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +3 -0
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-filenames.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +17 -0
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +12 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +17 -1
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/served-lazy-fetch.d.ts +61 -0
- package/dist/commands/served-lazy-fetch.d.ts.map +1 -0
- package/dist/commands/signing.d.ts +10 -4
- package/dist/commands/signing.d.ts.map +1 -1
- package/dist/commands/status-color-config.d.ts +33 -0
- package/dist/commands/status-color-config.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +15 -0
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-format.d.ts +46 -4
- package/dist/commands/status-format.d.ts.map +1 -1
- package/dist/commands/tag-command.d.ts +15 -1
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/tree-restore.d.ts +14 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/verify-command.d.ts +22 -2
- package/dist/commands/verify-command.d.ts.map +1 -1
- package/dist/commands/worktree-add-command.d.ts.map +1 -1
- package/dist/commands/worktree-overwrite-checks.d.ts +31 -6
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/{commands-C9M78Chn.js → commands-DT3VEv50.js} +14879 -16703
- package/dist/errors/commit-errors.d.ts +23 -3
- package/dist/errors/commit-errors.d.ts.map +1 -1
- package/dist/errors/git-api-error.d.ts +6 -0
- package/dist/errors/git-api-error.d.ts.map +1 -1
- package/dist/errors/index.js +30 -4
- package/dist/{fsck-C4US3l0B.js → fsck-BZ508Elg.js} +1 -1
- package/dist/git-command.d.ts +33 -1
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +104 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/{remote-transport-C43eykfK.js → local-transport-D98U6p4d.js} +184 -683
- package/dist/{maintenance-run-command-CoJFKr2p.js → maintenance-run-command-DZFnbnbo.js} +2285 -79
- package/dist/remote-config/remote-config-store.d.ts +6 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/remote-transport-zvSqwpOB.js +4865 -0
- package/dist/results/cherry-pick-result.d.ts +4 -3
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +7 -0
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/diff-words.d.ts +14 -3
- package/dist/results/diff-words.d.ts.map +1 -1
- package/dist/results/index.js +1 -1
- package/dist/results/line-prefix-sink.d.ts +50 -0
- package/dist/results/line-prefix-sink.d.ts.map +1 -0
- package/dist/results/merge-result.d.ts +4 -3
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +5 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +4 -3
- package/dist/results/revert-result.d.ts.map +1 -1
- package/dist/{results-B0CWLCAp.js → results-rF81cQse.js} +1425 -202
- package/dist/transport-command.d.ts +10 -0
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/commands/add-command.ts +15 -2
- package/src/commands/add-patch/patch-backend.ts +6 -44
- package/src/commands/archive/remote-archive-command.ts +10 -3
- package/src/commands/branch-command.ts +57 -4
- package/src/commands/cat-file/batch-format.ts +17 -18
- package/src/commands/cat-file/cat-file-command.ts +181 -15
- package/src/commands/check-ignore-command.ts +61 -17
- package/src/commands/checkout-command.ts +149 -21
- package/src/commands/checkout-index-command.ts +2 -1
- package/src/commands/checkout-paths.ts +13 -0
- package/src/commands/cherry-pick-command.ts +9 -0
- package/src/commands/clean-interactive.ts +20 -74
- package/src/commands/clone-command.ts +13 -0
- package/src/commands/column/column-config.ts +63 -0
- package/src/commands/column/column-layout.ts +396 -0
- package/src/commands/column/index.ts +2 -0
- package/src/commands/column-command.ts +171 -0
- package/src/commands/comment-char-config.ts +42 -0
- package/src/commands/commit-command.ts +61 -21
- package/src/commands/config-command.ts +28 -0
- package/src/commands/credential-helper.ts +807 -0
- package/src/commands/default-branch.ts +38 -0
- package/src/commands/diff-color-config.ts +23 -10
- package/src/commands/diff-command.ts +25 -2
- package/src/commands/fast-export/fast-export-command.ts +661 -35
- package/src/commands/fast-export/fast-import-command.ts +694 -94
- package/src/commands/fast-export/fast-stream-support.ts +18 -1
- package/src/commands/fetch-command.ts +103 -14
- package/src/commands/git-hooks.ts +85 -0
- package/src/commands/history-command.ts +952 -20
- package/src/commands/index-host.ts +51 -0
- package/src/commands/index-refresh.ts +121 -0
- package/src/commands/index.ts +9 -0
- package/src/commands/init-command.ts +34 -1
- package/src/commands/legacy-remotes.ts +4 -20
- package/src/commands/local-transport.ts +130 -9
- package/src/commands/log-command.ts +39 -1
- package/src/commands/log-output.ts +31 -4
- package/src/commands/maintenance-schedule-command.ts +418 -0
- package/src/commands/merge-command.ts +10 -0
- package/src/commands/merge-index-command.ts +202 -0
- package/src/commands/merge-one-file.ts +451 -0
- package/src/commands/merge-support.ts +127 -11
- package/src/commands/object-disk-info.ts +169 -0
- package/src/commands/octopus-merge.ts +37 -128
- package/src/commands/promisor-remote.ts +14 -3
- package/src/commands/pull-command.ts +173 -27
- package/src/commands/push-command.ts +50 -5
- package/src/commands/range-diff/range-diff-command.ts +86 -3
- package/src/commands/rebase-command.ts +46 -1
- package/src/commands/ref-filter/for-each-ref-command.ts +4 -3
- package/src/commands/ref-filter/ref-filter.ts +59 -4
- package/src/commands/ref-filter/ref-format.ts +83 -10
- package/src/commands/ref-filter/ref-listing-command.ts +30 -0
- package/src/commands/remote-command.ts +2 -2
- package/src/commands/remote-transport.ts +66 -3
- package/src/commands/repack-command.ts +75 -9
- package/src/commands/repo-command.ts +6 -70
- package/src/commands/reset-command.ts +11 -1
- package/src/commands/restore-command.ts +1 -0
- package/src/commands/rev-list-command.ts +205 -3
- package/src/commands/revert-command.ts +9 -0
- package/src/commands/revision-filenames.ts +32 -4
- package/src/commands/revision-range.ts +2 -2
- package/src/commands/revision-resolver.ts +21 -1
- package/src/commands/serve-repository.ts +34 -8
- package/src/commands/served-lazy-fetch.ts +164 -0
- package/src/commands/signing.ts +18 -10
- package/src/commands/status-color-config.ts +92 -0
- package/src/commands/status-command.ts +50 -2
- package/src/commands/status-format.ts +198 -50
- package/src/commands/tag-command.ts +57 -2
- package/src/commands/tree-restore.ts +17 -0
- package/src/commands/verify-command.ts +84 -12
- package/src/commands/worktree-add-command.ts +2 -0
- package/src/commands/worktree-overwrite-checks.ts +75 -14
- package/src/errors/commit-errors.ts +31 -3
- package/src/errors/git-api-error.ts +7 -0
- package/src/git-command.ts +105 -4
- package/src/git.ts +153 -0
- package/src/remote-config/remote-config-store.ts +16 -0
- package/src/results/cherry-pick-result.ts +4 -3
- package/src/results/diff-output.ts +8 -0
- package/src/results/diff-words.ts +160 -32
- package/src/results/line-prefix-sink.ts +102 -0
- package/src/results/merge-result.ts +4 -3
- package/src/results/rebase-result.ts +5 -0
- package/src/results/revert-result.ts +4 -3
- 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
|
-
/**
|
|
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
|
|
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
|
|
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`
|
|
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
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
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}`);
|