@statewalker/vcs-commands 0.3.2 → 0.4.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/README.md +19 -0
- package/dist/commands/add-command.d.ts +0 -6
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +14 -0
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +0 -15
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +16 -31
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/index.js +2 -2
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/merge-command.d.ts +15 -2
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +58 -25
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/stash-create-command.d.ts +1 -1
- package/dist/commands/stash-drop-command.d.ts +1 -1
- package/dist/commands/stash-list-command.d.ts +1 -1
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/{commands-COO4tJhv.js → commands-BpeXZTC3.js} +473 -469
- package/dist/core-commands/add.command.impl.d.ts +0 -4
- package/dist/core-commands/add.command.impl.d.ts.map +1 -1
- package/dist/core-commands/checkout.command.impl.d.ts +2 -6
- package/dist/core-commands/checkout.command.impl.d.ts.map +1 -1
- package/dist/core-commands/index.d.ts +1 -0
- package/dist/core-commands/index.d.ts.map +1 -1
- package/dist/core-commands/store-worktree-file.d.ts +6 -0
- package/dist/core-commands/store-worktree-file.d.ts.map +1 -0
- package/dist/index.js +3 -3
- package/dist/remote-config/remote-config-store.d.ts +4 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts +14 -7
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/fetch-result.d.ts +7 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.js +27 -22
- package/dist/results/push-result.d.ts +9 -2
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/{status-result-BwAyxq6R.js → status-result-BapZoQaR.js} +2 -0
- package/package.json +13 -12
- package/src/commands/add-command.ts +16 -25
- package/src/commands/blame-command.ts +41 -0
- package/src/commands/branch-command.ts +2 -53
- package/src/commands/checkout-command.ts +7 -11
- package/src/commands/clean-command.ts +7 -0
- package/src/commands/clone-command.ts +102 -109
- package/src/commands/fetch-command.ts +103 -197
- package/src/commands/gc-command.ts +1 -1
- package/src/commands/init-command.ts +83 -11
- package/src/commands/merge-command.ts +60 -27
- package/src/commands/pack-refs-command.ts +2 -2
- package/src/commands/push-command.ts +242 -308
- package/src/commands/reflog-command.ts +2 -2
- package/src/commands/stash-apply-command.ts +1 -1
- package/src/commands/stash-create-command.ts +1 -1
- package/src/commands/stash-drop-command.ts +1 -1
- package/src/commands/stash-list-command.ts +1 -1
- package/src/commands/tag-command.ts +2 -53
- package/src/commands/tree-restore.ts +2 -6
- package/src/core-commands/add.command.impl.ts +16 -19
- package/src/core-commands/checkout.command.impl.ts +18 -40
- package/src/core-commands/index.ts +1 -0
- package/src/core-commands/store-worktree-file.ts +5 -0
- package/src/remote-config/remote-config-store.ts +11 -0
- package/src/results/diff-formatter.ts +31 -38
- package/src/results/fetch-result.ts +7 -0
- package/src/results/push-result.ts +9 -2
- package/dist/pack-import/index.d.ts +0 -8
- package/dist/pack-import/index.d.ts.map +0 -1
- package/dist/pack-import/pack-import.d.ts +0 -11
- package/dist/pack-import/pack-import.d.ts.map +0 -1
- package/src/pack-import/index.ts +0 -8
- package/src/pack-import/pack-import.ts +0 -24
|
@@ -38,10 +38,6 @@ export declare class AddCommand implements Add {
|
|
|
38
38
|
* Add all files in working tree to staging area.
|
|
39
39
|
*/
|
|
40
40
|
addAll(options?: AddOptions): Promise<AddResult>;
|
|
41
|
-
/**
|
|
42
|
-
* Store file content as blob and return object ID.
|
|
43
|
-
*/
|
|
44
|
-
private storeFileContent;
|
|
45
41
|
}
|
|
46
42
|
/**
|
|
47
43
|
* Create an AddCommand.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.command.impl.d.ts","sourceRoot":"","sources":["../../src/core-commands/add.command.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"add.command.impl.d.ts","sourceRoot":"","sources":["../../src/core-commands/add.command.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,KAAK,EAA2B,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGnE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IAEnB,oCAAoC;IACpC,KAAK,EAAE,KAAK,CAAC;IAEb,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB;AAgED;;GAEG;AACH,qBAAa,UAAW,YAAW,GAAG;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,YAAY,OAAO,EAAE,iBAAiB,EAIrC;IAED;;OAEG;IACG,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CA0I9E;IAED;;OAEG;IACG,MAAM,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAEzD;CACF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,GAAG,CAEhE"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Reference: jgit/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
|
|
11
11
|
*/
|
|
12
|
-
import { type Blobs, type Commits, type FilesApi, type
|
|
12
|
+
import { type Blobs, type Commits, type FilesApi, type Refs, type Trees } from "@statewalker/vcs-core";
|
|
13
13
|
import type { Staging } from "@statewalker/vcs-working-tree";
|
|
14
14
|
import type { Checkout, CheckoutOptions, CheckoutResult } from "./checkout.command.js";
|
|
15
15
|
/**
|
|
@@ -27,7 +27,7 @@ export interface CheckoutCommandOptions {
|
|
|
27
27
|
/** Commit storage for resolving commits */
|
|
28
28
|
commits: Commits;
|
|
29
29
|
/** Reference storage for resolving refs and updating HEAD */
|
|
30
|
-
refs:
|
|
30
|
+
refs: Refs;
|
|
31
31
|
/** Staging area (index) for updating after checkout */
|
|
32
32
|
staging: Staging;
|
|
33
33
|
}
|
|
@@ -67,10 +67,6 @@ export declare class CheckoutCommand implements Checkout {
|
|
|
67
67
|
* Write file content to working tree.
|
|
68
68
|
*/
|
|
69
69
|
private writeFileContent;
|
|
70
|
-
/**
|
|
71
|
-
* Load blob content as Uint8Array.
|
|
72
|
-
*/
|
|
73
|
-
private loadBlobContent;
|
|
74
70
|
/**
|
|
75
71
|
* Remove file from working tree.
|
|
76
72
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.command.impl.d.ts","sourceRoot":"","sources":["../../src/core-commands/checkout.command.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"checkout.command.impl.d.ts","sourceRoot":"","sources":["../../src/core-commands/checkout.command.impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAU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AO,CAAC,cAAc,CAAC,CA4B3F;IAED;;OAEG;YACW,iBAAiB;IAS/B;;OAEG;YACW,gBAAgB;IA8B9B;;OAEG;YACW,YAAY;IA4E1B;;OAEG;YACW,gBAAgB;IAuB9B;;OAEG;YACW,UAAU;IASxB;;OAEG;YACW,iBAAiB;IA0B/B;;OAEG;YACW,WAAW;IAwBzB;;OAEG;YACW,aAAa;IA2B3B;;OAEG;YACW,aAAa;IAI3B;;OAEG;YACW,aAAa;IAQ3B;;OAEG;YACW,eAAe;IA6E7B;;OAEG;YACW,YAAY;CAgC3B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,QAAQ,CAE/E"}
|
|
@@ -3,4 +3,5 @@ export type { Add, AddOptions } from "./add.command.js";
|
|
|
3
3
|
export * from "./checkout.command.impl.js";
|
|
4
4
|
export type { Checkout, CheckoutConflict, CheckoutConflictReason, CheckoutOptions, } from "./checkout.command.js";
|
|
5
5
|
export { CheckoutConflictReason as CheckoutConflictReasonValues } from "./checkout.command.js";
|
|
6
|
+
export * from "./store-worktree-file.js";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core-commands/index.ts"],"names":[],"mappings":"AAGA,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,IAAI,4BAA4B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core-commands/index.ts"],"names":[],"mappings":"AAGA,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,IAAI,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC/F,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `storeWorktreeFile` lives in `@statewalker/vcs-working-tree`, so the stash and
|
|
3
|
+
* the add commands share it; re-exported here for existing imports.
|
|
4
|
+
*/
|
|
5
|
+
export { storeWorktreeFile } from "@statewalker/vcs-working-tree";
|
|
6
|
+
//# sourceMappingURL=store-worktree-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-worktree-file.d.ts","sourceRoot":"","sources":["../../src/core-commands/store-worktree-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { $ as GitCommand, A as DiffCommand, B as CleanCommand, C as MergeCommand, D as InitCommand, E as RevFilter, F as FetchCommand, G as CreateBranchCommand, H as CheckoutCommand, I as TagOption, J as RenameBranchCommand, K as DeleteBranchCommand, L as toTagMode, M as DescribeCommand, N as CommitCommand, O as Git, P as CloneCommand, Q as AddCommand, R as toTrackingRefUpdate, S as PackRefsCommand, T as LogCommand, U as CheckoutStage, V as CherryPickCommand, W as CheckoutStatus, X as ResetMode, Y as ListBranchMode, Z as BlameCommand, _ as ReflogCommand, a as StashDropCommand, b as PushCommand, c as STASH_REF, d as RevertCommand, f as ResetCommand, g as RemoteSetUrlCommand, h as RemoteRemoveCommand, i as StatusCommand, j as formatDiffEntry, k as GarbageCollectCommand, l as StashListCommand, m as RemoteListCommand, n as ListTagCommand, o as StashCreateCommand, p as RemoteAddCommand, q as ListBranchCommand, r as TagCommand, s as StashApplyCommand, t as DeleteTagCommand, u as RmCommand, v as RebaseCommand, w as LsRemoteCommand, x as PullCommand, y as RebaseOperation, z as TransportCommand } from "./commands-BpeXZTC3.js";
|
|
1
2
|
import { AuthenticationError, CannotDeleteCurrentBranchError, CommitNotFoundError, DetachedHeadError, EmptyCommitError, GitApiError, IncompatibleOptionsError, InvalidArgumentError, InvalidMainlineParentError, InvalidMergeHeadsError, InvalidRefNameError, InvalidRemoteError, InvalidStashIndexError, InvalidTagNameError, MergeConflictError, MergeFailureReason, MissingArgumentError, MultipleParentsNotAllowedError, NoFilepatternError, NoHeadError, NoMergeBaseError, NoMessageError, NoRebaseInProgressError, NonFastForwardError, NotADirectoryError, NotFastForwardError, NotImplementedError, NotMergedError, PathNotFoundInTreeError, PathNotInIndexError, PushRejectedException, RefAlreadyExistsError, RefNotFoundError, RemoteAlreadyExistsError, RemoteNotFoundError, StashApplyFailedError, StashNotFoundError, StoreNotAvailableError, TransportError, UnmergedPathsError, UpstreamRequiredError } from "./errors/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import { C as isMergeSuccessful, S as MergeStrategy, _ as getSuccessfulUpdates, a as RebaseStatus, b as FastForwardMode, c as getFailedUpdates, d as createAddEntry, f as createCopyEntry, g as RefUpdateStatus, h as createRenameEntry, i as RebaseAction, l as isPushSuccessful, m as createModifyEntry, n as StashApplyStatus, o as isRebaseSuccessful, p as createDeleteEntry, r as RevertStatus, s as PushStatus, t as StatusImpl, u as ChangeType, v as hasUpdates, w as CherryPickStatus, x as MergeStatus, y as ContentMergeStrategy } from "./status-result-BwAyxq6R.js";
|
|
3
|
+
import { C as isMergeSuccessful, S as MergeStrategy, _ as getSuccessfulUpdates, a as RebaseStatus, b as FastForwardMode, c as getFailedUpdates, d as createAddEntry, f as createCopyEntry, g as RefUpdateStatus, h as createRenameEntry, i as RebaseAction, l as isPushSuccessful, m as createModifyEntry, n as StashApplyStatus, o as isRebaseSuccessful, p as createDeleteEntry, r as RevertStatus, s as PushStatus, t as StatusImpl, u as ChangeType, v as hasUpdates, w as CherryPickStatus, x as MergeStatus, y as ContentMergeStrategy } from "./status-result-BapZoQaR.js";
|
|
4
4
|
import { DiffFormatter, isPullSuccessful } from "./results/index.js";
|
|
5
|
-
export { AddCommand, AuthenticationError, BlameCommand, CannotDeleteCurrentBranchError, ChangeType, CheckoutCommand, CheckoutStage, CheckoutStatus, CherryPickCommand, CherryPickStatus, CleanCommand, CloneCommand, CommitCommand, CommitNotFoundError, ContentMergeStrategy, CreateBranchCommand, DeleteBranchCommand, DeleteTagCommand, DescribeCommand, DetachedHeadError, DiffCommand, DiffFormatter, EmptyCommitError, FastForwardMode, FetchCommand, GarbageCollectCommand, Git, GitApiError, GitCommand, IncompatibleOptionsError, InitCommand, InvalidArgumentError, InvalidMainlineParentError, InvalidMergeHeadsError, InvalidRefNameError, InvalidRemoteError, InvalidStashIndexError, InvalidTagNameError, ListBranchCommand, ListBranchMode, ListTagCommand, LogCommand, LsRemoteCommand, MergeCommand, MergeConflictError, MergeFailureReason, MergeStatus, MergeStrategy, MissingArgumentError, MultipleParentsNotAllowedError, NoFilepatternError, NoHeadError, NoMergeBaseError, NoMessageError, NoRebaseInProgressError, NonFastForwardError, NotADirectoryError, NotFastForwardError, NotImplementedError, NotMergedError, PackRefsCommand, PathNotFoundInTreeError, PathNotInIndexError, PullCommand, PushCommand, PushRejectedException, PushStatus, RebaseAction, RebaseCommand, RebaseOperation, RebaseStatus, RefAlreadyExistsError, RefNotFoundError, RefUpdateStatus, ReflogCommand, RemoteAddCommand, RemoteAlreadyExistsError, RemoteListCommand, RemoteNotFoundError, RemoteRemoveCommand, RemoteSetUrlCommand, RenameBranchCommand, ResetCommand, ResetMode, RevFilter, RevertCommand, RevertStatus, RmCommand, STASH_REF, StashApplyCommand, StashApplyFailedError, StashApplyStatus, StashCreateCommand, StashDropCommand, StashListCommand, StashNotFoundError, StatusCommand, StatusImpl, StoreNotAvailableError, TagCommand, TagOption, TransportCommand, TransportError, UnmergedPathsError, UpstreamRequiredError, createAddEntry, createCopyEntry, createDeleteEntry, createModifyEntry, createRenameEntry, formatDiffEntry, getFailedUpdates, getSuccessfulUpdates, hasUpdates, isMergeSuccessful, isPullSuccessful, isPushSuccessful, isRebaseSuccessful };
|
|
5
|
+
export { AddCommand, AuthenticationError, BlameCommand, CannotDeleteCurrentBranchError, ChangeType, CheckoutCommand, CheckoutStage, CheckoutStatus, CherryPickCommand, CherryPickStatus, CleanCommand, CloneCommand, CommitCommand, CommitNotFoundError, ContentMergeStrategy, CreateBranchCommand, DeleteBranchCommand, DeleteTagCommand, DescribeCommand, DetachedHeadError, DiffCommand, DiffFormatter, EmptyCommitError, FastForwardMode, FetchCommand, GarbageCollectCommand, Git, GitApiError, GitCommand, IncompatibleOptionsError, InitCommand, InvalidArgumentError, InvalidMainlineParentError, InvalidMergeHeadsError, InvalidRefNameError, InvalidRemoteError, InvalidStashIndexError, InvalidTagNameError, ListBranchCommand, ListBranchMode, ListTagCommand, LogCommand, LsRemoteCommand, MergeCommand, MergeConflictError, MergeFailureReason, MergeStatus, MergeStrategy, MissingArgumentError, MultipleParentsNotAllowedError, NoFilepatternError, NoHeadError, NoMergeBaseError, NoMessageError, NoRebaseInProgressError, NonFastForwardError, NotADirectoryError, NotFastForwardError, NotImplementedError, NotMergedError, PackRefsCommand, PathNotFoundInTreeError, PathNotInIndexError, PullCommand, PushCommand, PushRejectedException, PushStatus, RebaseAction, RebaseCommand, RebaseOperation, RebaseStatus, RefAlreadyExistsError, RefNotFoundError, RefUpdateStatus, ReflogCommand, RemoteAddCommand, RemoteAlreadyExistsError, RemoteListCommand, RemoteNotFoundError, RemoteRemoveCommand, RemoteSetUrlCommand, RenameBranchCommand, ResetCommand, ResetMode, RevFilter, RevertCommand, RevertStatus, RmCommand, STASH_REF, StashApplyCommand, StashApplyFailedError, StashApplyStatus, StashCreateCommand, StashDropCommand, StashListCommand, StashNotFoundError, StatusCommand, StatusImpl, StoreNotAvailableError, TagCommand, TagOption, TransportCommand, TransportError, UnmergedPathsError, UpstreamRequiredError, createAddEntry, createCopyEntry, createDeleteEntry, createModifyEntry, createRenameEntry, formatDiffEntry, getFailedUpdates, getSuccessfulUpdates, hasUpdates, isMergeSuccessful, isPullSuccessful, isPushSuccessful, isRebaseSuccessful, toTagMode, toTrackingRefUpdate };
|
|
@@ -76,6 +76,10 @@ export declare class RemoteConfigStore {
|
|
|
76
76
|
urlFor(name: string, options?: {
|
|
77
77
|
push?: boolean;
|
|
78
78
|
}): string | undefined;
|
|
79
|
+
/** A config variable (`push.default`, `branch.main.merge`), the last value when repeated. */
|
|
80
|
+
value(key: string): string | undefined;
|
|
81
|
+
/** Sets a config variable, replacing every value it had. */
|
|
82
|
+
setValue(key: string, value: string): void;
|
|
79
83
|
/** Flush to the backing file, if the config has one. */
|
|
80
84
|
save(): Promise<void>;
|
|
81
85
|
private strings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-config-store.d.ts","sourceRoot":"","sources":["../../src/remote-config/remote-config-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AAIpF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oDAAoD;IACpD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qBAAqB;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,oBAAoB;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAmHD;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA3C,OAAO,eAAuD;IAE9D;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,iBAAiB,CAIvD;IAED,+CAA+C;IAC/C,eAAe,IAAI,MAAM,EAAE,CAE1B;IAED,+CAA+C;IAC/C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElC;IAED;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAS/B;IAED,mEAAmE;IACnE,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAKhC;IAED,kDAAkD;IAClD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzB;IAED;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI,CAezF;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,MAAM,GAAG,SAAS,CAMzE;IAED,wDAAwD;IAClD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1B;IAED,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,MAAM;CASf;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE;IAAE,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAC9D,OAAO,CAAC,MAAM,EAAE,CAAC,CAOnB"}
|
|
1
|
+
{"version":3,"file":"remote-config-store.d.ts","sourceRoot":"","sources":["../../src/remote-config/remote-config-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OA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G,MAAM,GAAG,SAAS,CAMzE;IAED,6FAA6F;IAC7F,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGrC;IAED,4DAA4D;IAC5D,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEzC;IAED,wDAAwD;IAClD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1B;IAED,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,MAAM;CASf;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE;IAAE,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAC9D,OAAO,CAAC,MAAM,EAAE,CAAC,CAOnB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Based on JGit's DiffFormatter class.
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type Blobs } from "@statewalker/vcs-core";
|
|
7
7
|
import { type SupportedAlgorithm } from "@statewalker/vcs-utils";
|
|
8
8
|
import { type DiffEntry } from "./diff-entry.js";
|
|
9
9
|
/**
|
|
@@ -20,6 +20,11 @@ export interface DiffFormatterOptions {
|
|
|
20
20
|
abbreviationLength?: number;
|
|
21
21
|
/** Diff algorithm to use (default: histogram) */
|
|
22
22
|
algorithm?: SupportedAlgorithm;
|
|
23
|
+
/**
|
|
24
|
+
* Files larger than this are binary: they show as "Binary files differ" and are
|
|
25
|
+
* never loaded (git's `core.bigFileThreshold`). Default 50 MiB.
|
|
26
|
+
*/
|
|
27
|
+
bigFileThreshold?: number;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
30
|
* A hunk in unified diff format.
|
|
@@ -54,9 +59,9 @@ export interface FileContentDiff {
|
|
|
54
59
|
indexLine?: string;
|
|
55
60
|
/** Hunks of changes */
|
|
56
61
|
hunks: DiffHunk[];
|
|
57
|
-
/** Raw old content (
|
|
62
|
+
/** Raw old content of a text file (binary files are not loaded) */
|
|
58
63
|
oldContent?: Uint8Array;
|
|
59
|
-
/** Raw new content (
|
|
64
|
+
/** Raw new content of a text file (binary files are not loaded) */
|
|
60
65
|
newContent?: Uint8Array;
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
@@ -83,10 +88,16 @@ export declare class DiffFormatter {
|
|
|
83
88
|
private abbreviateIds;
|
|
84
89
|
private abbreviationLength;
|
|
85
90
|
private diffAlgorithm;
|
|
91
|
+
private bigFileThreshold;
|
|
86
92
|
constructor(blobs: Blobs, options?: DiffFormatterOptions);
|
|
87
93
|
/**
|
|
88
94
|
* Format a DiffEntry into a content diff.
|
|
89
95
|
*
|
|
96
|
+
* Each side is probed first (its size, and a NUL byte in its first 8000
|
|
97
|
+
* bytes, as git checks). A side over `bigFileThreshold` or binary makes the
|
|
98
|
+
* entry binary, and then the other side is not loaded. Text sides are loaded
|
|
99
|
+
* whole, as the diff algorithms need them, by the same single read as the probe.
|
|
100
|
+
*
|
|
90
101
|
* @param entry The diff entry to format
|
|
91
102
|
* @returns Content diff with hunks
|
|
92
103
|
*/
|
|
@@ -105,10 +116,6 @@ export declare class DiffFormatter {
|
|
|
105
116
|
* @returns Complete unified diff output
|
|
106
117
|
*/
|
|
107
118
|
formatAll(entries: DiffEntry[]): Promise<string>;
|
|
108
|
-
/**
|
|
109
|
-
* Load blob content from storage.
|
|
110
|
-
*/
|
|
111
|
-
private loadContent;
|
|
112
119
|
/**
|
|
113
120
|
* Build the diff header line.
|
|
114
121
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-formatter.d.ts","sourceRoot":"","sources":["../../src/results/diff-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"diff-formatter.d.ts","sourceRoot":"","sources":["../../src/results/diff-formatter.ts"],"names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IACnE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mEAAmE;IACnE,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAa;IAStB,OAAO,CAAC,QAAQ,CAAC,KAAK;IARxB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,gBAAgB,CAAS;IAEjC,YACmB,KAAK,EAAE,KAAK,EAC7B,OAAO,GAAE,oBAAyB,EAQnC;IAED;;;;;;;;;;OAUG;IACG,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAiDvD;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAoCtC;IAED;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CASrD;IAED;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAOpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAkCpB;;OAEG;IACH,OAAO,CAAC,UAAU;CAoDnB"}
|
|
@@ -15,6 +15,13 @@ export interface TrackingRefUpdate {
|
|
|
15
15
|
newObjectId: ObjectId;
|
|
16
16
|
/** Update result status */
|
|
17
17
|
status: RefUpdateStatus;
|
|
18
|
+
/**
|
|
19
|
+
* How git prints the update: `[new branch]`, `[new tag]`, `abc1234..def5678` (fast-forward),
|
|
20
|
+
* `+ abc1234...def5678` (forced), `[rejected]`, `[up to date]`
|
|
21
|
+
*/
|
|
22
|
+
summary?: string;
|
|
23
|
+
/** Why a ref was rejected (`non-fast-forward`, `would clobber existing tag`, a lock failure) */
|
|
24
|
+
reason?: string;
|
|
18
25
|
}
|
|
19
26
|
/**
|
|
20
27
|
* Status of a ref update.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-result.d.ts","sourceRoot":"","sources":["../../src/results/fetch-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,mCAAmC;IACnC,WAAW,EAAE,QAAQ,CAAC;IACtB,2BAA2B;IAC3B,MAAM,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-result.d.ts","sourceRoot":"","sources":["../../src/results/fetch-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,mCAAmC;IACnC,WAAW,EAAE,QAAQ,CAAC;IACtB,2BAA2B;IAC3B,MAAM,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gGAAgG;IAChG,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,oBAAY,eAAe;IACzB,wCAAwC;IACxC,GAAG,QAAQ;IACX,gCAAgC;IAChC,YAAY,iBAAiB;IAC7B,2CAA2C;IAC3C,MAAM,WAAW;IACjB,4CAA4C;IAC5C,SAAS,cAAc;IACvB,uDAAuD;IACvD,QAAQ,aAAa;IACrB,sCAAsC;IACtC,YAAY,iBAAiB;IAC7B,sBAAsB;IACtB,OAAO,YAAY;IACnB,6BAA6B;IAC7B,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC,+CAA+C;IAC/C,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uCAAuC;IACvC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,iBAAiB,EAAE,CAO7E"}
|
package/dist/results/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { C as isMergeSuccessful, S as MergeStrategy, _ as getSuccessfulUpdates, a as RebaseStatus, b as FastForwardMode, c as getFailedUpdates, d as createAddEntry, f as createCopyEntry, g as RefUpdateStatus, h as createRenameEntry, i as RebaseAction, l as isPushSuccessful, m as createModifyEntry, n as StashApplyStatus, o as isRebaseSuccessful, p as createDeleteEntry, r as RevertStatus, s as PushStatus, t as StatusImpl, u as ChangeType, v as hasUpdates, w as CherryPickStatus, x as MergeStatus, y as ContentMergeStrategy } from "../status-result-
|
|
1
|
+
import { C as isMergeSuccessful, S as MergeStrategy, _ as getSuccessfulUpdates, a as RebaseStatus, b as FastForwardMode, c as getFailedUpdates, d as createAddEntry, f as createCopyEntry, g as RefUpdateStatus, h as createRenameEntry, i as RebaseAction, l as isPushSuccessful, m as createModifyEntry, n as StashApplyStatus, o as isRebaseSuccessful, p as createDeleteEntry, r as RevertStatus, s as PushStatus, t as StatusImpl, u as ChangeType, v as hasUpdates, w as CherryPickStatus, x as MergeStatus, y as ContentMergeStrategy } from "../status-result-BapZoQaR.js";
|
|
2
|
+
import { DEFAULT_BIG_FILE_THRESHOLD, probeBlob } from "@statewalker/vcs-core";
|
|
2
3
|
import { DEFAULT_ALGORITHM, RawText, RawTextComparator, getAlgorithm } from "@statewalker/vcs-utils";
|
|
3
4
|
//#region src/results/diff-formatter.ts
|
|
4
5
|
/**
|
|
6
|
+
* Formatter for generating unified diff output from DiffEntry objects.
|
|
7
|
+
*
|
|
8
|
+
* Based on JGit's DiffFormatter class.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
5
11
|
* Format DiffEntry objects into unified diff format.
|
|
6
12
|
*
|
|
7
13
|
* @example
|
|
@@ -25,6 +31,7 @@ var DiffFormatter = class {
|
|
|
25
31
|
abbreviateIds;
|
|
26
32
|
abbreviationLength;
|
|
27
33
|
diffAlgorithm;
|
|
34
|
+
bigFileThreshold;
|
|
28
35
|
constructor(blobs, options = {}) {
|
|
29
36
|
this.blobs = blobs;
|
|
30
37
|
this.contextLines = options.contextLines ?? 3;
|
|
@@ -32,17 +39,29 @@ var DiffFormatter = class {
|
|
|
32
39
|
this.abbreviateIds = options.abbreviateIds ?? true;
|
|
33
40
|
this.abbreviationLength = options.abbreviationLength ?? 7;
|
|
34
41
|
this.diffAlgorithm = getAlgorithm(options.algorithm ?? DEFAULT_ALGORITHM);
|
|
42
|
+
this.bigFileThreshold = options.bigFileThreshold ?? DEFAULT_BIG_FILE_THRESHOLD;
|
|
35
43
|
}
|
|
36
44
|
/**
|
|
37
45
|
* Format a DiffEntry into a content diff.
|
|
38
46
|
*
|
|
47
|
+
* Each side is probed first (its size, and a NUL byte in its first 8000
|
|
48
|
+
* bytes, as git checks). A side over `bigFileThreshold` or binary makes the
|
|
49
|
+
* entry binary, and then the other side is not loaded. Text sides are loaded
|
|
50
|
+
* whole, as the diff algorithms need them, by the same single read as the probe.
|
|
51
|
+
*
|
|
39
52
|
* @param entry The diff entry to format
|
|
40
53
|
* @returns Content diff with hunks
|
|
41
54
|
*/
|
|
42
55
|
async format(entry) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
const options = {
|
|
57
|
+
bigFileThreshold: this.bigFileThreshold,
|
|
58
|
+
loadText: true
|
|
59
|
+
};
|
|
60
|
+
const oldProbe = entry.oldId ? await probeBlob(this.blobs, entry.oldId, options) : null;
|
|
61
|
+
const newProbe = !oldProbe?.binary && entry.newId ? await probeBlob(this.blobs, entry.newId, options) : null;
|
|
62
|
+
const isBinary = (oldProbe?.binary ?? false) || (newProbe?.binary ?? false);
|
|
63
|
+
const oldContent = !isBinary ? oldProbe?.content ?? null : null;
|
|
64
|
+
const newContent = !isBinary ? newProbe?.content ?? null : null;
|
|
46
65
|
const result = {
|
|
47
66
|
entry,
|
|
48
67
|
isBinary,
|
|
@@ -76,7 +95,10 @@ var DiffFormatter = class {
|
|
|
76
95
|
if (diff.indexLine) lines.push(diff.indexLine);
|
|
77
96
|
}
|
|
78
97
|
if (diff.isBinary) {
|
|
79
|
-
|
|
98
|
+
const e = diff.entry;
|
|
99
|
+
const oldName = e.changeType === "ADD" || !e.oldPath ? "/dev/null" : `a/${e.oldPath}`;
|
|
100
|
+
const newName = e.changeType === "DELETE" || !e.newPath ? "/dev/null" : `b/${e.newPath}`;
|
|
101
|
+
lines.push(`Binary files ${oldName} and ${newName} differ`);
|
|
80
102
|
return lines.join("\n");
|
|
81
103
|
}
|
|
82
104
|
if (this.includeHeaders && diff.hunks.length > 0) {
|
|
@@ -104,23 +126,6 @@ var DiffFormatter = class {
|
|
|
104
126
|
return parts.join("\n");
|
|
105
127
|
}
|
|
106
128
|
/**
|
|
107
|
-
* Load blob content from storage.
|
|
108
|
-
*/
|
|
109
|
-
async loadContent(objectId) {
|
|
110
|
-
const content = await this.blobs.load(objectId);
|
|
111
|
-
if (!content) throw new Error(`Blob not found: ${objectId}`);
|
|
112
|
-
const chunks = [];
|
|
113
|
-
for await (const chunk of content) chunks.push(chunk);
|
|
114
|
-
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
115
|
-
const result = new Uint8Array(totalLength);
|
|
116
|
-
let offset = 0;
|
|
117
|
-
for (const chunk of chunks) {
|
|
118
|
-
result.set(chunk, offset);
|
|
119
|
-
offset += chunk.length;
|
|
120
|
-
}
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
129
|
* Build the diff header line.
|
|
125
130
|
*/
|
|
126
131
|
buildHeader(entry) {
|
|
@@ -9,6 +9,8 @@ export declare enum PushStatus {
|
|
|
9
9
|
OK = "ok",
|
|
10
10
|
/** Update was rejected (not fast-forward) */
|
|
11
11
|
REJECTED_NONFASTFORWARD = "rejected-nonfastforward",
|
|
12
|
+
/** Update was rejected: the remote ref no longer has the leased value (`--force-with-lease`) */
|
|
13
|
+
REJECTED_REMOTE_CHANGED = "rejected-remote-changed",
|
|
12
14
|
/** Update was rejected (other reason) */
|
|
13
15
|
REJECTED_OTHER = "rejected-other",
|
|
14
16
|
/** Update failed (remote error) */
|
|
@@ -36,9 +38,14 @@ export interface RemoteRefUpdate {
|
|
|
36
38
|
newObjectId: ObjectId;
|
|
37
39
|
/** Status of the update */
|
|
38
40
|
status: PushStatus;
|
|
39
|
-
/**
|
|
41
|
+
/** Why the update was refused: the server's reason, or git's status column */
|
|
40
42
|
message?: string;
|
|
41
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* git's status column (`[new branch]`, `abc1234..def5678`, `[rejected] (fetch first)`,
|
|
45
|
+
* `[remote rejected] (hook declined)`, …)
|
|
46
|
+
*/
|
|
47
|
+
summary?: string;
|
|
48
|
+
/** Whether the update was allowed to be a non-fast-forward (`+`, setForce, a lease that held) */
|
|
42
49
|
forceUpdate: boolean;
|
|
43
50
|
/** Whether this was a delete operation */
|
|
44
51
|
delete: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-result.d.ts","sourceRoot":"","sources":["../../src/results/push-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;GAIG;AACH,oBAAY,UAAU;IACpB,wCAAwC;IACxC,EAAE,OAAO;IACT,6CAA6C;IAC7C,uBAAuB,4BAA4B;IACnD,yCAAyC;IACzC,cAAc,mBAAmB;IACjC,mCAAmC;IACnC,MAAM,WAAW;IACjB,6CAA6C;IAC7C,aAAa,kBAAkB;IAC/B,gCAAgC;IAChC,UAAU,eAAe;IACzB,0DAA0D;IAC1D,eAAe,oBAAoB;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,QAAQ,CAAC;IAC/B,oCAAoC;IACpC,WAAW,EAAE,QAAQ,CAAC;IACtB,2BAA2B;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"push-result.d.ts","sourceRoot":"","sources":["../../src/results/push-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;GAIG;AACH,oBAAY,UAAU;IACpB,wCAAwC;IACxC,EAAE,OAAO;IACT,6CAA6C;IAC7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Status["OK"] = "ok";
|
|
249
249
|
/** Update was rejected (not fast-forward) */
|
|
250
250
|
PushStatus["REJECTED_NONFASTFORWARD"] = "rejected-nonfastforward";
|
|
251
|
+
/** Update was rejected: the remote ref no longer has the leased value (`--force-with-lease`) */
|
|
252
|
+
PushStatus["REJECTED_REMOTE_CHANGED"] = "rejected-remote-changed";
|
|
251
253
|
/** Update was rejected (other reason) */
|
|
252
254
|
PushStatus["REJECTED_OTHER"] = "rejected-other";
|
|
253
255
|
/** Update failed (remote error) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statewalker/vcs-commands",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Git-like VCS commands (commit, checkout, merge, diff, log)",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/statewalker/webrun-vcs/issues"
|
|
@@ -46,26 +46,27 @@
|
|
|
46
46
|
"src"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@statewalker/vcs-
|
|
50
|
-
"@statewalker/vcs-
|
|
51
|
-
"@statewalker/vcs-store-files": "^0.
|
|
52
|
-
"@statewalker/vcs-utils": "^0.
|
|
53
|
-
"@statewalker/vcs-
|
|
54
|
-
"@statewalker/vcs-
|
|
49
|
+
"@statewalker/vcs-store-mem": "^0.4.0",
|
|
50
|
+
"@statewalker/vcs-transport": "^0.4.0",
|
|
51
|
+
"@statewalker/vcs-store-files": "^0.4.0",
|
|
52
|
+
"@statewalker/vcs-utils": "^0.4.0",
|
|
53
|
+
"@statewalker/vcs-working-tree": "^0.4.0",
|
|
54
|
+
"@statewalker/vcs-core": "^0.4.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^26.6.4",
|
|
58
58
|
"rolldown": "^1.2.12",
|
|
59
59
|
"typescript": "^7.0.2",
|
|
60
|
-
"vitest": "^5.0
|
|
61
|
-
"@statewalker/vcs-transport-adapters": "^0.
|
|
62
|
-
"@statewalker/vcs-utils-node": "^0.
|
|
63
|
-
"@statewalker/vcs-store-sql": "^0.
|
|
60
|
+
"vitest": "^5.1.0",
|
|
61
|
+
"@statewalker/vcs-transport-adapters": "^0.4.0",
|
|
62
|
+
"@statewalker/vcs-utils-node": "^0.4.0",
|
|
63
|
+
"@statewalker/vcs-store-sql": "^0.4.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "rm -rf dist && rolldown -c && tsc --emitDeclarationOnly --declaration",
|
|
67
67
|
"test": "vitest run",
|
|
68
68
|
"lint": "biome lint src tests",
|
|
69
|
-
"typecheck": "tsc --noEmit"
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"typecheck:tests": "tsc --noEmit -p tsconfig.test.json"
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
import { FileMode } from "@statewalker/vcs-core";
|
|
34
|
+
import { EMPTY_BLOB_ID, FileMode } from "@statewalker/vcs-core";
|
|
35
35
|
import {
|
|
36
36
|
DeleteStagingEntry,
|
|
37
37
|
UpdateStagingEntry,
|
|
38
38
|
type Worktree,
|
|
39
39
|
} from "@statewalker/vcs-working-tree";
|
|
40
|
+
import { storeWorktreeFile } from "../core-commands/index.js";
|
|
40
41
|
|
|
41
42
|
import {
|
|
42
43
|
IncompatibleOptionsError,
|
|
@@ -433,10 +434,15 @@ export class AddCommand extends GitCommand<AddResult> {
|
|
|
433
434
|
const worktreeEntry = await worktree.getEntry(file.path);
|
|
434
435
|
const mode = worktreeEntry?.mode ?? FileMode.REGULAR_FILE;
|
|
435
436
|
editor.add(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
437
|
+
// the empty blob's id, flagged intent-to-add, as git records it (never an empty
|
|
438
|
+
// or all-zero id, which a worktree hash could be compared against)
|
|
439
|
+
new UpdateStagingEntry(
|
|
440
|
+
file.path,
|
|
441
|
+
EMPTY_BLOB_ID,
|
|
442
|
+
mode,
|
|
443
|
+
{ size: 0, mtime: Date.now() },
|
|
444
|
+
{ intentToAdd: true },
|
|
445
|
+
),
|
|
440
446
|
);
|
|
441
447
|
added.push(file.path);
|
|
442
448
|
continue;
|
|
@@ -450,13 +456,14 @@ export class AddCommand extends GitCommand<AddResult> {
|
|
|
450
456
|
}
|
|
451
457
|
|
|
452
458
|
// Hash and store content
|
|
453
|
-
|
|
459
|
+
// the stat that matched the stored content (a fresh one after a retry)
|
|
460
|
+
const stored = await storeWorktreeFile(this.blobs, worktree, file.path, worktreeEntry);
|
|
454
461
|
|
|
455
462
|
// Add to staging
|
|
456
463
|
editor.add(
|
|
457
|
-
new UpdateStagingEntry(file.path,
|
|
458
|
-
size:
|
|
459
|
-
mtime:
|
|
464
|
+
new UpdateStagingEntry(file.path, stored.id, stored.entry.mode, {
|
|
465
|
+
size: stored.entry.size,
|
|
466
|
+
mtime: stored.entry.mtime,
|
|
460
467
|
}),
|
|
461
468
|
);
|
|
462
469
|
added.push(file.path);
|
|
@@ -475,20 +482,4 @@ export class AddCommand extends GitCommand<AddResult> {
|
|
|
475
482
|
totalProcessed: added.length + removed.length,
|
|
476
483
|
};
|
|
477
484
|
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Store file content as blob and return object ID.
|
|
481
|
-
*
|
|
482
|
-
* Note: The object store handles blob header internally.
|
|
483
|
-
*/
|
|
484
|
-
private async storeFileContent(worktree: Worktree, path: string): Promise<string> {
|
|
485
|
-
// Read content from working tree
|
|
486
|
-
const chunks: Uint8Array[] = [];
|
|
487
|
-
for await (const chunk of worktree.readContent(path)) {
|
|
488
|
-
chunks.push(chunk);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// Store raw content - the blob store handles blob formatting
|
|
492
|
-
return this.blobs.store(chunks);
|
|
493
|
-
}
|
|
494
485
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Commit, ObjectId, PersonIdent, TreeEntry } from "@statewalker/vcs-core";
|
|
2
|
+
import { DEFAULT_BIG_FILE_THRESHOLD } from "@statewalker/vcs-core";
|
|
2
3
|
import type { Edit } from "@statewalker/vcs-utils";
|
|
3
4
|
import {
|
|
4
5
|
DEFAULT_ALGORITHM,
|
|
@@ -197,6 +198,7 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
197
198
|
private followRenames = false;
|
|
198
199
|
private renameScore = DEFAULT_RENAME_SCORE;
|
|
199
200
|
private diffAlgorithm: DiffAlgorithm = getAlgorithm(DEFAULT_ALGORITHM);
|
|
201
|
+
private bigFileThreshold = DEFAULT_BIG_FILE_THRESHOLD;
|
|
200
202
|
|
|
201
203
|
/**
|
|
202
204
|
* Set the file path to blame.
|
|
@@ -258,6 +260,22 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
258
260
|
return this;
|
|
259
261
|
}
|
|
260
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Set the size above which a file is never loaded (git's
|
|
265
|
+
* `core.bigFileThreshold`, default 50 MiB).
|
|
266
|
+
*
|
|
267
|
+
* Blaming a file over it rejects. A parent version over it is not compared:
|
|
268
|
+
* the lines it would have taken stay with the child commit, and it is not a
|
|
269
|
+
* rename candidate.
|
|
270
|
+
*
|
|
271
|
+
* @param threshold Size in bytes
|
|
272
|
+
*/
|
|
273
|
+
setBigFileThreshold(threshold: number): this {
|
|
274
|
+
this.checkCallable();
|
|
275
|
+
this.bigFileThreshold = threshold;
|
|
276
|
+
return this;
|
|
277
|
+
}
|
|
278
|
+
|
|
261
279
|
/**
|
|
262
280
|
* Execute the blame command.
|
|
263
281
|
*
|
|
@@ -298,6 +316,13 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
298
316
|
throw new Error(`File not found: ${resultPath}`);
|
|
299
317
|
}
|
|
300
318
|
|
|
319
|
+
const size = await this.blobs.size(blobId);
|
|
320
|
+
if (size > this.bigFileThreshold) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`${resultPath} is ${size} bytes, larger than bigFileThreshold (${this.bigFileThreshold})`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
301
326
|
// Get file content and count lines
|
|
302
327
|
const content = await this.collectBlob(blobId);
|
|
303
328
|
const lineCount = this.countLines(content);
|
|
@@ -401,6 +426,11 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
401
426
|
}
|
|
402
427
|
}
|
|
403
428
|
|
|
429
|
+
// A parent version over the threshold is never loaded: treat it as unrelated
|
|
430
|
+
if (parentBlobId && parentBlobId !== candidate.blobId && (await this.isBig(parentBlobId))) {
|
|
431
|
+
parentBlobId = undefined;
|
|
432
|
+
}
|
|
433
|
+
|
|
404
434
|
if (!parentBlobId) {
|
|
405
435
|
// File was introduced in this commit - blame all regions
|
|
406
436
|
this.blameRegions(entries, candidate);
|
|
@@ -500,6 +530,10 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
500
530
|
}
|
|
501
531
|
}
|
|
502
532
|
|
|
533
|
+
if (parentBlobId && parentBlobId !== candidate.blobId && (await this.isBig(parentBlobId))) {
|
|
534
|
+
parentBlobId = undefined;
|
|
535
|
+
}
|
|
536
|
+
|
|
503
537
|
if (parentBlobId) {
|
|
504
538
|
// If any parent has identical blob, pass all blame to that parent
|
|
505
539
|
if (parentBlobId === candidate.blobId) {
|
|
@@ -983,6 +1017,8 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
983
1017
|
let bestMatch: { path: string; blobId: ObjectId; score: number } | undefined;
|
|
984
1018
|
|
|
985
1019
|
for (const { path: oldPath, entry } of deletedFiles) {
|
|
1020
|
+
if (await this.isBig(entry.id)) continue;
|
|
1021
|
+
|
|
986
1022
|
// Load the old file content
|
|
987
1023
|
const oldContent = await this.collectBlob(entry.id);
|
|
988
1024
|
|
|
@@ -1039,6 +1075,11 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
1039
1075
|
}
|
|
1040
1076
|
}
|
|
1041
1077
|
|
|
1078
|
+
/** Whether a blob is over the threshold (from its size, without reading it). */
|
|
1079
|
+
private async isBig(blobId: ObjectId): Promise<boolean> {
|
|
1080
|
+
return (await this.blobs.size(blobId)) > this.bigFileThreshold;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1042
1083
|
/**
|
|
1043
1084
|
* Collect blob content into a single buffer.
|
|
1044
1085
|
*/
|