@statewalker/vcs-commands 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/add-command.d.ts +32 -0
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/add-patch.d.ts +7 -0
- package/dist/commands/add-patch/add-patch.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +47 -0
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/apply/apply-command.d.ts +2 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -1
- package/dist/commands/apply/apply-parse.d.ts +7 -0
- package/dist/commands/apply/apply-parse.d.ts.map +1 -1
- package/dist/commands/apply/index.d.ts +1 -1
- package/dist/commands/apply/index.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +303 -8
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/blame-ignore.d.ts +48 -0
- package/dist/commands/blame-ignore.d.ts.map +1 -0
- package/dist/commands/check-mailmap-command.d.ts +49 -0
- package/dist/commands/check-mailmap-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +7 -0
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-paths.d.ts +4 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -1
- package/dist/commands/cherry-command.d.ts +61 -0
- package/dist/commands/cherry-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +23 -1
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +32 -0
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clean-interactive.d.ts +56 -0
- package/dist/commands/clean-interactive.d.ts.map +1 -0
- package/dist/commands/clone-command.d.ts +116 -2
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +50 -2
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/describe-command.d.ts +71 -64
- package/dist/commands/describe-command.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +118 -6
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +60 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fetch-multiple-command.d.ts +193 -0
- package/dist/commands/fetch-multiple-command.d.ts.map +1 -0
- package/dist/commands/format-patch-command.d.ts +28 -2
- package/dist/commands/format-patch-command.d.ts.map +1 -1
- package/dist/commands/git-describe.d.ts +77 -4
- package/dist/commands/git-describe.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +15 -1
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/index.d.ts +12 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +5 -3
- package/dist/commands/init-command.d.ts +89 -0
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/line-log.d.ts +161 -0
- package/dist/commands/line-log.d.ts.map +1 -0
- package/dist/commands/log-command.d.ts +235 -6
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +4 -2
- package/dist/commands/log-graph.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +66 -1
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +24 -1
- package/dist/commands/mailmap.d.ts.map +1 -1
- package/dist/commands/merge-command.d.ts +51 -1
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-drivers.d.ts +2 -0
- package/dist/commands/merge-drivers.d.ts.map +1 -1
- package/dist/commands/merge-strategy-options.d.ts +69 -0
- package/dist/commands/merge-strategy-options.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +10 -0
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/message-cleanup.d.ts +2 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -1
- package/dist/commands/name-rev-command.d.ts +65 -0
- package/dist/commands/name-rev-command.d.ts.map +1 -0
- package/dist/commands/name-rev.d.ts +110 -22
- package/dist/commands/name-rev.d.ts.map +1 -1
- package/dist/commands/octopus-merge.d.ts +26 -1
- package/dist/commands/octopus-merge.d.ts.map +1 -1
- package/dist/commands/ort-merge.d.ts +16 -0
- package/dist/commands/ort-merge.d.ts.map +1 -1
- package/dist/commands/ort-recursive.d.ts.map +1 -1
- package/dist/commands/patch-id.d.ts +58 -0
- package/dist/commands/patch-id.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts +182 -38
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +65 -0
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/range-diff/index.d.ts +4 -0
- package/dist/commands/range-diff/index.d.ts.map +1 -0
- package/dist/commands/range-diff/linear-assignment.d.ts +27 -0
- package/dist/commands/range-diff/linear-assignment.d.ts.map +1 -0
- package/dist/commands/range-diff/range-diff-command.d.ts +121 -0
- package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -0
- package/dist/commands/range-diff/range-diff.d.ts +106 -0
- package/dist/commands/range-diff/range-diff.d.ts.map +1 -0
- package/dist/commands/read-tree-command.d.ts +14 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +21 -2
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/remerge-diff.d.ts +59 -0
- package/dist/commands/remerge-diff.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +41 -0
- package/dist/commands/remote-command.d.ts.map +1 -1
- package/dist/commands/remote-show-command.d.ts +204 -0
- package/dist/commands/remote-show-command.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +19 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +7 -0
- package/dist/commands/restore-command.d.ts.map +1 -1
- package/dist/commands/rev-list-command.d.ts +75 -3
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +22 -1
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +2 -0
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +102 -1
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/sequencer-support.d.ts +10 -1
- package/dist/commands/sequencer-support.d.ts.map +1 -1
- package/dist/commands/shortlog-command.d.ts +109 -0
- package/dist/commands/shortlog-command.d.ts.map +1 -0
- package/dist/commands/shortlog.d.ts +151 -0
- package/dist/commands/shortlog.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +31 -2
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/submodule-commands.d.ts +90 -2
- package/dist/commands/submodule-commands.d.ts.map +1 -1
- package/dist/commands/submodule-fetch.d.ts +149 -0
- package/dist/commands/submodule-fetch.d.ts.map +1 -0
- package/dist/commands/submodule-model.d.ts +8 -0
- package/dist/commands/submodule-model.d.ts.map +1 -1
- package/dist/commands/submodule-unpack.d.ts +120 -0
- package/dist/commands/submodule-unpack.d.ts.map +1 -0
- package/dist/commands/submodule-update-command.d.ts +8 -0
- package/dist/commands/submodule-update-command.d.ts.map +1 -1
- package/dist/commands/subtree-shift.d.ts +27 -0
- package/dist/commands/subtree-shift.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts +3 -0
- package/dist/commands/switch-command.d.ts.map +1 -1
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/worktree-overwrite-checks.d.ts +2 -0
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/{commands-ISM52N0n.js → commands-CNvli5bl.js} +39426 -61169
- package/dist/errors/command-errors.d.ts +25 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +29 -1
- package/dist/fsck-CPeDh9fh.js +5138 -0
- package/dist/git-command.d.ts +31 -1
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +97 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +82 -0
- package/dist/guarded-transport-command.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/remote-transport-CCmBadm-.js +1606 -0
- package/dist/rename/detect-renames.d.ts +20 -0
- package/dist/rename/detect-renames.d.ts.map +1 -1
- package/dist/rename/diffcore-break.d.ts +51 -0
- package/dist/rename/diffcore-break.d.ts.map +1 -0
- package/dist/rename/index.d.ts +1 -0
- package/dist/rename/index.d.ts.map +1 -1
- package/dist/results/blame-format.d.ts +62 -1
- package/dist/results/blame-format.d.ts.map +1 -1
- package/dist/results/clone-result.d.ts +9 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/diff-dirstat.d.ts +36 -0
- package/dist/results/diff-dirstat.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +10 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +18 -0
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/fetch-result.d.ts +12 -1
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +2 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/init-result.d.ts +8 -1
- package/dist/results/init-result.d.ts.map +1 -1
- package/dist/results/line-range-hunks.d.ts +27 -0
- package/dist/results/line-range-hunks.d.ts.map +1 -0
- package/dist/results/merge-result.d.ts +8 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +11 -0
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +5 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/status-result.d.ts +1 -1
- package/dist/results/status-result.d.ts.map +1 -1
- package/dist/results-BDuEgdLU.js +46847 -0
- package/dist/transport-command.d.ts +14 -0
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/commands/add-command.ts +115 -0
- package/src/commands/add-patch/add-patch.ts +8 -0
- package/src/commands/add-patch/patch-backend.ts +20 -2
- package/src/commands/am/am-command.ts +138 -4
- package/src/commands/apply/apply-command.ts +52 -9
- package/src/commands/apply/apply-parse.ts +10 -0
- package/src/commands/apply/index.ts +8 -1
- package/src/commands/blame-command.ts +1450 -51
- package/src/commands/blame-ignore.ts +307 -0
- package/src/commands/check-mailmap-command.ts +129 -0
- package/src/commands/checkout-command.ts +97 -12
- package/src/commands/checkout-paths.ts +28 -0
- package/src/commands/cherry-command.ts +187 -0
- package/src/commands/cherry-pick-command.ts +42 -1
- package/src/commands/clean-command.ts +92 -12
- package/src/commands/clean-interactive.ts +522 -0
- package/src/commands/clone-command.ts +596 -44
- package/src/commands/commit-command.ts +180 -47
- package/src/commands/describe-command.ts +341 -254
- package/src/commands/diff-command.ts +616 -56
- package/src/commands/fetch-command.ts +353 -6
- package/src/commands/fetch-multiple-command.ts +665 -0
- package/src/commands/format-patch-command.ts +189 -77
- package/src/commands/git-describe.ts +456 -217
- package/src/commands/git-hooks.ts +42 -3
- package/src/commands/index.ts +17 -0
- package/src/commands/init-command.ts +603 -49
- package/src/commands/line-log.ts +931 -0
- package/src/commands/log-command.ts +1414 -177
- package/src/commands/log-graph.ts +6 -3
- package/src/commands/log-output.ts +173 -10
- package/src/commands/mailmap.ts +41 -5
- package/src/commands/merge-command.ts +274 -16
- package/src/commands/merge-drivers.ts +3 -0
- package/src/commands/merge-strategy-options.ts +224 -0
- package/src/commands/merge-support.ts +101 -21
- package/src/commands/message-cleanup.ts +1 -1
- package/src/commands/name-rev-command.ts +184 -0
- package/src/commands/name-rev.ts +700 -109
- package/src/commands/octopus-merge.ts +35 -11
- package/src/commands/ort-merge.ts +41 -7
- package/src/commands/ort-recursive.ts +40 -2
- package/src/commands/patch-id.ts +109 -0
- package/src/commands/pull-command.ts +718 -224
- package/src/commands/push-command.ts +353 -3
- package/src/commands/range-diff/index.ts +3 -0
- package/src/commands/range-diff/linear-assignment.ts +203 -0
- package/src/commands/range-diff/range-diff-command.ts +433 -0
- package/src/commands/range-diff/range-diff.ts +617 -0
- package/src/commands/read-tree-command.ts +74 -3
- package/src/commands/rebase-command.ts +141 -65
- package/src/commands/remerge-diff.ts +241 -0
- package/src/commands/remote-command.ts +98 -10
- package/src/commands/remote-show-command.ts +836 -0
- package/src/commands/reset-command.ts +78 -3
- package/src/commands/restore-command.ts +15 -0
- package/src/commands/rev-list-command.ts +187 -11
- package/src/commands/revert-command.ts +41 -1
- package/src/commands/revision-range.ts +3 -1
- package/src/commands/sequencer-pick.ts +323 -29
- package/src/commands/sequencer-support.ts +164 -2
- package/src/commands/shortlog-command.ts +354 -0
- package/src/commands/shortlog.ts +361 -0
- package/src/commands/show-command.ts +2 -1
- package/src/commands/status-command.ts +115 -25
- package/src/commands/status-format.ts +1 -1
- package/src/commands/submodule-commands.ts +321 -3
- package/src/commands/submodule-fetch.ts +789 -0
- package/src/commands/submodule-model.ts +9 -1
- package/src/commands/submodule-unpack.ts +265 -0
- package/src/commands/submodule-update-command.ts +39 -5
- package/src/commands/subtree-shift.ts +215 -0
- package/src/commands/switch-command.ts +9 -0
- package/src/commands/tree-restore.ts +6 -1
- package/src/commands/worktree-overwrite-checks.ts +5 -0
- package/src/errors/command-errors.ts +35 -0
- package/src/git-command.ts +87 -1
- package/src/git.ts +146 -0
- package/src/guarded-transport-command.ts +171 -0
- package/src/index.ts +1 -0
- package/src/rename/detect-renames.ts +42 -8
- package/src/rename/diffcore-break.ts +166 -0
- package/src/rename/index.ts +1 -0
- package/src/results/blame-format.ts +268 -43
- package/src/results/clone-result.ts +6 -0
- package/src/results/diff-dirstat.ts +117 -0
- package/src/results/diff-entry.ts +12 -0
- package/src/results/diff-formatter.ts +1 -0
- package/src/results/diff-output.ts +127 -2
- package/src/results/fetch-result.ts +12 -1
- package/src/results/index.ts +2 -0
- package/src/results/init-result.ts +10 -1
- package/src/results/line-range-hunks.ts +126 -0
- package/src/results/merge-result.ts +9 -0
- package/src/results/pull-result.ts +7 -0
- package/src/results/push-result.ts +5 -0
- package/src/results/status-result.ts +2 -2
- package/src/transport-command.ts +34 -3
- package/dist/fsck-DLRpbwTj.js +0 -13405
- package/dist/results-TB2IJ64h.js +0 -4700
|
@@ -106,6 +106,8 @@ const MERGE_CHARS = ["/", "|", "\\"];
|
|
|
106
106
|
/** git's struct git_graph. */
|
|
107
107
|
export class LogGraph {
|
|
108
108
|
private commit: ObjectId | undefined;
|
|
109
|
+
/** The commit's mark on its line (get_revision_mark: `*`, `<`, `>`, `=`) */
|
|
110
|
+
private commitMark = "*";
|
|
109
111
|
private numParents = 0;
|
|
110
112
|
private width = 0;
|
|
111
113
|
private expansionRow = 0;
|
|
@@ -318,11 +320,12 @@ export class LogGraph {
|
|
|
318
320
|
|
|
319
321
|
/**
|
|
320
322
|
* The next commit: `id`, with the commits shown after it that the walk has already read
|
|
321
|
-
* (git's lookahead of two, for visual roots).
|
|
323
|
+
* (git's lookahead of two, for visual roots), and the mark drawn for it (`*`, or `<`/`>`/`=`).
|
|
322
324
|
*/
|
|
323
|
-
update(id: ObjectId, lookahead: readonly ObjectId[] = []): void {
|
|
325
|
+
update(id: ObjectId, lookahead: readonly ObjectId[] = [], mark = "*"): void {
|
|
324
326
|
this.lookahead = lookahead.slice(0, 2);
|
|
325
327
|
this.commit = id;
|
|
328
|
+
this.commitMark = mark;
|
|
326
329
|
this.numParents = this.interestingParents().length;
|
|
327
330
|
this.prevCommitIndex = this.commitIndex;
|
|
328
331
|
this.updateColumns();
|
|
@@ -475,7 +478,7 @@ export class LogGraph {
|
|
|
475
478
|
LogGraph.add(line, " ".repeat(padding));
|
|
476
479
|
this.width += padding;
|
|
477
480
|
}
|
|
478
|
-
LogGraph.add(line,
|
|
481
|
+
LogGraph.add(line, this.commitMark);
|
|
479
482
|
if (this.needsTruncation(i)) {
|
|
480
483
|
LogGraph.add(line, " ");
|
|
481
484
|
break;
|
|
@@ -55,7 +55,13 @@ import type { SignatureCheck } from "./signature-check.js";
|
|
|
55
55
|
import { appendSignoff, type TrailerConfig } from "./trailers.js";
|
|
56
56
|
|
|
57
57
|
/** How `git log` treats merges in its diffs (`--diff-merges=<mode>`, `-m`, `-c`, `--cc`). */
|
|
58
|
-
export type LogDiffMerges =
|
|
58
|
+
export type LogDiffMerges =
|
|
59
|
+
| "off"
|
|
60
|
+
| "first-parent"
|
|
61
|
+
| "separate"
|
|
62
|
+
| "combined"
|
|
63
|
+
| "dense-combined"
|
|
64
|
+
| "remerge";
|
|
59
65
|
|
|
60
66
|
/** What `git log` prints of each commit (its command-line options). */
|
|
61
67
|
export interface LogOutputOptions {
|
|
@@ -65,6 +71,11 @@ export interface LogOutputOptions {
|
|
|
65
71
|
oneline?: boolean;
|
|
66
72
|
/** `--abbrev-commit` / `--no-abbrev-commit` (default `log.abbrevCommit`, false) */
|
|
67
73
|
abbrevCommit?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* `--parents`: each commit's parents after its id in the header, rewritten past the commits
|
|
76
|
+
* a path-limited walk leaves out (as `%P` and the graph see them)
|
|
77
|
+
*/
|
|
78
|
+
parents?: boolean;
|
|
68
79
|
/**
|
|
69
80
|
* `--abbrev=<n>` (default `core.abbrev`, automatic): at least n digits (4 to 40, as git
|
|
70
81
|
* clamps it), in the commits' ids and in the diffs' `index` lines (combined diffs keep the
|
|
@@ -142,6 +153,12 @@ export interface LogOutputOptions {
|
|
|
142
153
|
cc?: boolean;
|
|
143
154
|
/** `--diff-merges=<mode>` */
|
|
144
155
|
diffMerges?: LogDiffMerges;
|
|
156
|
+
/**
|
|
157
|
+
* `--remerge-diff`: each two-parent merge shown as the diff from merge-ort's automatic
|
|
158
|
+
* result of its parents (conflict markers included, merged in memory) to the merge, with
|
|
159
|
+
* the merge's conflicts as `remerge CONFLICT` headers (implies `-p`)
|
|
160
|
+
*/
|
|
161
|
+
remergeDiff?: boolean;
|
|
145
162
|
/**
|
|
146
163
|
* `--full-diff`: a path-limited log shows the commits' whole diffs (against their parents
|
|
147
164
|
* before `--graph` rewrote them)
|
|
@@ -218,6 +235,12 @@ export interface LogMailOptions {
|
|
|
218
235
|
* commit that cannot be converted is shown as stored, as git shows it when iconv fails.
|
|
219
236
|
*/
|
|
220
237
|
outputEncoding?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Blocks shown after the message as commentary (git before 2.46 writes format-patch's
|
|
240
|
+
* `Interdiff:` and `Range-diff:` there): each after `---` (the first) or an empty line,
|
|
241
|
+
* its title line included
|
|
242
|
+
*/
|
|
243
|
+
commentary?: Uint8Array[];
|
|
221
244
|
}
|
|
222
245
|
|
|
223
246
|
/** A commit the walk shows, with the parents it is shown with (rewritten under `--graph`). */
|
|
@@ -231,6 +254,10 @@ export interface LogOutputEntry {
|
|
|
231
254
|
reflog?: LogReflogEntry;
|
|
232
255
|
/** A boundary commit (`--boundary`), marked `-` */
|
|
233
256
|
boundary?: boolean;
|
|
257
|
+
/** On the left side of a symmetric difference (`<` under `--left-right` and in `%m`) */
|
|
258
|
+
left?: boolean;
|
|
259
|
+
/** `--cherry-mark`: the other side has its change (`=`) */
|
|
260
|
+
patchSame?: boolean;
|
|
234
261
|
/** The name the commit was reached from (`--source`, `%S`) */
|
|
235
262
|
source?: string;
|
|
236
263
|
}
|
|
@@ -312,6 +339,24 @@ export interface LogOutputHost {
|
|
|
312
339
|
* `names` as `--name-only` / `--name-status` list them (undefined for neither), `patch`
|
|
313
340
|
* the combined patch (when asked); `follow` the one path `--follow` limits it to
|
|
314
341
|
*/
|
|
342
|
+
/**
|
|
343
|
+
* `--remerge-diff`'s diff of a two-parent merge: from merge-ort's in-memory re-merge of
|
|
344
|
+
* `parents` to the merge, with the re-merge's `remerge CONFLICT` headers; nothing it
|
|
345
|
+
* stores reaches the repository
|
|
346
|
+
*/
|
|
347
|
+
remergeDiff?(
|
|
348
|
+
entry: LogOutputEntry,
|
|
349
|
+
parents: [ObjectId, ObjectId],
|
|
350
|
+
formats: DiffOutputFormat[],
|
|
351
|
+
options: {
|
|
352
|
+
statWidth?: number;
|
|
353
|
+
follow?: string;
|
|
354
|
+
fullDiff?: boolean;
|
|
355
|
+
abbrev?: number;
|
|
356
|
+
/** The commits the log has processed before this one (git 2.43 freed their parents) */
|
|
357
|
+
processed?: ReadonlySet<ObjectId>;
|
|
358
|
+
},
|
|
359
|
+
): Promise<{ bytes?: Uint8Array; followPath?: string }>;
|
|
315
360
|
combinedDiff(
|
|
316
361
|
entry: LogOutputEntry,
|
|
317
362
|
options: {
|
|
@@ -325,6 +370,20 @@ export interface LogOutputHost {
|
|
|
325
370
|
parentStatus?: (string | undefined)[];
|
|
326
371
|
},
|
|
327
372
|
): Promise<{ paths: number; names: Uint8Array; patch: Uint8Array }>;
|
|
373
|
+
/**
|
|
374
|
+
* `git log -L` (2.5x): the commit's pairs that touched the line ranges, through the diff
|
|
375
|
+
* pipeline with each patch cut to the ranges (line_log_queue_pairs, log_tree_diff_flush)
|
|
376
|
+
*/
|
|
377
|
+
lineLogDiff?(
|
|
378
|
+
entry: LogOutputEntry,
|
|
379
|
+
formats: DiffOutputFormat[],
|
|
380
|
+
options: { abbrev?: number },
|
|
381
|
+
): Promise<{ bytes?: Uint8Array }>;
|
|
382
|
+
/**
|
|
383
|
+
* `git log -L` (2.43): line-log's own diff of the commit (dump_diff_hacky), each line after
|
|
384
|
+
* `prefix`
|
|
385
|
+
*/
|
|
386
|
+
lineLogHacky?(entry: LogOutputEntry, prefix: string, colors?: DiffColors): Promise<Uint8Array>;
|
|
328
387
|
}
|
|
329
388
|
|
|
330
389
|
type Fmt = "raw" | "medium" | "short" | "email" | "mboxrd" | "fuller" | "full" | "oneline" | "user";
|
|
@@ -823,8 +882,14 @@ export class LogPrinter {
|
|
|
823
882
|
interesting: (id: ObjectId) => boolean;
|
|
824
883
|
firstParentOnly: boolean;
|
|
825
884
|
paths: string[];
|
|
885
|
+
/** `--left-right`: commits marked `<` or `>` */
|
|
886
|
+
leftRight?: boolean;
|
|
887
|
+
/** `--cherry-mark`: commits marked `=` or `+` */
|
|
888
|
+
cherryMark?: boolean;
|
|
826
889
|
/** The colors (`--color`, `color.ui`...), undefined for none */
|
|
827
890
|
colors?: { diff: DiffColors; decorations: DecorationPalette; graph: readonly string[] };
|
|
891
|
+
/** `-L`: the line-log of that git version prints each commit's diff */
|
|
892
|
+
lineLog?: "2.43" | "2.56";
|
|
828
893
|
},
|
|
829
894
|
) {
|
|
830
895
|
const prettyGiven = options.pretty !== undefined || !!options.oneline;
|
|
@@ -881,8 +946,15 @@ export class LogPrinter {
|
|
|
881
946
|
this.fullHistory =
|
|
882
947
|
diffMerges === "separate" ||
|
|
883
948
|
diffMerges === "first-parent" ||
|
|
884
|
-
|
|
885
|
-
|
|
949
|
+
diffMerges === "remerge" ||
|
|
950
|
+
!!options.remergeDiff ||
|
|
951
|
+
(!!options.m &&
|
|
952
|
+
(mDefault === "separate" || mDefault === "first-parent" || mDefault === "remerge"));
|
|
953
|
+
if (options.remergeDiff) {
|
|
954
|
+
diffMerges = "remerge";
|
|
955
|
+
mergesNeedDiff = true;
|
|
956
|
+
implyPatch = true;
|
|
957
|
+
} else if (options.cc) {
|
|
886
958
|
diffMerges = "dense-combined";
|
|
887
959
|
mergesNeedDiff = true;
|
|
888
960
|
implyPatch = true;
|
|
@@ -901,6 +973,8 @@ export class LogPrinter {
|
|
|
901
973
|
diffMerges = "first-parent";
|
|
902
974
|
}
|
|
903
975
|
if ((implyPatch || mergesNeedDiff) && formats.length === 0) formats.push("patch");
|
|
976
|
+
// revision.c: -L shows patches unless a format (or -s) is given
|
|
977
|
+
if (walk.lineLog && formats.length === 0 && !options.noPatch) formats.push("patch");
|
|
904
978
|
// --name-only, --name-status and --check turn the other formats off (diff_setup_done)
|
|
905
979
|
const names = formats.find((f) => f === "name-only" || f === "name-status" || f === "check");
|
|
906
980
|
this.formats = options.noPatch ? [] : names ? [names] : formats;
|
|
@@ -925,7 +999,12 @@ export class LogPrinter {
|
|
|
925
999
|
this.diffFiltered =
|
|
926
1000
|
options.diff?.diffFilter !== undefined || (!!options.diff && hasPickaxe(options.diff));
|
|
927
1001
|
this.allNeedDiff =
|
|
928
|
-
userDiff ||
|
|
1002
|
+
userDiff ||
|
|
1003
|
+
implyPatch ||
|
|
1004
|
+
this.follow ||
|
|
1005
|
+
!!options.fullDiff ||
|
|
1006
|
+
this.diffFiltered ||
|
|
1007
|
+
(!!walk.lineLog && this.formats.length > 0);
|
|
929
1008
|
}
|
|
930
1009
|
|
|
931
1010
|
/** `--diff-filter` or a pickaxe (`-S`, `-G`, `--find-object`) given */
|
|
@@ -986,6 +1065,19 @@ export class LogPrinter {
|
|
|
986
1065
|
});
|
|
987
1066
|
}
|
|
988
1067
|
|
|
1068
|
+
/**
|
|
1069
|
+
* revision.c's get_revision_mark: `-` boundary, `=` patch-same, `<`/`>` by side (always
|
|
1070
|
+
* without the walk's options, `%m`'s), else `*` in a graph, `+` under `--cherry-mark`, none.
|
|
1071
|
+
*/
|
|
1072
|
+
private revisionMark(entry: LogOutputEntry, withOptions: boolean): string {
|
|
1073
|
+
if (entry.boundary) return "-";
|
|
1074
|
+
if (entry.patchSame) return "=";
|
|
1075
|
+
if (!withOptions || this.walk.leftRight) return entry.left ? "<" : ">";
|
|
1076
|
+
if (this.graph) return "*";
|
|
1077
|
+
if (this.walk.cherryMark) return "+";
|
|
1078
|
+
return "";
|
|
1079
|
+
}
|
|
1080
|
+
|
|
989
1081
|
private padding(): string {
|
|
990
1082
|
return this.graph ? this.graph.showPadding() : "";
|
|
991
1083
|
}
|
|
@@ -1032,7 +1124,18 @@ export class LogPrinter {
|
|
|
1032
1124
|
* not shown (`--follow` and nothing of the path changed).
|
|
1033
1125
|
*/
|
|
1034
1126
|
async showCommit(entry: LogOutputEntry, lookahead: ObjectId[]): Promise<boolean> {
|
|
1035
|
-
|
|
1127
|
+
try {
|
|
1128
|
+
return await this.showCommitOnce(entry, lookahead);
|
|
1129
|
+
} finally {
|
|
1130
|
+
this.processed.add(entry.id);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** The commits {@link showCommit} was given so far (cmd_log_walk's loop) */
|
|
1135
|
+
private readonly processed = new Set<ObjectId>();
|
|
1136
|
+
|
|
1137
|
+
private async showCommitOnce(entry: LogOutputEntry, lookahead: ObjectId[]): Promise<boolean> {
|
|
1138
|
+
this.graph?.update(entry.id, lookahead, this.revisionMark(entry, true));
|
|
1036
1139
|
if (this.follow) {
|
|
1037
1140
|
const stored = this.followPaths.get(entry.id);
|
|
1038
1141
|
if (stored !== undefined) this.followPath = stored;
|
|
@@ -1064,8 +1167,21 @@ export class LogPrinter {
|
|
|
1064
1167
|
entry: LogOutputEntry,
|
|
1065
1168
|
log: { pending: boolean; parent: ObjectId | undefined },
|
|
1066
1169
|
): Promise<boolean> {
|
|
1170
|
+
if (this.walk.lineLog === "2.43") {
|
|
1171
|
+
// line_log_print: the log, then line-log's own diff unless -s
|
|
1172
|
+
await this.showLog(entry, log);
|
|
1173
|
+
if (!this.options.noPatch && this.host.lineLogHacky) {
|
|
1174
|
+
this.out.bytes(await this.host.lineLogHacky(entry, this.padding(), this.walk.colors?.diff));
|
|
1175
|
+
}
|
|
1176
|
+
return true;
|
|
1177
|
+
}
|
|
1067
1178
|
const allNeedDiff = this.allNeedDiff;
|
|
1068
1179
|
if (!allNeedDiff && !this.mergesNeedDiff) return false;
|
|
1180
|
+
if (this.walk.lineLog) {
|
|
1181
|
+
// log_tree_diff: line_log_queue_pairs, then log_tree_diff_flush
|
|
1182
|
+
await this.diffFlush(entry, undefined, log, undefined, true);
|
|
1183
|
+
return !log.pending;
|
|
1184
|
+
}
|
|
1069
1185
|
const parents = this.diffParents(entry);
|
|
1070
1186
|
const isMerge = parents.length > 1;
|
|
1071
1187
|
if (!isMerge && !allNeedDiff) return false;
|
|
@@ -1074,6 +1190,18 @@ export class LogPrinter {
|
|
|
1074
1190
|
return !log.pending;
|
|
1075
1191
|
}
|
|
1076
1192
|
const firstParentMerges = this.diffMerges === "first-parent";
|
|
1193
|
+
if (isMerge && this.diffMerges === "remerge") {
|
|
1194
|
+
if (parents.length > 2) {
|
|
1195
|
+
await this.showLog(entry, log);
|
|
1196
|
+
this.out.text("diff: warning: Skipping remerge-diff for octopus merges.\n");
|
|
1197
|
+
return true;
|
|
1198
|
+
}
|
|
1199
|
+
await this.diffFlush(entry, parents[0], log, [
|
|
1200
|
+
parents[0] as ObjectId,
|
|
1201
|
+
parents[1] as ObjectId,
|
|
1202
|
+
]);
|
|
1203
|
+
return !log.pending;
|
|
1204
|
+
}
|
|
1077
1205
|
if (isMerge) {
|
|
1078
1206
|
if (this.diffMerges === "combined" || this.diffMerges === "dense-combined") {
|
|
1079
1207
|
await this.combined(entry, log, this.diffMerges === "dense-combined");
|
|
@@ -1115,15 +1243,31 @@ export class LogPrinter {
|
|
|
1115
1243
|
entry: LogOutputEntry,
|
|
1116
1244
|
parent: ObjectId | undefined,
|
|
1117
1245
|
log: { pending: boolean; parent: ObjectId | undefined },
|
|
1246
|
+
/** do_remerge_diff: the diff from these parents' re-merge instead of from `parent` */
|
|
1247
|
+
remerge?: [ObjectId, ObjectId],
|
|
1248
|
+
/** `-L`: the commit's pairs cut to the line ranges (line_log_queue_pairs) */
|
|
1249
|
+
lineLog = false,
|
|
1118
1250
|
): Promise<void> {
|
|
1119
1251
|
this.shownDashes = false;
|
|
1120
1252
|
const width = this.graph ? this.graph.getWidth() : 0;
|
|
1121
|
-
const
|
|
1253
|
+
const diffOptions = {
|
|
1122
1254
|
...(width ? { statWidth: 80 - width } : {}),
|
|
1123
1255
|
...(this.follow && this.followPath !== undefined ? { follow: this.followPath } : {}),
|
|
1124
1256
|
...(this.options.fullDiff ? { fullDiff: true } : {}),
|
|
1125
1257
|
...this.diffAbbrev(),
|
|
1126
|
-
}
|
|
1258
|
+
};
|
|
1259
|
+
if (remerge && !this.host.remergeDiff) {
|
|
1260
|
+
throw new Error("--remerge-diff: the log's host cannot re-merge");
|
|
1261
|
+
}
|
|
1262
|
+
const result: { bytes?: Uint8Array; followPath?: string } =
|
|
1263
|
+
lineLog && this.host.lineLogDiff
|
|
1264
|
+
? await this.host.lineLogDiff(entry, this.formats, this.diffAbbrev())
|
|
1265
|
+
: remerge && this.host.remergeDiff
|
|
1266
|
+
? await this.host.remergeDiff(entry, remerge, this.formats, {
|
|
1267
|
+
...diffOptions,
|
|
1268
|
+
processed: this.processed,
|
|
1269
|
+
})
|
|
1270
|
+
: await this.host.diff(entry, parent, this.formats, diffOptions);
|
|
1127
1271
|
if (this.follow && result.followPath !== undefined) this.followPath = result.followPath;
|
|
1128
1272
|
if (!result.bytes) return;
|
|
1129
1273
|
if (log.pending) {
|
|
@@ -1246,8 +1390,16 @@ export class LogPrinter {
|
|
|
1246
1390
|
this.out.text(colors?.diff.commit ?? "");
|
|
1247
1391
|
if (fmt !== "oneline") this.out.text("commit ");
|
|
1248
1392
|
// put_revision_mark
|
|
1249
|
-
if (!this.graph
|
|
1393
|
+
if (!this.graph) {
|
|
1394
|
+
const mark = this.revisionMark(entry, true);
|
|
1395
|
+
if (mark) this.out.text(`${mark} `);
|
|
1396
|
+
}
|
|
1250
1397
|
this.out.text(await this.abbrevId(entry.id, this.abbrevCommit));
|
|
1398
|
+
// show_parents
|
|
1399
|
+
if (this.options.parents) {
|
|
1400
|
+
for (const p of entry.parents)
|
|
1401
|
+
this.out.text(` ${await this.abbrevId(p, this.abbrevCommit)}`);
|
|
1402
|
+
}
|
|
1251
1403
|
if (log.parent)
|
|
1252
1404
|
this.out.text(` (from ${await this.abbrevId(log.parent, this.abbrevCommit)})`);
|
|
1253
1405
|
this.out.text(colors?.diff.reset ?? "");
|
|
@@ -1306,6 +1458,14 @@ export class LogPrinter {
|
|
|
1306
1458
|
if (!this.missingNewline) this.out.text(this.padding());
|
|
1307
1459
|
this.out.text("\n");
|
|
1308
1460
|
}
|
|
1461
|
+
// git before 2.46: format-patch's interdiff and range-diff as commentary blocks
|
|
1462
|
+
if (isMail) {
|
|
1463
|
+
for (const block of this.options.mail?.commentary ?? []) {
|
|
1464
|
+
this.out.text(this.shownDashes ? "\n" : "---\n");
|
|
1465
|
+
this.shownDashes = true;
|
|
1466
|
+
this.out.bytes(block);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1309
1469
|
}
|
|
1310
1470
|
|
|
1311
1471
|
/** notes.c's format_display_notes */
|
|
@@ -1358,8 +1518,8 @@ export class LogPrinter {
|
|
|
1358
1518
|
...(this.walk.colors
|
|
1359
1519
|
? { color: true, decorationColors: this.walk.colors.decorations }
|
|
1360
1520
|
: {}),
|
|
1361
|
-
// get_revision_mark(NULL, commit)
|
|
1362
|
-
mark: entry
|
|
1521
|
+
// get_revision_mark(NULL, commit)
|
|
1522
|
+
mark: this.revisionMark(entry, false),
|
|
1363
1523
|
...(entry.source !== undefined ? { source: entry.source } : {}),
|
|
1364
1524
|
// %N stays as written unless notes are shown
|
|
1365
1525
|
...(this.showNotes ? { notes } : {}),
|
|
@@ -1612,6 +1772,9 @@ export function mergesMode(value: string): LogDiffMerges | undefined {
|
|
|
1612
1772
|
case "cc":
|
|
1613
1773
|
case "dense-combined":
|
|
1614
1774
|
return "dense-combined";
|
|
1775
|
+
case "r":
|
|
1776
|
+
case "remerge":
|
|
1777
|
+
return "remerge";
|
|
1615
1778
|
default:
|
|
1616
1779
|
return undefined;
|
|
1617
1780
|
}
|
package/src/commands/mailmap.ts
CHANGED
|
@@ -161,7 +161,16 @@ export interface MailmapSources {
|
|
|
161
161
|
/** The host `mailmap.file` is read through (a relative path from its current directory) */
|
|
162
162
|
environment?: GitHostEnvironment;
|
|
163
163
|
/** The blob a revision names (`mailmap.blob`), undefined when it names none */
|
|
164
|
-
readBlobNamed(name: string): Promise<Uint8Array | undefined>;
|
|
164
|
+
readBlobNamed?(name: string): Promise<Uint8Array | undefined>;
|
|
165
|
+
/**
|
|
166
|
+
* The object a revision names (`mailmap.blob`) with its type, undefined when it names
|
|
167
|
+
* none; `bytes` undefined when it cannot be read. Preferred over {@link readBlobNamed}:
|
|
168
|
+
* with it, git's `mailmap is not a blob` and `unable to read mailmap object` errors are
|
|
169
|
+
* reported.
|
|
170
|
+
*/
|
|
171
|
+
readObjectNamed?(name: string): Promise<{ type: string; bytes?: Uint8Array } | undefined>;
|
|
172
|
+
/** git's `error:` lines while reading (read_mailmap_blob's), each with its prefix */
|
|
173
|
+
onError?(line: string): void;
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
function joinChunks(chunks: Uint8Array[]): Uint8Array {
|
|
@@ -203,7 +212,7 @@ export async function readRepositoryMailmap(sources: MailmapSources): Promise<Ma
|
|
|
203
212
|
}
|
|
204
213
|
const blobName = sources.config("mailmap.blob") ?? (bare ? "HEAD:.mailmap" : undefined);
|
|
205
214
|
if (blobName) {
|
|
206
|
-
const bytes = await sources
|
|
215
|
+
const bytes = await readMailmapBlob(sources, blobName);
|
|
207
216
|
if (bytes) map.read(decodeGitPath(bytes));
|
|
208
217
|
}
|
|
209
218
|
const file = sources.config("mailmap.file");
|
|
@@ -217,21 +226,48 @@ export async function readRepositoryMailmap(sources: MailmapSources): Promise<Ma
|
|
|
217
226
|
return map;
|
|
218
227
|
}
|
|
219
228
|
|
|
229
|
+
/**
|
|
230
|
+
* mailmap.c's read_mailmap_blob: the blob `name` names (nothing when it names none), git's
|
|
231
|
+
* errors reported for an object that cannot be read or is no blob.
|
|
232
|
+
*/
|
|
233
|
+
export async function readMailmapBlob(
|
|
234
|
+
sources: Pick<MailmapSources, "readBlobNamed" | "readObjectNamed" | "onError">,
|
|
235
|
+
name: string,
|
|
236
|
+
): Promise<Uint8Array | undefined> {
|
|
237
|
+
if (!sources.readObjectNamed) return sources.readBlobNamed?.(name);
|
|
238
|
+
const object = await sources.readObjectNamed(name);
|
|
239
|
+
if (!object) return undefined;
|
|
240
|
+
if (!object.bytes) {
|
|
241
|
+
sources.onError?.(`error: unable to read mailmap object at ${name}`);
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
if (object.type !== "blob") {
|
|
245
|
+
sources.onError?.(`error: mailmap is not a blob: ${name}`);
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
return object.bytes;
|
|
249
|
+
}
|
|
250
|
+
|
|
220
251
|
/**
|
|
221
252
|
* `mailmap.file`, read as git reads it: through the host (a relative path from its current
|
|
222
253
|
* directory). Without a host environment, a relative path is read from the worktree's top
|
|
223
254
|
* (where git usually runs), and an absolute one inside the worktree through it as well.
|
|
224
255
|
*/
|
|
225
|
-
async function readMailmapFile(
|
|
256
|
+
export async function readMailmapFile(
|
|
226
257
|
path: string,
|
|
227
258
|
environment: GitHostEnvironment | undefined,
|
|
228
259
|
worktree: Worktree | undefined,
|
|
229
260
|
): Promise<Uint8Array | undefined> {
|
|
230
|
-
if (environment)
|
|
261
|
+
if (environment) {
|
|
262
|
+
// git reads a relative path from its working directory, the worktree's top
|
|
263
|
+
const top = worktree?.hostPath?.replace(/\/+$/, "");
|
|
264
|
+
const full = !path.startsWith("/") && top ? `${top}/${path}` : path;
|
|
265
|
+
return environment.readFile(full).catch(() => undefined);
|
|
266
|
+
}
|
|
231
267
|
if (!worktree) return undefined;
|
|
232
268
|
let relative = path;
|
|
233
269
|
if (path.startsWith("/")) {
|
|
234
|
-
const top =
|
|
270
|
+
const top = worktree.hostPath?.replace(/\/+$/, "");
|
|
235
271
|
if (!top || !path.startsWith(`${top}/`)) return undefined;
|
|
236
272
|
relative = path.slice(top.length + 1);
|
|
237
273
|
}
|