@scolladon/tsgit 2.0.1 → 3.1.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 +14 -2
- package/dist/cjs/adapters/browser/index.cjs +1 -2
- package/dist/cjs/adapters/memory/index.cjs +1 -2
- package/dist/cjs/adapters/node/index.cjs +1 -2
- package/dist/cjs/chunks/adapter-detect-DW9fsw9d.cjs +1 -0
- package/dist/cjs/chunks/browser-http-transport-DGwW5YL7.cjs +1 -0
- package/dist/cjs/chunks/context-BcoAzPuU.cjs +0 -1
- package/dist/cjs/chunks/error-CfLWDui_.cjs +1 -0
- package/dist/cjs/chunks/index-Cy44GVR6.cjs +1 -0
- package/dist/cjs/chunks/inflate-CmCtM4-w.cjs +1 -0
- package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +0 -1
- package/dist/cjs/chunks/memory-http-transport-CGriODcQ.cjs +1 -0
- package/dist/cjs/chunks/node-ssh-transport-PFu3ijfp.cjs +1 -0
- package/dist/cjs/chunks/{progress-CxU62NC1.cjs → progress-D8Dqbftk.cjs} +1 -2
- package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +0 -1
- package/dist/cjs/chunks/repository-Ci-BBxk0.cjs +1 -0
- package/dist/cjs/chunks/write-sparse-checkout-C1dsHCAD.cjs +1 -0
- package/dist/cjs/commands/index.cjs +1 -2
- package/dist/cjs/index.browser.cjs +1 -2
- package/dist/cjs/index.cjs +1 -2
- package/dist/cjs/index.default.cjs +1 -2
- package/dist/cjs/index.node.cjs +1 -2
- package/dist/cjs/operators/index.cjs +0 -1
- package/dist/cjs/primitives/index.cjs +1 -2
- package/dist/cjs/transport/index.cjs +0 -1
- package/dist/esm/adapters/browser/index.js +1 -2
- package/dist/esm/adapters/memory/index.js +1 -2
- package/dist/esm/adapters/node/index.js +1 -2
- package/dist/esm/chunks/adapter-detect-BkCMnjrI.js +1 -0
- package/dist/esm/chunks/browser-http-transport-CSxAte5h.js +1 -0
- package/dist/esm/chunks/context-CumKOV7K.js +0 -1
- package/dist/esm/chunks/error-BotOd-nD.js +1 -0
- package/dist/esm/chunks/index-DsvINN8n.js +1 -0
- package/dist/esm/chunks/inflate-BCIXqeeE.js +1 -0
- package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +0 -1
- package/dist/esm/chunks/memory-http-transport-caqmMGR1.js +1 -0
- package/dist/esm/chunks/node-ssh-transport-BgSv2IhT.js +1 -0
- package/dist/esm/chunks/{progress-BZobfl7p.js → progress-B_AJnOHx.js} +1 -2
- package/dist/esm/chunks/readable-stream-CGuf8k1J.js +0 -1
- package/dist/esm/chunks/repository-DyxknzvE.js +1 -0
- package/dist/esm/chunks/write-sparse-checkout-BwHbNKNS.js +1 -0
- package/dist/esm/commands/index.js +1 -2
- package/dist/esm/index.browser.js +1 -2
- package/dist/esm/index.default.js +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.node.js +1 -2
- package/dist/esm/operators/index.js +0 -1
- package/dist/esm/primitives/index.js +1 -2
- package/dist/esm/transport/index.js +0 -1
- package/dist/types/adapters/browser/index.d.cts +5 -3
- package/dist/types/adapters/browser/index.d.ts +5 -3
- package/dist/types/adapters/memory/index.d.cts +31 -4
- package/dist/types/adapters/memory/index.d.ts +31 -4
- package/dist/types/adapters/node/index.d.cts +146 -40
- package/dist/types/adapters/node/index.d.ts +146 -40
- package/dist/types/chunks/{context-YDw6qicq.d.cts → context-CF1YF2S8.d.cts} +165 -6
- package/dist/types/chunks/{context-CCL0_F8R.d.ts → context-sIhhtk2u.d.ts} +165 -6
- package/dist/types/chunks/{http-transport--_NdQOiw.d.cts → http-transport-DirKfK2S.d.cts} +1 -1
- package/dist/types/chunks/{http-transport--_NdQOiw.d.ts → http-transport-DirKfK2S.d.ts} +1 -1
- package/dist/types/chunks/index-B5Dps3fg.d.ts +2468 -0
- package/dist/types/chunks/index-B_A8VLaf.d.ts +1221 -0
- package/dist/types/chunks/index-Dfh8cvEs.d.cts +2468 -0
- package/dist/types/chunks/index-Dqxddhav.d.cts +1221 -0
- package/dist/types/chunks/progress-BjAKfkam.d.ts +1217 -0
- package/dist/types/chunks/progress-Ldnfb8st.d.cts +1217 -0
- package/dist/types/chunks/reflog-entry-Cqh3QrPH.d.ts +697 -0
- package/dist/types/chunks/reflog-entry-Dy-O27Dd.d.cts +697 -0
- package/dist/types/chunks/{repository-FoS_Laoy.d.ts → repository-D8QBTkEz.d.ts} +58 -20
- package/dist/types/chunks/{repository-BeifCqp0.d.cts → repository-D9YrVhcH.d.cts} +58 -20
- package/dist/types/commands/index.d.cts +4 -1259
- package/dist/types/commands/index.d.ts +4 -1259
- package/dist/types/index.browser.d.cts +7 -8
- package/dist/types/index.browser.d.ts +7 -8
- package/dist/types/index.d.cts +61 -124
- package/dist/types/index.d.ts +61 -124
- package/dist/types/index.default.d.cts +7 -8
- package/dist/types/index.default.d.ts +7 -8
- package/dist/types/index.node.d.cts +7 -8
- package/dist/types/index.node.d.ts +7 -8
- package/dist/types/primitives/index.d.cts +4 -692
- package/dist/types/primitives/index.d.ts +4 -692
- package/dist/types/transport/index.d.cts +1 -1
- package/dist/types/transport/index.d.ts +1 -1
- package/package.json +94 -28
- package/dist/cjs/adapters/browser/index.cjs.map +0 -1
- package/dist/cjs/adapters/memory/index.cjs.map +0 -1
- package/dist/cjs/adapters/node/index.cjs.map +0 -1
- package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs +0 -2
- package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs.map +0 -1
- package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs +0 -2
- package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs.map +0 -1
- package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +0 -1
- package/dist/cjs/chunks/error-CfjFO3x_.cjs +0 -2
- package/dist/cjs/chunks/error-CfjFO3x_.cjs.map +0 -1
- package/dist/cjs/chunks/index-BWCq_5BJ.cjs +0 -2
- package/dist/cjs/chunks/index-BWCq_5BJ.cjs.map +0 -1
- package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +0 -1
- package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs +0 -2
- package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs.map +0 -1
- package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs +0 -2
- package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs.map +0 -1
- package/dist/cjs/chunks/progress-CxU62NC1.cjs.map +0 -1
- package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +0 -1
- package/dist/cjs/chunks/repository-BEg2zNtx.cjs +0 -2
- package/dist/cjs/chunks/repository-BEg2zNtx.cjs.map +0 -1
- package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs +0 -2
- package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs.map +0 -1
- package/dist/cjs/commands/index.cjs.map +0 -1
- package/dist/cjs/index.browser.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.default.cjs.map +0 -1
- package/dist/cjs/index.node.cjs.map +0 -1
- package/dist/cjs/operators/index.cjs.map +0 -1
- package/dist/cjs/primitives/index.cjs.map +0 -1
- package/dist/cjs/transport/index.cjs.map +0 -1
- package/dist/esm/adapters/browser/index.js.map +0 -1
- package/dist/esm/adapters/memory/index.js.map +0 -1
- package/dist/esm/adapters/node/index.js.map +0 -1
- package/dist/esm/chunks/adapter-detect-DkZhhUhd.js +0 -2
- package/dist/esm/chunks/adapter-detect-DkZhhUhd.js.map +0 -1
- package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js +0 -2
- package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js.map +0 -1
- package/dist/esm/chunks/context-CumKOV7K.js.map +0 -1
- package/dist/esm/chunks/error-Dc-SRSJK.js +0 -2
- package/dist/esm/chunks/error-Dc-SRSJK.js.map +0 -1
- package/dist/esm/chunks/index-jH0UMhh-.js +0 -2
- package/dist/esm/chunks/index-jH0UMhh-.js.map +0 -1
- package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +0 -1
- package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js +0 -2
- package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js.map +0 -1
- package/dist/esm/chunks/node-http-transport-DPa2lK3T.js +0 -2
- package/dist/esm/chunks/node-http-transport-DPa2lK3T.js.map +0 -1
- package/dist/esm/chunks/progress-BZobfl7p.js.map +0 -1
- package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +0 -1
- package/dist/esm/chunks/repository-DF6ePd1x.js +0 -2
- package/dist/esm/chunks/repository-DF6ePd1x.js.map +0 -1
- package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js +0 -2
- package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js.map +0 -1
- package/dist/esm/commands/index.js.map +0 -1
- package/dist/esm/index.browser.js.map +0 -1
- package/dist/esm/index.default.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.node.js.map +0 -1
- package/dist/esm/operators/index.js.map +0 -1
- package/dist/esm/primitives/index.js.map +0 -1
- package/dist/esm/transport/index.js.map +0 -1
- package/dist/types/chunks/index-entry-DtEbVpOG.d.cts +0 -47
- package/dist/types/chunks/index-entry-UD4dvtKh.d.ts +0 -47
- package/dist/types/chunks/progress-7KKiXXfX.d.ts +0 -405
- package/dist/types/chunks/progress-By8yFaUE.d.cts +0 -405
- package/dist/types/chunks/reflog-entry-BbNnXCTC.d.cts +0 -368
- package/dist/types/chunks/reflog-entry-CSzjnZd4.d.ts +0 -368
- package/dist/types/chunks/write-tree-C3oNxOlX.d.cts +0 -196
- package/dist/types/chunks/write-tree-DRI-LzSr.d.ts +0 -196
|
@@ -0,0 +1,2468 @@
|
|
|
1
|
+
import { O as ObjectId, R as RefName, F as FilePath, c as Context, o as PromisorRemote } from './context-CF1YF2S8.cjs';
|
|
2
|
+
import { p as FileMode, aO as IndexEntry, $ as StatData, G as GitIndex, q as FlatTree, a8 as TreeDiff, L as LineKey, a as AuthorIdentity, C as CatFileBatchEntry, aP as ConfigKey, aN as ConfigScope, X as RenameDetectOptions, a3 as StatTreeDiff, a4 as SubmoduleEntry, V as ReadObjectOptions, aQ as ReflogEntry, e as CommitData, a6 as TagData } from './reflog-entry-Dy-O27Dd.cjs';
|
|
3
|
+
|
|
4
|
+
type BundleVersion = 2 | 3;
|
|
5
|
+
type BundleHashAlgorithm = 'sha1';
|
|
6
|
+
interface BundleRef {
|
|
7
|
+
readonly oid: ObjectId;
|
|
8
|
+
readonly name: RefName;
|
|
9
|
+
}
|
|
10
|
+
interface BundlePrerequisite {
|
|
11
|
+
readonly oid: ObjectId;
|
|
12
|
+
readonly comment: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type ConflictType = 'content' | 'add-add' | 'distinct-types' | 'modify-delete' | 'type-change' | 'rename-rename' | 'gitlink' | 'binary';
|
|
16
|
+
interface MergeConflict {
|
|
17
|
+
readonly type: ConflictType;
|
|
18
|
+
readonly path: FilePath;
|
|
19
|
+
readonly baseId?: ObjectId;
|
|
20
|
+
readonly ourId?: ObjectId;
|
|
21
|
+
readonly theirId?: ObjectId;
|
|
22
|
+
readonly baseMode?: FileMode;
|
|
23
|
+
readonly ourMode?: FileMode;
|
|
24
|
+
readonly theirMode?: FileMode;
|
|
25
|
+
readonly conflictContent?: Uint8Array;
|
|
26
|
+
readonly contentVerdict?: 'clean' | 'content' | 'binary';
|
|
27
|
+
/**
|
|
28
|
+
* Three-way-merged mode for `content` conflicts (theirs' mode when only
|
|
29
|
+
* theirs diverged from the base, ours' otherwise). The working tree is
|
|
30
|
+
* materialised with this mode; the per-side stage entries keep their own.
|
|
31
|
+
*/
|
|
32
|
+
readonly mergedMode?: FileMode;
|
|
33
|
+
/** Recorded path for our side; populated only on `distinct-types` conflicts. */
|
|
34
|
+
readonly ourPath?: FilePath;
|
|
35
|
+
/** Recorded path for their side; populated only on `distinct-types` conflicts. */
|
|
36
|
+
readonly theirPath?: FilePath;
|
|
37
|
+
/** Recorded path of the base's stage-1 entry; populated only on `distinct-types` conflicts that have a base. */
|
|
38
|
+
readonly basePath?: FilePath;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface UnmergedEntryGroup {
|
|
42
|
+
readonly stage1?: IndexEntry;
|
|
43
|
+
readonly stage2?: IndexEntry;
|
|
44
|
+
readonly stage3?: IndexEntry;
|
|
45
|
+
}
|
|
46
|
+
interface GroupedIndex {
|
|
47
|
+
readonly staged: ReadonlyArray<IndexEntry>;
|
|
48
|
+
readonly unmerged: ReadonlyMap<FilePath, UnmergedEntryGroup>;
|
|
49
|
+
}
|
|
50
|
+
declare function diffIndexAgainstTree(index: GitIndex, tree: FlatTree | undefined): TreeDiff;
|
|
51
|
+
declare function groupUnmergedEntries(index: GitIndex): GroupedIndex;
|
|
52
|
+
declare function recordedPaths(conflict: MergeConflict): ReadonlyArray<FilePath>;
|
|
53
|
+
declare function sortedRecordedPaths(conflicts: ReadonlyArray<MergeConflict>): ReadonlyArray<FilePath>;
|
|
54
|
+
declare function conflictsToIndexEntries(conflicts: ReadonlyArray<MergeConflict>, statFactory: (mode: FileMode) => StatData): ReadonlyArray<IndexEntry>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The seven git conflict states, each a function of which merge stages
|
|
58
|
+
* (1 = base, 2 = ours, 3 = theirs) an unmerged path carries. They map to git's
|
|
59
|
+
* porcelain unmerged `XY` codes: `both-modified` → `UU`, `both-added` → `AA`,
|
|
60
|
+
* `both-deleted` → `DD`, `added-by-us` → `AU`, `added-by-them` → `UA`,
|
|
61
|
+
* `deleted-by-us` → `DU`, `deleted-by-them` → `UD`.
|
|
62
|
+
*/
|
|
63
|
+
type ConflictKind = 'both-modified' | 'both-added' | 'both-deleted' | 'added-by-us' | 'added-by-them' | 'deleted-by-us' | 'deleted-by-them';
|
|
64
|
+
/**
|
|
65
|
+
* Classify an unmerged path by the presence of its base/ours/theirs stages. The
|
|
66
|
+
* seven non-empty subsets of `{1,2,3}` map one-to-one onto {@link ConflictKind};
|
|
67
|
+
* the fall-through final arm is the lone stage-3 case, total over a non-empty
|
|
68
|
+
* group (every group built from a real index carries at least one stage).
|
|
69
|
+
*/
|
|
70
|
+
declare const classifyUnmerged: (group: UnmergedEntryGroup) => ConflictKind;
|
|
71
|
+
|
|
72
|
+
interface LineHunk {
|
|
73
|
+
readonly kind: 'common' | 'ours-only' | 'theirs-only';
|
|
74
|
+
readonly oursStart: number;
|
|
75
|
+
readonly oursEnd: number;
|
|
76
|
+
readonly theirsStart: number;
|
|
77
|
+
readonly theirsEnd: number;
|
|
78
|
+
}
|
|
79
|
+
interface LineDiffOptions {
|
|
80
|
+
readonly lineKey?: LineKey;
|
|
81
|
+
}
|
|
82
|
+
interface LineDiff {
|
|
83
|
+
readonly hunks: ReadonlyArray<LineHunk>;
|
|
84
|
+
readonly oursLines: ReadonlyArray<Uint8Array>;
|
|
85
|
+
readonly theirsLines: ReadonlyArray<Uint8Array>;
|
|
86
|
+
readonly degraded: boolean;
|
|
87
|
+
}
|
|
88
|
+
declare const BINARY_DETECTION_BYTES = 8000;
|
|
89
|
+
declare const MAX_LINE_BYTES = 65536;
|
|
90
|
+
declare const MAX_LINES = 100000;
|
|
91
|
+
declare const MAX_DIFF_EDIT_DISTANCE = 10000;
|
|
92
|
+
declare const MAX_DIFF_ITERATION_FACTOR = 1000;
|
|
93
|
+
declare const MAX_DIFF_LINES = 50000;
|
|
94
|
+
declare function splitLines(bytes: Uint8Array): ReadonlyArray<Uint8Array>;
|
|
95
|
+
declare function isBinary(bytes: Uint8Array): boolean;
|
|
96
|
+
declare function diffLines(ours: Uint8Array, theirs: Uint8Array, options?: LineDiffOptions): LineDiff;
|
|
97
|
+
|
|
98
|
+
interface MergeAbortResult {
|
|
99
|
+
/** The commit `ORIG_HEAD` recorded; HEAD now points at this id. */
|
|
100
|
+
readonly origHead: ObjectId;
|
|
101
|
+
/** The branch HEAD is on (always defined — detached merges are rejected upstream). */
|
|
102
|
+
readonly branch: RefName;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Abort a conflicting merge. Restores the working tree, index, and branch
|
|
106
|
+
* ref to `ORIG_HEAD`, then clears `MERGE_HEAD` and `MERGE_MSG`. `ORIG_HEAD`
|
|
107
|
+
* is preserved on disk as a cross-operation recovery aid (ADR-173).
|
|
108
|
+
*
|
|
109
|
+
* Refuses when no merge is in progress (`MERGE_HEAD` absent) or when the
|
|
110
|
+
* merge state is incomplete (`ORIG_HEAD` absent — corrupt half-state).
|
|
111
|
+
*
|
|
112
|
+
* The hard-reset machinery is inlined rather than delegated to `reset` so
|
|
113
|
+
* the call can bypass `assertNoPendingOperation` (which would itself
|
|
114
|
+
* fire on the very `MERGE_HEAD` we're about to clear). See ADR-170.
|
|
115
|
+
*/
|
|
116
|
+
declare const mergeAbort: (ctx: Context) => Promise<MergeAbortResult>;
|
|
117
|
+
|
|
118
|
+
interface AddOptions {
|
|
119
|
+
readonly force?: boolean;
|
|
120
|
+
readonly all?: boolean;
|
|
121
|
+
}
|
|
122
|
+
interface AddResult {
|
|
123
|
+
readonly added: ReadonlyArray<FilePath>;
|
|
124
|
+
readonly modified: ReadonlyArray<FilePath>;
|
|
125
|
+
readonly removed: ReadonlyArray<FilePath>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Stage paths in the index. Two modes:
|
|
129
|
+
*
|
|
130
|
+
* - **Literal-path mode** (`paths` non-empty, `all` falsy): every path is
|
|
131
|
+
* validated, read, hashed, and staged. Missing paths reject the whole call.
|
|
132
|
+
* - **Bulk mode** (`paths` empty, `all === true`): walk the working tree,
|
|
133
|
+
* stage every modified/new tracked file plus every untracked, non-ignored
|
|
134
|
+
* file. Files missing from disk but present in the prior index land in
|
|
135
|
+
* `removed`. `.git` and embedded repositories are skipped.
|
|
136
|
+
*
|
|
137
|
+
* Both modes acquire `.git/index.lock` once, read the existing index under
|
|
138
|
+
* the lock, and commit a single replacement — no partial writes.
|
|
139
|
+
*/
|
|
140
|
+
declare const add: (ctx: Context, paths: ReadonlyArray<string>, opts?: AddOptions) => Promise<AddResult>;
|
|
141
|
+
|
|
142
|
+
/** One entry in an archive export — path, raw git mode, object id, and optional content. */
|
|
143
|
+
interface ArchiveEntry {
|
|
144
|
+
/** Repo-relative path of this entry (slash-joined, pre-order). */
|
|
145
|
+
readonly path: FilePath;
|
|
146
|
+
/** Raw git mode exactly as stored in the tree object. */
|
|
147
|
+
readonly mode: FileMode;
|
|
148
|
+
/** Object id of this entry (blob, tree, or gitlink commit oid). */
|
|
149
|
+
readonly oid: ObjectId;
|
|
150
|
+
/**
|
|
151
|
+
* Raw blob bytes. Present only for regular, exec, and symlink entries
|
|
152
|
+
* (symlink: the link-target bytes). Absent for directory and gitlink
|
|
153
|
+
* entries — serializer-side framing decides how those are encoded.
|
|
154
|
+
*/
|
|
155
|
+
readonly content?: Uint8Array;
|
|
156
|
+
}
|
|
157
|
+
/** Structured result of `archive` — resolved tree metadata + lazy entry stream. */
|
|
158
|
+
interface ArchiveResult {
|
|
159
|
+
/** The resolved tree object id that was exported. */
|
|
160
|
+
readonly tree: ObjectId;
|
|
161
|
+
/**
|
|
162
|
+
* Peeled commit oid. Present when the treeish resolved through a commit
|
|
163
|
+
* (direct or via an annotated tag). Absent for a bare tree treeish.
|
|
164
|
+
*/
|
|
165
|
+
readonly commit?: ObjectId;
|
|
166
|
+
/**
|
|
167
|
+
* Committer epoch seconds. Present when `commit` is present. Used by
|
|
168
|
+
* serializers as the default mtime for archive entries.
|
|
169
|
+
*/
|
|
170
|
+
readonly commitTime?: number;
|
|
171
|
+
/** Lazy entry stream — blob bytes are hydrated per-entry, not upfront. */
|
|
172
|
+
readonly entries: AsyncIterable<ArchiveEntry>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Options for the `archive` command. */
|
|
176
|
+
interface ArchiveOptions {
|
|
177
|
+
/**
|
|
178
|
+
* Tree-ish to export (branch name, tag, commit oid, tree oid …).
|
|
179
|
+
* Required — `git archive` refuses with no argument.
|
|
180
|
+
*/
|
|
181
|
+
readonly treeish: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Resolve a tree-ish and return a structured entry stream — the data equivalent
|
|
185
|
+
* of `git archive`. No tar/zip bytes are produced here; serializers are separate
|
|
186
|
+
* pure functions that consume an `ArchiveResult`.
|
|
187
|
+
*
|
|
188
|
+
* Refusal conditions (thrown, never mid-stream):
|
|
189
|
+
* - `NOT_A_REPOSITORY`: `ctx` does not point at a git repository.
|
|
190
|
+
* - Unborn HEAD or unresolvable expression: propagated from `revParse`.
|
|
191
|
+
* - `UNEXPECTED_OBJECT_TYPE`: treeish resolves to a blob, not a tree/commit/tag.
|
|
192
|
+
*/
|
|
193
|
+
declare function archive(ctx: Context, opts: ArchiveOptions): Promise<ArchiveResult>;
|
|
194
|
+
|
|
195
|
+
interface BlameOptions {
|
|
196
|
+
/** Commit-ish to blame as-of (default: HEAD). Mutually exclusive with `worktree`. */
|
|
197
|
+
readonly rev?: string;
|
|
198
|
+
/**
|
|
199
|
+
* Blame the working-tree content instead of a committed revision (git's bare
|
|
200
|
+
* `git blame <file>`): lines matching the committed history blame to their real
|
|
201
|
+
* commits, uncommitted lines to the "Not Committed Yet" pseudo-commit
|
|
202
|
+
* (`committed: false`). Mutually exclusive with `rev`; requires a working tree.
|
|
203
|
+
*/
|
|
204
|
+
readonly worktree?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Restrict the reported lines to a 1-based inclusive `[start, end]` window over
|
|
207
|
+
* the final file (git's `-L`). `end` past the last line is clamped; a start
|
|
208
|
+
* below 1, a start past the last line, or an inverted/non-integer range refuse.
|
|
209
|
+
*/
|
|
210
|
+
readonly range?: {
|
|
211
|
+
readonly start: number;
|
|
212
|
+
readonly end: number;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/** Fields shared by every blamed line, committed or not. */
|
|
216
|
+
interface BlameLineBase {
|
|
217
|
+
/** 1-based line number in the queried file. */
|
|
218
|
+
readonly finalLine: number;
|
|
219
|
+
/** 1-based line number in the originating blob (the queried-file position for an uncommitted line). */
|
|
220
|
+
readonly sourceLine: number;
|
|
221
|
+
/** Path the file had in the originating version — rename-aware. */
|
|
222
|
+
readonly sourcePath: FilePath;
|
|
223
|
+
/** Where the committed base lives; absent for a staged-new file (not in HEAD). */
|
|
224
|
+
readonly previous?: {
|
|
225
|
+
readonly commit: ObjectId;
|
|
226
|
+
readonly path: FilePath;
|
|
227
|
+
};
|
|
228
|
+
/** The line's bytes (newline-terminated except a final line without a trailing LF). */
|
|
229
|
+
readonly content: Uint8Array;
|
|
230
|
+
}
|
|
231
|
+
/** A line blamed to a real commit. */
|
|
232
|
+
interface CommittedBlameLine extends BlameLineBase {
|
|
233
|
+
readonly committed: true;
|
|
234
|
+
/** Commit this line is blamed to. */
|
|
235
|
+
readonly commit: ObjectId;
|
|
236
|
+
readonly author: AuthorIdentity;
|
|
237
|
+
readonly committer: AuthorIdentity;
|
|
238
|
+
/** Commit subject (first message line). */
|
|
239
|
+
readonly summary: string;
|
|
240
|
+
/** Blamed commit is a root (no parents). */
|
|
241
|
+
readonly boundary: boolean;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* A line not yet committed — git's zero-oid "Not Committed Yet" pseudo-commit.
|
|
245
|
+
* The library emits none of git's fabricated oid / identity / timestamp / summary
|
|
246
|
+
* (those are the caller's to render); `committed: false` losslessly signals it.
|
|
247
|
+
*/
|
|
248
|
+
interface UncommittedBlameLine extends BlameLineBase {
|
|
249
|
+
readonly committed: false;
|
|
250
|
+
}
|
|
251
|
+
type BlameLine = CommittedBlameLine | UncommittedBlameLine;
|
|
252
|
+
interface BlameResult {
|
|
253
|
+
/** The queried path (final name). */
|
|
254
|
+
readonly path: FilePath;
|
|
255
|
+
readonly lines: ReadonlyArray<BlameLine>;
|
|
256
|
+
}
|
|
257
|
+
declare const blame: (ctx: Context, path: string, opts?: BlameOptions) => Promise<BlameResult>;
|
|
258
|
+
|
|
259
|
+
interface BranchInfo {
|
|
260
|
+
readonly name: RefName;
|
|
261
|
+
readonly id: ObjectId;
|
|
262
|
+
readonly current: boolean;
|
|
263
|
+
}
|
|
264
|
+
interface BranchListResult {
|
|
265
|
+
readonly branches: ReadonlyArray<BranchInfo>;
|
|
266
|
+
}
|
|
267
|
+
interface BranchCreateInput {
|
|
268
|
+
readonly name: string;
|
|
269
|
+
readonly startPoint?: string;
|
|
270
|
+
readonly force?: boolean;
|
|
271
|
+
}
|
|
272
|
+
interface BranchCreateResult {
|
|
273
|
+
readonly name: RefName;
|
|
274
|
+
readonly id: ObjectId;
|
|
275
|
+
}
|
|
276
|
+
interface BranchDeleteInput {
|
|
277
|
+
readonly name: string;
|
|
278
|
+
readonly force?: boolean;
|
|
279
|
+
}
|
|
280
|
+
interface BranchDeleteResult {
|
|
281
|
+
readonly name: RefName;
|
|
282
|
+
}
|
|
283
|
+
interface BranchRenameInput {
|
|
284
|
+
readonly from: string;
|
|
285
|
+
readonly to: string;
|
|
286
|
+
readonly force?: boolean;
|
|
287
|
+
}
|
|
288
|
+
interface BranchRenameResult {
|
|
289
|
+
readonly from: RefName;
|
|
290
|
+
readonly to: RefName;
|
|
291
|
+
}
|
|
292
|
+
declare const branchList: (ctx: Context) => Promise<BranchListResult>;
|
|
293
|
+
declare const branchCreate: (ctx: Context, input: BranchCreateInput) => Promise<BranchCreateResult>;
|
|
294
|
+
declare const branchDelete: (ctx: Context, input: BranchDeleteInput) => Promise<BranchDeleteResult>;
|
|
295
|
+
declare const branchRename: (ctx: Context, input: BranchRenameInput) => Promise<BranchRenameResult>;
|
|
296
|
+
|
|
297
|
+
type BundleRevArg = {
|
|
298
|
+
readonly tip: string;
|
|
299
|
+
} | {
|
|
300
|
+
readonly exclude: string;
|
|
301
|
+
} | {
|
|
302
|
+
readonly range: readonly [string, string];
|
|
303
|
+
} | {
|
|
304
|
+
readonly symmetricRange: readonly [string, string];
|
|
305
|
+
};
|
|
306
|
+
interface BundleCreateOptions {
|
|
307
|
+
readonly revs?: ReadonlyArray<BundleRevArg>;
|
|
308
|
+
readonly all?: boolean;
|
|
309
|
+
readonly branches?: boolean;
|
|
310
|
+
readonly tags?: boolean;
|
|
311
|
+
}
|
|
312
|
+
interface BundleCreateResult {
|
|
313
|
+
readonly version: BundleVersion;
|
|
314
|
+
readonly bytes: Uint8Array;
|
|
315
|
+
readonly refs: ReadonlyArray<BundleRef>;
|
|
316
|
+
readonly prerequisites: ReadonlyArray<BundlePrerequisite>;
|
|
317
|
+
readonly objectCount: number;
|
|
318
|
+
readonly packSha: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Produces a v2 git bundle — the full object closure for the given rev
|
|
322
|
+
* selection plus the structured header metadata.
|
|
323
|
+
*
|
|
324
|
+
* Returns `bytes` (header ++ packfile) for the caller to write, alongside
|
|
325
|
+
* the structured metadata so the caller can inspect the result without
|
|
326
|
+
* re-parsing. Throws `BUNDLE_EMPTY` if the selection yields no ref lines
|
|
327
|
+
* (`reason: 'no-refs'`) or an empty object closure (`reason: 'no-objects'`).
|
|
328
|
+
*/
|
|
329
|
+
declare const bundleCreate: (ctx: Context, opts: BundleCreateOptions) => Promise<BundleCreateResult>;
|
|
330
|
+
|
|
331
|
+
interface BundleListHeadsInput {
|
|
332
|
+
readonly path: string;
|
|
333
|
+
readonly names?: ReadonlyArray<RefName>;
|
|
334
|
+
}
|
|
335
|
+
interface BundleListHeadsResult {
|
|
336
|
+
readonly version: BundleVersion;
|
|
337
|
+
readonly refs: ReadonlyArray<BundleRef>;
|
|
338
|
+
}
|
|
339
|
+
declare const bundleListHeads: (ctx: Context, input: BundleListHeadsInput) => Promise<BundleListHeadsResult>;
|
|
340
|
+
|
|
341
|
+
interface BundleVerifyInput {
|
|
342
|
+
readonly path: string;
|
|
343
|
+
}
|
|
344
|
+
interface BundleVerifyResult {
|
|
345
|
+
readonly version: BundleVersion;
|
|
346
|
+
readonly hashAlgorithm: BundleHashAlgorithm;
|
|
347
|
+
readonly refs: ReadonlyArray<BundleRef>;
|
|
348
|
+
readonly prerequisites: ReadonlyArray<BundlePrerequisite>;
|
|
349
|
+
readonly missingPrerequisites: ReadonlyArray<ObjectId>;
|
|
350
|
+
readonly prerequisitesPresent: boolean;
|
|
351
|
+
readonly recordsCompleteHistory: boolean;
|
|
352
|
+
}
|
|
353
|
+
declare const bundleVerify: (ctx: Context, input: BundleVerifyInput) => Promise<BundleVerifyResult>;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Tier-1 `catFile` command — wraps the streaming `catFileBatch` primitive in
|
|
357
|
+
* a request/response shape matching the other v2 commands (`submodules`,
|
|
358
|
+
* `log`, `reflog`). String ids are coerced at the boundary via
|
|
359
|
+
* `ObjectId.from`, which throws `INVALID_OBJECT_ID` on malformed input
|
|
360
|
+
* before any read happens.
|
|
361
|
+
*
|
|
362
|
+
* For streaming use cases, callers reach for `repo.primitives.catFileBatch`
|
|
363
|
+
* directly — see `docs/design/cat-file-batch.md` §2.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
interface CatFileInput {
|
|
367
|
+
readonly ids: ReadonlyArray<ObjectId | string>;
|
|
368
|
+
/** Per-object byte cap; forwarded to the underlying `readObject` call. */
|
|
369
|
+
readonly maxBytes?: number;
|
|
370
|
+
}
|
|
371
|
+
interface CatFileResult {
|
|
372
|
+
readonly kind: 'batch';
|
|
373
|
+
readonly entries: ReadonlyArray<CatFileBatchEntry>;
|
|
374
|
+
}
|
|
375
|
+
declare const catFile: (ctx: Context, opts: CatFileInput) => Promise<CatFileResult>;
|
|
376
|
+
|
|
377
|
+
interface CheckoutSwitchOptions {
|
|
378
|
+
readonly rev: string;
|
|
379
|
+
readonly detach?: boolean;
|
|
380
|
+
readonly force?: boolean;
|
|
381
|
+
}
|
|
382
|
+
interface CheckoutPathsOptions {
|
|
383
|
+
readonly paths: ReadonlyArray<string>;
|
|
384
|
+
readonly source?: 'index' | 'HEAD' | ObjectId;
|
|
385
|
+
}
|
|
386
|
+
type CheckoutOptions = CheckoutSwitchOptions | CheckoutPathsOptions;
|
|
387
|
+
interface CheckoutResult {
|
|
388
|
+
readonly branch: RefName | undefined;
|
|
389
|
+
readonly id: ObjectId;
|
|
390
|
+
readonly detached: boolean;
|
|
391
|
+
readonly changedPaths: number;
|
|
392
|
+
}
|
|
393
|
+
declare const checkout: (ctx: Context, opts: CheckoutOptions) => Promise<CheckoutResult>;
|
|
394
|
+
|
|
395
|
+
interface CherryPickRunInput {
|
|
396
|
+
/** Revisions to pick, in argument order — a commit-ish or an `A..B` range each. */
|
|
397
|
+
readonly commits: ReadonlyArray<string>;
|
|
398
|
+
/** -x: append `(cherry picked from commit <oid>)` to each commit message. */
|
|
399
|
+
readonly recordOrigin?: boolean;
|
|
400
|
+
/** --allow-empty: a redundant pick creates an empty commit instead of stopping. */
|
|
401
|
+
readonly allowEmpty?: boolean;
|
|
402
|
+
/** -n / --no-commit: apply each pick to the index + working tree only; never
|
|
403
|
+
* commit, never persist CHERRY_PICK_HEAD / sequencer state. */
|
|
404
|
+
readonly noCommit?: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface CherryPickedCommit {
|
|
407
|
+
readonly source: ObjectId;
|
|
408
|
+
readonly created: ObjectId;
|
|
409
|
+
}
|
|
410
|
+
interface CherryPickConflict {
|
|
411
|
+
readonly path: FilePath;
|
|
412
|
+
readonly type: ConflictType;
|
|
413
|
+
}
|
|
414
|
+
type CherryPickResult = {
|
|
415
|
+
readonly kind: 'picked';
|
|
416
|
+
readonly commits: ReadonlyArray<CherryPickedCommit>;
|
|
417
|
+
} | {
|
|
418
|
+
readonly kind: 'no-commit';
|
|
419
|
+
readonly sources: ReadonlyArray<ObjectId>;
|
|
420
|
+
} | {
|
|
421
|
+
readonly kind: 'conflict';
|
|
422
|
+
readonly commit: ObjectId;
|
|
423
|
+
readonly conflicts: ReadonlyArray<CherryPickConflict>;
|
|
424
|
+
readonly remaining: number;
|
|
425
|
+
} | {
|
|
426
|
+
readonly kind: 'empty';
|
|
427
|
+
readonly commit: ObjectId;
|
|
428
|
+
readonly remaining: number;
|
|
429
|
+
};
|
|
430
|
+
declare const cherryPickRun: (ctx: Context, input: CherryPickRunInput) => Promise<CherryPickResult>;
|
|
431
|
+
interface CherryPickContinueInput {
|
|
432
|
+
/** --allow-empty: finalise a resolution that yields no change as an empty commit. */
|
|
433
|
+
readonly allowEmpty?: boolean;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Finalise the in-progress conflicted pick as a single-parent commit from the
|
|
437
|
+
* resolved index, then resume any remaining sequencer picks. Refuses when nothing
|
|
438
|
+
* is in progress or the index is unmerged. A no-change resolution re-stops empty.
|
|
439
|
+
*/
|
|
440
|
+
declare const cherryPickContinue: (ctx: Context, input?: CherryPickContinueInput) => Promise<CherryPickResult>;
|
|
441
|
+
interface CherryPickAbortResult {
|
|
442
|
+
readonly head: ObjectId;
|
|
443
|
+
readonly branch: RefName;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Drop the in-progress pick: hard-reset to HEAD (discarding its half-applied
|
|
447
|
+
* state), then resume the remaining sequencer picks (if any).
|
|
448
|
+
*/
|
|
449
|
+
declare const cherryPickSkip: (ctx: Context, input?: CherryPickContinueInput) => Promise<CherryPickResult>;
|
|
450
|
+
/**
|
|
451
|
+
* Abort the cherry-pick: hard-reset the working tree, index, and branch to the
|
|
452
|
+
* pre-sequence HEAD (sequencer `head`, or the current HEAD for a lone pick), and
|
|
453
|
+
* clear all state. The branch update records git's faithful
|
|
454
|
+
* `reset: moving to <oid>` reflog. Refuses when nothing is in progress.
|
|
455
|
+
*/
|
|
456
|
+
declare const cherryPickAbort: (ctx: Context) => Promise<CherryPickAbortResult>;
|
|
457
|
+
|
|
458
|
+
interface CloneOptions {
|
|
459
|
+
readonly url: string;
|
|
460
|
+
readonly bare?: boolean;
|
|
461
|
+
readonly initialBranch?: string;
|
|
462
|
+
/**
|
|
463
|
+
* Shallow clone depth. When set, sends `deepen N` and persists the
|
|
464
|
+
* resulting shallow boundaries to `.git/shallow`.
|
|
465
|
+
*/
|
|
466
|
+
readonly depth?: number;
|
|
467
|
+
/**
|
|
468
|
+
* Partial-clone object filter (`blob:none`, `blob:limit=<n>`, `tree:<n>`).
|
|
469
|
+
* When set, the server omits the filtered objects, a promisor remote is
|
|
470
|
+
* recorded in `.git/config`, and omitted objects are lazy-fetched on read.
|
|
471
|
+
*/
|
|
472
|
+
readonly filter?: string;
|
|
473
|
+
}
|
|
474
|
+
interface CloneResult {
|
|
475
|
+
readonly path: FilePath;
|
|
476
|
+
readonly head: RefName | undefined;
|
|
477
|
+
readonly fetchedRefs: ReadonlyArray<{
|
|
478
|
+
readonly name: RefName;
|
|
479
|
+
readonly id: ObjectId;
|
|
480
|
+
}>;
|
|
481
|
+
}
|
|
482
|
+
declare const clone: (ctx: Context, opts: CloneOptions) => Promise<CloneResult>;
|
|
483
|
+
|
|
484
|
+
interface CommitOptions {
|
|
485
|
+
readonly message: string;
|
|
486
|
+
readonly author?: AuthorIdentity;
|
|
487
|
+
readonly committer?: AuthorIdentity;
|
|
488
|
+
readonly allowEmpty?: boolean;
|
|
489
|
+
readonly allowEmptyMessage?: boolean;
|
|
490
|
+
/** Skip the `pre-commit` and `commit-msg` hooks (git's `--no-verify`). */
|
|
491
|
+
readonly noVerify?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Sign the commit (git's `-S`). Tri-state against `commit.gpgsign`: an
|
|
494
|
+
* explicit `true`/`false` here always wins; leaving it `undefined` falls
|
|
495
|
+
* back to `commit.gpgsign` from config.
|
|
496
|
+
*/
|
|
497
|
+
readonly sign?: boolean;
|
|
498
|
+
/** Signing key/identity override (git's `-S<keyid>`); falls back to `user.signingKey`. */
|
|
499
|
+
readonly signKey?: string;
|
|
500
|
+
}
|
|
501
|
+
interface CommitResult {
|
|
502
|
+
readonly id: ObjectId;
|
|
503
|
+
readonly tree: ObjectId;
|
|
504
|
+
readonly branch: RefName | undefined;
|
|
505
|
+
readonly parents: ReadonlyArray<ObjectId>;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Create a new commit from the current index. Resolves author/committer from
|
|
509
|
+
* options or `.git/config` `[user]`, writes a tree from the index, builds the
|
|
510
|
+
* commit object, and updates HEAD's target ref (or detached HEAD itself).
|
|
511
|
+
*
|
|
512
|
+
* Throws `NOTHING_TO_COMMIT` when the new tree matches the parent's tree and
|
|
513
|
+
* `allowEmpty` is not set; `EMPTY_COMMIT_MESSAGE` when the message is blank
|
|
514
|
+
* and `allowEmptyMessage` is not set.
|
|
515
|
+
*/
|
|
516
|
+
declare const commit: (ctx: Context, opts: CommitOptions) => Promise<CommitResult>;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* `repo.config.*` porcelain — nested-namespace shape per ADR-181. The methods
|
|
520
|
+
* exported here are the Context-aware functions the namespace dispatcher in
|
|
521
|
+
* `repository.ts` binds; `repo.config.get(input)` is roughly
|
|
522
|
+
* `configGet(repo.ctx, input)`.
|
|
523
|
+
*
|
|
524
|
+
* Each command:
|
|
525
|
+
* 1. asserts the context targets a repository,
|
|
526
|
+
* 2. parses + validates inputs at the command boundary,
|
|
527
|
+
* 3. composes the slice-7 readers / slice-8/9 writers,
|
|
528
|
+
* 4. returns a typed result envelope (per-action shape, no discriminator).
|
|
529
|
+
*/
|
|
530
|
+
|
|
531
|
+
interface ConfigGetInput {
|
|
532
|
+
readonly key: string;
|
|
533
|
+
readonly scope?: ConfigScope;
|
|
534
|
+
}
|
|
535
|
+
type ConfigGetResult = {
|
|
536
|
+
readonly key: ConfigKey;
|
|
537
|
+
readonly value: string | null;
|
|
538
|
+
readonly scope: ConfigScope;
|
|
539
|
+
} | {
|
|
540
|
+
readonly key: ConfigKey;
|
|
541
|
+
readonly value: undefined;
|
|
542
|
+
};
|
|
543
|
+
declare const configGet: (ctx: Context, input: ConfigGetInput) => Promise<ConfigGetResult>;
|
|
544
|
+
interface ConfigGetAllInput {
|
|
545
|
+
readonly key: string;
|
|
546
|
+
readonly scope?: ConfigScope;
|
|
547
|
+
}
|
|
548
|
+
interface ConfigGetAllResult {
|
|
549
|
+
readonly key: ConfigKey;
|
|
550
|
+
readonly values: ReadonlyArray<{
|
|
551
|
+
readonly value: string | null;
|
|
552
|
+
readonly scope: ConfigScope;
|
|
553
|
+
}>;
|
|
554
|
+
}
|
|
555
|
+
declare const configGetAll: (ctx: Context, input: ConfigGetAllInput) => Promise<ConfigGetAllResult>;
|
|
556
|
+
interface ConfigGetRegexpInput {
|
|
557
|
+
readonly keyPattern: RegExp;
|
|
558
|
+
readonly valuePattern?: RegExp;
|
|
559
|
+
readonly scope?: ConfigScope;
|
|
560
|
+
}
|
|
561
|
+
interface ConfigEntryView {
|
|
562
|
+
readonly key: ConfigKey;
|
|
563
|
+
/** `null` means the entry is present with no `=` (git's internal NULL). */
|
|
564
|
+
readonly value: string | null;
|
|
565
|
+
readonly scope: ConfigScope;
|
|
566
|
+
}
|
|
567
|
+
interface ConfigGetRegexpResult {
|
|
568
|
+
readonly entries: ReadonlyArray<ConfigEntryView>;
|
|
569
|
+
}
|
|
570
|
+
declare const configGetRegexp: (ctx: Context, input: ConfigGetRegexpInput) => Promise<ConfigGetRegexpResult>;
|
|
571
|
+
interface ConfigListInput {
|
|
572
|
+
readonly scope?: ConfigScope;
|
|
573
|
+
}
|
|
574
|
+
interface ConfigListResult {
|
|
575
|
+
readonly entries: ReadonlyArray<ConfigEntryView>;
|
|
576
|
+
}
|
|
577
|
+
declare const configList: (ctx: Context, input?: ConfigListInput) => Promise<ConfigListResult>;
|
|
578
|
+
interface ConfigSetInput {
|
|
579
|
+
readonly key: string;
|
|
580
|
+
readonly value: string;
|
|
581
|
+
readonly scope?: ConfigScope;
|
|
582
|
+
}
|
|
583
|
+
interface ConfigSetResult {
|
|
584
|
+
readonly key: ConfigKey;
|
|
585
|
+
readonly value: string;
|
|
586
|
+
readonly scope: ConfigScope;
|
|
587
|
+
}
|
|
588
|
+
declare const configSet: (ctx: Context, input: ConfigSetInput) => Promise<ConfigSetResult>;
|
|
589
|
+
interface ConfigUnsetInput {
|
|
590
|
+
readonly key: string;
|
|
591
|
+
readonly scope?: ConfigScope;
|
|
592
|
+
}
|
|
593
|
+
type ConfigUnsetResult = {
|
|
594
|
+
readonly key: ConfigKey;
|
|
595
|
+
readonly scope: ConfigScope;
|
|
596
|
+
readonly removed: true;
|
|
597
|
+
/** The value that was removed. `null` when the entry had no `=`. */
|
|
598
|
+
readonly previousValue: string | null;
|
|
599
|
+
} | {
|
|
600
|
+
readonly key: ConfigKey;
|
|
601
|
+
readonly scope: ConfigScope;
|
|
602
|
+
readonly removed: false;
|
|
603
|
+
};
|
|
604
|
+
declare const configUnset: (ctx: Context, input: ConfigUnsetInput) => Promise<ConfigUnsetResult>;
|
|
605
|
+
interface ConfigUnsetAllInput {
|
|
606
|
+
readonly key: string;
|
|
607
|
+
readonly scope?: ConfigScope;
|
|
608
|
+
}
|
|
609
|
+
interface ConfigUnsetAllResult {
|
|
610
|
+
readonly key: ConfigKey;
|
|
611
|
+
readonly scope: ConfigScope;
|
|
612
|
+
readonly removed: number;
|
|
613
|
+
}
|
|
614
|
+
declare const configUnsetAll: (ctx: Context, input: ConfigUnsetAllInput) => Promise<ConfigUnsetAllResult>;
|
|
615
|
+
interface ConfigRenameSectionInput {
|
|
616
|
+
readonly oldName: string;
|
|
617
|
+
readonly newName: string;
|
|
618
|
+
readonly scope?: ConfigScope;
|
|
619
|
+
}
|
|
620
|
+
interface ConfigRenameSectionResult {
|
|
621
|
+
readonly oldName: string;
|
|
622
|
+
readonly newName: string;
|
|
623
|
+
readonly scope: ConfigScope;
|
|
624
|
+
}
|
|
625
|
+
declare const configRenameSection: (ctx: Context, input: ConfigRenameSectionInput) => Promise<ConfigRenameSectionResult>;
|
|
626
|
+
interface ConfigRemoveSectionInput {
|
|
627
|
+
readonly name: string;
|
|
628
|
+
readonly scope?: ConfigScope;
|
|
629
|
+
}
|
|
630
|
+
interface ConfigRemoveSectionResult {
|
|
631
|
+
readonly name: string;
|
|
632
|
+
readonly scope: ConfigScope;
|
|
633
|
+
}
|
|
634
|
+
declare const configRemoveSection: (ctx: Context, input: ConfigRemoveSectionInput) => Promise<ConfigRemoveSectionResult>;
|
|
635
|
+
|
|
636
|
+
interface MergeContinueInput {
|
|
637
|
+
/** Override `MERGE_MSG`. Empty/undefined falls back to the draft. */
|
|
638
|
+
readonly message?: string;
|
|
639
|
+
/** Forwarded to commit. */
|
|
640
|
+
readonly author?: AuthorIdentity;
|
|
641
|
+
readonly committer?: AuthorIdentity;
|
|
642
|
+
/** Skip the `pre-commit` and `commit-msg` hooks (git's `--no-verify`). */
|
|
643
|
+
readonly noVerify?: boolean;
|
|
644
|
+
}
|
|
645
|
+
type MergeContinueResult = CommitResult;
|
|
646
|
+
/**
|
|
647
|
+
* Finalise a conflicting merge as a merge commit. Asserts a merge is in
|
|
648
|
+
* progress, then delegates to `commit` — which already reads
|
|
649
|
+
* `MERGE_HEAD` for the second parent, falls back to `MERGE_MSG` when the
|
|
650
|
+
* message is empty, runs hooks, and clears merge state on success
|
|
651
|
+
* (ADR-174).
|
|
652
|
+
*
|
|
653
|
+
* Refuses when no merge is in progress (`MERGE_HEAD` absent). Refuses
|
|
654
|
+
* (via `commit`) when the index still has stage-1/2/3 entries.
|
|
655
|
+
*/
|
|
656
|
+
declare const mergeContinue: (ctx: Context, opts?: MergeContinueInput) => Promise<MergeContinueResult>;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Pure value types for `name-rev`'s reverse-reachability naming. No I/O, no
|
|
660
|
+
* rendering. A commit's name is the chosen ref plus an ordered path down to it
|
|
661
|
+
* via git's `~` (first-parent) / `^` (n-th parent) notation.
|
|
662
|
+
*/
|
|
663
|
+
|
|
664
|
+
/** One segment of a name-rev path: `~count` (first-parent run) or `^number` (n-th parent). */
|
|
665
|
+
type NameRevStep = {
|
|
666
|
+
readonly kind: 'ancestor';
|
|
667
|
+
readonly count: number;
|
|
668
|
+
} | {
|
|
669
|
+
readonly kind: 'parent';
|
|
670
|
+
readonly number: number;
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Tier-1 `name-rev` command — git's `git name-rev`: name a commit by the nearest
|
|
675
|
+
* ref that **contains** it (a descendant-or-self ref), via a reverse-reachability
|
|
676
|
+
* flood down from every qualifying ref (ADRs 283–285). Returns structured data
|
|
677
|
+
* only: the chosen ref (full name), whether it is an annotated tag (the `^0`
|
|
678
|
+
* peel), and the ordered `~`/`^` navigation steps. The library renders no name
|
|
679
|
+
* string and abbreviates no ref — assembling `tags/v2.0~3^2~1` is the caller's.
|
|
680
|
+
*/
|
|
681
|
+
|
|
682
|
+
interface NameRevOptions {
|
|
683
|
+
/** Restrict the naming sources to tags (`refs/tags/*`). */
|
|
684
|
+
readonly tags?: boolean;
|
|
685
|
+
/** Full-refname globs a ref must match to be a naming source (`*`/`?` cross `/`). */
|
|
686
|
+
readonly refs?: string | ReadonlyArray<string>;
|
|
687
|
+
/** Full-refname globs that drop a ref from the naming sources. */
|
|
688
|
+
readonly exclude?: string | ReadonlyArray<string>;
|
|
689
|
+
}
|
|
690
|
+
interface NameRevResult {
|
|
691
|
+
/** Full 40-hex oid of the named commit. */
|
|
692
|
+
readonly oid: ObjectId;
|
|
693
|
+
/** Naming ref (full name, e.g. `refs/tags/v1.0`); `undefined` when unnameable. */
|
|
694
|
+
readonly ref: RefName | undefined;
|
|
695
|
+
/** `true` when the ref is an annotated tag (the caller renders `^0` at the tip). */
|
|
696
|
+
readonly tagDeref: boolean;
|
|
697
|
+
/** Navigation from the ref's commit down to `oid` (`~count` / `^number`). */
|
|
698
|
+
readonly steps: ReadonlyArray<NameRevStep>;
|
|
699
|
+
}
|
|
700
|
+
declare const nameRev: (ctx: Context, rev?: string, opts?: NameRevOptions) => Promise<NameRevResult>;
|
|
701
|
+
|
|
702
|
+
interface DescribeOptions {
|
|
703
|
+
/** Include lightweight tags (priority ≥ 1), not just annotated ones. */
|
|
704
|
+
readonly tags?: boolean;
|
|
705
|
+
/** Consider every ref (branches, remotes; priority 0), not only tags. */
|
|
706
|
+
readonly all?: boolean;
|
|
707
|
+
/** Always emit a result even when no tag matches, falling back to the oid. */
|
|
708
|
+
readonly always?: boolean;
|
|
709
|
+
/** Only an exact tag on the target counts (≡ `candidates: 0`). */
|
|
710
|
+
readonly exactMatch?: boolean;
|
|
711
|
+
/** Maximum tags considered during the search. Default 10. */
|
|
712
|
+
readonly candidates?: number;
|
|
713
|
+
/** Follow only first parents through merges. */
|
|
714
|
+
readonly firstParent?: boolean;
|
|
715
|
+
/** Short-name globs a tag must match to be considered. */
|
|
716
|
+
readonly match?: string | ReadonlyArray<string>;
|
|
717
|
+
/** Short-name globs that drop a tag from consideration. */
|
|
718
|
+
readonly exclude?: string | ReadonlyArray<string>;
|
|
719
|
+
/** Report whether HEAD's working tree has tracked changes (HEAD only). */
|
|
720
|
+
readonly dirty?: boolean;
|
|
721
|
+
/** Tolerate a working tree whose state can't be read, reporting it dirty. */
|
|
722
|
+
readonly broken?: boolean;
|
|
723
|
+
/** Name the nearest ref that *contains* the commit (delegates to `name-rev`). */
|
|
724
|
+
readonly contains?: boolean;
|
|
725
|
+
}
|
|
726
|
+
interface DescribeResult {
|
|
727
|
+
/** Chosen ref (a tag, or any ref under `all`); `undefined` on the `always` fallback. */
|
|
728
|
+
readonly tag: RefName | undefined;
|
|
729
|
+
/** Describe short-name (`v2.0`, `heads/main`); `''` on the `always` fallback. */
|
|
730
|
+
readonly name: string;
|
|
731
|
+
/** Commits between the chosen ref and the target (`0` when exact). */
|
|
732
|
+
readonly distance: number;
|
|
733
|
+
/** Full 40-hex oid of the described commit; the caller abbreviates it. */
|
|
734
|
+
readonly oid: ObjectId;
|
|
735
|
+
/** `true` when the target itself carries the chosen tag. */
|
|
736
|
+
readonly exact: boolean;
|
|
737
|
+
/** `true` when HEAD's working tree had tracked changes (`dirty`/`broken`). */
|
|
738
|
+
readonly dirty: boolean;
|
|
739
|
+
}
|
|
740
|
+
declare function describe(ctx: Context, rev: string | undefined, opts: DescribeOptions & {
|
|
741
|
+
contains: true;
|
|
742
|
+
}): Promise<NameRevResult>;
|
|
743
|
+
declare function describe(ctx: Context, rev?: string, opts?: DescribeOptions): Promise<DescribeResult>;
|
|
744
|
+
|
|
745
|
+
interface DiffOptions {
|
|
746
|
+
/** Resolve to a tree. Accepts any revision (ref, oid, `HEAD`, `~`/`^` grammar). */
|
|
747
|
+
readonly from?: string;
|
|
748
|
+
readonly to?: string;
|
|
749
|
+
readonly detectRenames?: boolean;
|
|
750
|
+
/** Fine-tune rename detection (limit, threshold). Only used when `detectRenames` is true. */
|
|
751
|
+
readonly renameOptions?: RenameDetectOptions;
|
|
752
|
+
/**
|
|
753
|
+
* Recurse into sub-directories (`git diff-tree -r`), surfacing nested blobs as
|
|
754
|
+
* full-path changes instead of one change per top-level sub-tree. Default `false`.
|
|
755
|
+
*/
|
|
756
|
+
readonly recursive?: boolean;
|
|
757
|
+
/**
|
|
758
|
+
* Attach per-file line counts (`added` / `deleted` / `binary`) to each change —
|
|
759
|
+
* the data half of git's `--numstat`. Off by default (tree-level, no blob reads).
|
|
760
|
+
*/
|
|
761
|
+
readonly withStat?: boolean;
|
|
762
|
+
/**
|
|
763
|
+
* Whitespace-normalization mode for line equality (data mode, not a rendering
|
|
764
|
+
* knob). `'all'` ignores all space/tab; `'change'` ignores amount-only changes;
|
|
765
|
+
* `'at-eol'` ignores trailing whitespace only.
|
|
766
|
+
*/
|
|
767
|
+
readonly ignoreWhitespace?: 'all' | 'change' | 'at-eol';
|
|
768
|
+
/**
|
|
769
|
+
* When `true`, a trailing CR (`\r`) immediately before the line terminator is
|
|
770
|
+
* treated as insignificant (data mode — `git diff --ignore-cr-at-eol`).
|
|
771
|
+
*/
|
|
772
|
+
readonly ignoreCrAtEol?: boolean;
|
|
773
|
+
/**
|
|
774
|
+
* When `true`, change groups consisting solely of blank lines are excluded from
|
|
775
|
+
* added/deleted counts and the drop-pass predicate (data mode —
|
|
776
|
+
* `git diff --ignore-blank-lines`).
|
|
777
|
+
*/
|
|
778
|
+
readonly ignoreBlankLines?: boolean;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Diff two tree-like targets, returning the structured `TreeDiff`. Pass
|
|
782
|
+
* `withStat: true` to attach per-file line counts (a `StatTreeDiff`). Rendering
|
|
783
|
+
* the diff as a unified patch is the caller's concern.
|
|
784
|
+
*/
|
|
785
|
+
declare function diff(ctx: Context, opts: DiffOptions & {
|
|
786
|
+
withStat: true;
|
|
787
|
+
}): Promise<StatTreeDiff>;
|
|
788
|
+
declare function diff(ctx: Context, opts?: DiffOptions): Promise<TreeDiff>;
|
|
789
|
+
|
|
790
|
+
interface FetchOptions {
|
|
791
|
+
/**
|
|
792
|
+
* Remote to fetch from. Default: `branch.<current>.remote` ?? the sole
|
|
793
|
+
* configured remote ?? `'origin'`; detached HEAD skips the branch step.
|
|
794
|
+
*/
|
|
795
|
+
readonly remote?: string;
|
|
796
|
+
readonly refspecs?: ReadonlyArray<string>;
|
|
797
|
+
readonly prune?: boolean;
|
|
798
|
+
/** Shallow clone depth. Delegates to fetchPack's deepen path. */
|
|
799
|
+
readonly depth?: number;
|
|
800
|
+
}
|
|
801
|
+
interface FetchUpdate {
|
|
802
|
+
readonly name: RefName;
|
|
803
|
+
readonly oldId: ObjectId | undefined;
|
|
804
|
+
readonly newId: ObjectId;
|
|
805
|
+
}
|
|
806
|
+
interface FetchResult {
|
|
807
|
+
readonly remote: string;
|
|
808
|
+
readonly url: string;
|
|
809
|
+
readonly updatedRefs: ReadonlyArray<FetchUpdate>;
|
|
810
|
+
/** Refs deleted because the server no longer advertises them (prune semantics). */
|
|
811
|
+
readonly prunedRefs: ReadonlyArray<RefName>;
|
|
812
|
+
/** New shallow boundaries written to `.git/shallow` during this fetch. */
|
|
813
|
+
readonly shallow: ReadonlyArray<ObjectId>;
|
|
814
|
+
/** Commits that crossed the shallow → non-shallow boundary during this fetch. */
|
|
815
|
+
readonly unshallow: ReadonlyArray<ObjectId>;
|
|
816
|
+
}
|
|
817
|
+
declare const fetch: (ctx: Context, opts?: FetchOptions) => Promise<FetchResult>;
|
|
818
|
+
|
|
819
|
+
interface FetchMissingOptions {
|
|
820
|
+
/** Object ids to fetch. Ones already present locally are skipped. */
|
|
821
|
+
readonly oids: ReadonlyArray<ObjectId>;
|
|
822
|
+
}
|
|
823
|
+
interface FetchMissingResult {
|
|
824
|
+
/** The promisor remote the objects were fetched from. */
|
|
825
|
+
readonly remote: string;
|
|
826
|
+
/** Objects the caller asked for. */
|
|
827
|
+
readonly requested: number;
|
|
828
|
+
/** Objects that were missing locally and got fetched. */
|
|
829
|
+
readonly fetched: number;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Fetch the named objects from the repository's promisor remote. Throws
|
|
833
|
+
* `NO_PROMISOR_REMOTE` when the repository is not a partial clone.
|
|
834
|
+
*/
|
|
835
|
+
declare const fetchMissing: (ctx: Context, opts: FetchMissingOptions) => Promise<FetchMissingResult>;
|
|
836
|
+
/**
|
|
837
|
+
* `PromisorRemote` port implementation — the seam `readObject` calls on a
|
|
838
|
+
* miss. A non-partial repository yields `attempted: false` (rather than
|
|
839
|
+
* throwing) so `readObject` falls through to its normal `OBJECT_NOT_FOUND`.
|
|
840
|
+
*/
|
|
841
|
+
declare const createPromisorRemote: (ctx: Context) => PromisorRemote;
|
|
842
|
+
|
|
843
|
+
/** Object kinds the fsck validator operates on. */
|
|
844
|
+
type FsckObjectType = 'commit' | 'blob' | 'tree' | 'tag';
|
|
845
|
+
/**
|
|
846
|
+
* Severity of a catalogue finding.
|
|
847
|
+
* Mirrors git's WARN/ERROR/INFO classes that appear in
|
|
848
|
+
* `warning in …` / `error in …` / `warning in …` (INFO) output.
|
|
849
|
+
*/
|
|
850
|
+
type FsckSeverity = 'error' | 'warning' | 'info';
|
|
851
|
+
|
|
852
|
+
type FsckFinding = {
|
|
853
|
+
readonly type: 'dangling';
|
|
854
|
+
readonly id: ObjectId;
|
|
855
|
+
readonly objectType: FsckObjectType;
|
|
856
|
+
} | {
|
|
857
|
+
readonly type: 'unreachable';
|
|
858
|
+
readonly id: ObjectId;
|
|
859
|
+
readonly objectType: FsckObjectType;
|
|
860
|
+
} | {
|
|
861
|
+
readonly type: 'missing';
|
|
862
|
+
readonly id: ObjectId;
|
|
863
|
+
readonly objectType: FsckObjectType | 'unknown';
|
|
864
|
+
} | {
|
|
865
|
+
readonly type: 'broken-link';
|
|
866
|
+
readonly fromId: ObjectId;
|
|
867
|
+
readonly fromType: FsckObjectType;
|
|
868
|
+
readonly toId: ObjectId;
|
|
869
|
+
readonly toType: FsckObjectType | 'unknown';
|
|
870
|
+
} | {
|
|
871
|
+
readonly type: 'bad-object';
|
|
872
|
+
readonly id: ObjectId;
|
|
873
|
+
/** 'unknown' when the object is undecodable and the type cannot be determined. */
|
|
874
|
+
readonly objectType: FsckObjectType | 'unknown';
|
|
875
|
+
readonly msgId: string;
|
|
876
|
+
readonly severity: FsckSeverity;
|
|
877
|
+
} | {
|
|
878
|
+
readonly type: 'hash-mismatch';
|
|
879
|
+
readonly id: ObjectId;
|
|
880
|
+
readonly actual: ObjectId;
|
|
881
|
+
} | {
|
|
882
|
+
readonly type: 'bad-ref';
|
|
883
|
+
readonly ref: RefName;
|
|
884
|
+
readonly msgId: string;
|
|
885
|
+
readonly severity: FsckSeverity;
|
|
886
|
+
readonly target?: ObjectId;
|
|
887
|
+
} | {
|
|
888
|
+
readonly type: 'root';
|
|
889
|
+
readonly id: ObjectId;
|
|
890
|
+
} | {
|
|
891
|
+
readonly type: 'tagged';
|
|
892
|
+
readonly id: ObjectId;
|
|
893
|
+
readonly objectType: FsckObjectType;
|
|
894
|
+
readonly tagName: string;
|
|
895
|
+
readonly tag: ObjectId;
|
|
896
|
+
};
|
|
897
|
+
interface FsckOptions {
|
|
898
|
+
/** Skip object-content validation, check links only. */
|
|
899
|
+
readonly connectivityOnly?: boolean;
|
|
900
|
+
/** Default true — reflog oids are roots; false to exclude. */
|
|
901
|
+
readonly reflogRoots?: boolean;
|
|
902
|
+
/** Default true — index oids are roots. */
|
|
903
|
+
readonly indexRoot?: boolean;
|
|
904
|
+
/** Default true — include packs. */
|
|
905
|
+
readonly full?: boolean;
|
|
906
|
+
/** WARN-class msg-ids upgraded to ERROR (+exit bit). */
|
|
907
|
+
readonly strict?: boolean;
|
|
908
|
+
/** Default true — run refs-verify pass. */
|
|
909
|
+
readonly checkReferences?: boolean;
|
|
910
|
+
}
|
|
911
|
+
interface FsckResult {
|
|
912
|
+
readonly findings: ReadonlyArray<FsckFinding>;
|
|
913
|
+
/** Composite exit bitmask: 0=clean, 2=missing/broken-link. */
|
|
914
|
+
readonly exitCode: number;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
declare function fsck(ctx: Context, opts?: FsckOptions): Promise<FsckResult>;
|
|
918
|
+
|
|
919
|
+
interface MatchSpan {
|
|
920
|
+
readonly start: number;
|
|
921
|
+
readonly end: number;
|
|
922
|
+
}
|
|
923
|
+
interface GrepFixedPattern {
|
|
924
|
+
readonly fixed: string;
|
|
925
|
+
}
|
|
926
|
+
type GrepPattern = RegExp | GrepFixedPattern;
|
|
927
|
+
interface LineVerdict {
|
|
928
|
+
readonly returned: boolean;
|
|
929
|
+
readonly spans: ReadonlyArray<MatchSpan>;
|
|
930
|
+
}
|
|
931
|
+
interface GrepMatcherOptions {
|
|
932
|
+
readonly wholeWord?: boolean;
|
|
933
|
+
readonly invert?: boolean;
|
|
934
|
+
}
|
|
935
|
+
interface GrepMatcher {
|
|
936
|
+
matchLine(line: Uint8Array): LineVerdict;
|
|
937
|
+
}
|
|
938
|
+
declare function buildGrepMatcher(patterns: ReadonlyArray<GrepPattern>, options?: GrepMatcherOptions): GrepMatcher;
|
|
939
|
+
|
|
940
|
+
interface GrepLineHit {
|
|
941
|
+
/** 1-based line number (git's `-n`). */
|
|
942
|
+
readonly lineNumber: number;
|
|
943
|
+
/** Raw returned-line bytes (LF kept by splitLines). */
|
|
944
|
+
readonly line: Uint8Array;
|
|
945
|
+
/** Match byte-offset spans; EMPTY under `invert` (a returned line is a non-match). */
|
|
946
|
+
readonly spans: ReadonlyArray<MatchSpan>;
|
|
947
|
+
}
|
|
948
|
+
interface GrepPathResult {
|
|
949
|
+
readonly path: FilePath;
|
|
950
|
+
readonly hits: ReadonlyArray<GrepLineHit>;
|
|
951
|
+
/**
|
|
952
|
+
* Blob is binary AND contained a match. `hits` stays empty — line scan is
|
|
953
|
+
* skipped for binary blobs (git's default). The caller reconstructs
|
|
954
|
+
* "Binary file X matches" from this datum.
|
|
955
|
+
*/
|
|
956
|
+
readonly binaryMatch: boolean;
|
|
957
|
+
}
|
|
958
|
+
interface GrepResult {
|
|
959
|
+
/** Only paths with ≥1 hit or binaryMatch:true. */
|
|
960
|
+
readonly paths: ReadonlyArray<GrepPathResult>;
|
|
961
|
+
}
|
|
962
|
+
interface GrepOptions {
|
|
963
|
+
/** Patterns to search. ≥1 required; multiple OR-combine. */
|
|
964
|
+
readonly patterns: ReadonlyArray<GrepPattern>;
|
|
965
|
+
/** Whole-word gating (`-w`). */
|
|
966
|
+
readonly wholeWord?: boolean;
|
|
967
|
+
/** Invert: return lines that do NOT match (`-v`). */
|
|
968
|
+
readonly invert?: boolean;
|
|
969
|
+
/**
|
|
970
|
+
* Target. Absent ⇒ working tree; `'index'` ⇒ `--cached`;
|
|
971
|
+
* `{ treeish }` ⇒ committed tree.
|
|
972
|
+
*/
|
|
973
|
+
readonly target?: 'index' | {
|
|
974
|
+
readonly treeish: string;
|
|
975
|
+
};
|
|
976
|
+
/** Pathspec limiter (`-- <path>...`). */
|
|
977
|
+
readonly paths?: ReadonlyArray<string>;
|
|
978
|
+
}
|
|
979
|
+
declare function grep(ctx: Context, opts: GrepOptions): Promise<GrepResult>;
|
|
980
|
+
|
|
981
|
+
interface InitOptions {
|
|
982
|
+
readonly initialBranch?: string;
|
|
983
|
+
readonly bare?: boolean;
|
|
984
|
+
}
|
|
985
|
+
interface InitResult {
|
|
986
|
+
readonly path: FilePath;
|
|
987
|
+
readonly initialBranch: RefName;
|
|
988
|
+
readonly bare: boolean;
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Initialize a fresh repository at `ctx.layout.gitDir`. Throws
|
|
992
|
+
* `ALREADY_INITIALIZED` when the target gitDir already exists; otherwise
|
|
993
|
+
* delegates to `bootstrapRepository` for the standard layout.
|
|
994
|
+
*
|
|
995
|
+
* For non-bare repos, the gitDir is `<workDir>/.git`. For bare, gitDir IS the
|
|
996
|
+
* working dir — callers must construct a Context with `bare: true` for that
|
|
997
|
+
* shape.
|
|
998
|
+
*/
|
|
999
|
+
declare const init: (ctx: Context, opts?: InitOptions) => Promise<InitResult>;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* The nested-namespace surface for `repo.branch.*`. Each method runs the
|
|
1003
|
+
* caller-supplied `guard()` first (so a disposed repository throws before any
|
|
1004
|
+
* work) and then forwards to the corresponding context-aware command in
|
|
1005
|
+
* `commands/branch.ts`.
|
|
1006
|
+
*/
|
|
1007
|
+
interface BranchNamespace {
|
|
1008
|
+
readonly list: () => Promise<BranchListResult>;
|
|
1009
|
+
readonly create: (input: BranchCreateInput) => Promise<BranchCreateResult>;
|
|
1010
|
+
readonly delete: (input: BranchDeleteInput) => Promise<BranchDeleteResult>;
|
|
1011
|
+
readonly rename: (input: BranchRenameInput) => Promise<BranchRenameResult>;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Bind the `repo.branch.*` nested-namespace dispatcher. `guard()` is the
|
|
1015
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1016
|
+
* it is invoked before every method forwards to its underlying command.
|
|
1017
|
+
*
|
|
1018
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1019
|
+
* the namespace at runtime.
|
|
1020
|
+
*/
|
|
1021
|
+
declare const bindBranchNamespace: (ctx: Context, guard: () => void) => BranchNamespace;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Nested-namespace surface for `repo.bundle.{create,verify,listHeads}`. Each
|
|
1025
|
+
* method runs the caller-supplied `guard()` first (so a disposed repository
|
|
1026
|
+
* throws before any work) and then forwards to the context-aware command.
|
|
1027
|
+
* Frozen.
|
|
1028
|
+
*/
|
|
1029
|
+
interface BundleNamespace {
|
|
1030
|
+
readonly create: (opts: BundleCreateOptions) => Promise<BundleCreateResult>;
|
|
1031
|
+
readonly verify: (input: BundleVerifyInput) => Promise<BundleVerifyResult>;
|
|
1032
|
+
readonly listHeads: (input: BundleListHeadsInput) => Promise<BundleListHeadsResult>;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Bind the `repo.bundle.*` nested-namespace dispatcher. `guard()` is the
|
|
1036
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1037
|
+
* it is invoked before every method forwards to its underlying command.
|
|
1038
|
+
*
|
|
1039
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1040
|
+
* the namespace at runtime.
|
|
1041
|
+
*/
|
|
1042
|
+
declare const bindBundleNamespace: (ctx: Context, guard: () => void) => BundleNamespace;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* The nested-namespace surface for `repo.cherryPick.*` (ADR-181/192/210). Each
|
|
1046
|
+
* method runs the caller-supplied `guard()` first (so a disposed repository
|
|
1047
|
+
* throws before any work) and forwards to the Context-aware command. Frozen.
|
|
1048
|
+
*/
|
|
1049
|
+
interface CherryPickNamespace {
|
|
1050
|
+
readonly run: (input: CherryPickRunInput) => Promise<CherryPickResult>;
|
|
1051
|
+
readonly continue: (input?: CherryPickContinueInput) => Promise<CherryPickResult>;
|
|
1052
|
+
readonly skip: (input?: CherryPickContinueInput) => Promise<CherryPickResult>;
|
|
1053
|
+
readonly abort: () => Promise<CherryPickAbortResult>;
|
|
1054
|
+
}
|
|
1055
|
+
declare const bindCherryPickNamespace: (ctx: Context, guard: () => void) => CherryPickNamespace;
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* The nested-namespace surface for `repo.config.*` (ADR-181). Each method
|
|
1059
|
+
* runs the caller-supplied `guard()` first (so a disposed repository throws
|
|
1060
|
+
* before any work) and then forwards to the corresponding context-aware
|
|
1061
|
+
* command in `commands/config.ts`.
|
|
1062
|
+
*/
|
|
1063
|
+
interface ConfigNamespace {
|
|
1064
|
+
readonly get: (input: ConfigGetInput) => Promise<ConfigGetResult>;
|
|
1065
|
+
readonly getAll: (input: ConfigGetAllInput) => Promise<ConfigGetAllResult>;
|
|
1066
|
+
readonly getRegexp: (input: ConfigGetRegexpInput) => Promise<ConfigGetRegexpResult>;
|
|
1067
|
+
readonly list: (input?: ConfigListInput) => Promise<ConfigListResult>;
|
|
1068
|
+
readonly set: (input: ConfigSetInput) => Promise<ConfigSetResult>;
|
|
1069
|
+
readonly unset: (input: ConfigUnsetInput) => Promise<ConfigUnsetResult>;
|
|
1070
|
+
readonly unsetAll: (input: ConfigUnsetAllInput) => Promise<ConfigUnsetAllResult>;
|
|
1071
|
+
readonly renameSection: (input: ConfigRenameSectionInput) => Promise<ConfigRenameSectionResult>;
|
|
1072
|
+
readonly removeSection: (input: ConfigRemoveSectionInput) => Promise<ConfigRemoveSectionResult>;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Bind the `repo.config.*` nested-namespace dispatcher. `guard()` is the
|
|
1076
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1077
|
+
* it is invoked before every method forwards to its underlying command.
|
|
1078
|
+
*
|
|
1079
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1080
|
+
* the namespace at runtime.
|
|
1081
|
+
*/
|
|
1082
|
+
declare const bindConfigNamespace: (ctx: Context, guard: () => void) => ConfigNamespace;
|
|
1083
|
+
|
|
1084
|
+
interface MergeRunInput {
|
|
1085
|
+
readonly rev: string;
|
|
1086
|
+
readonly message?: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Fast-forward policy (git `--ff` / `--ff-only` / `--no-ff`):
|
|
1089
|
+
* - `'allow'` (default) — fast-forward when possible, else a true merge.
|
|
1090
|
+
* - `'only'` — refuse with `NON_FAST_FORWARD` when a true merge is required.
|
|
1091
|
+
* - `'never'` — always create a merge commit, even when a fast-forward is possible.
|
|
1092
|
+
*/
|
|
1093
|
+
readonly fastForward?: 'only' | 'never' | 'allow';
|
|
1094
|
+
readonly author?: AuthorIdentity;
|
|
1095
|
+
readonly committer?: AuthorIdentity;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Internal-only knobs for `merge`, set by composing porcelain (e.g. `pull`),
|
|
1099
|
+
* never by end users. Deliberately **not** re-exported from the commands barrel,
|
|
1100
|
+
* so it stays off the public API surface.
|
|
1101
|
+
*/
|
|
1102
|
+
interface MergeInternalOptions {
|
|
1103
|
+
/**
|
|
1104
|
+
* Reflog action prefix, mirroring git's GIT_REFLOG_ACTION. Replaces the
|
|
1105
|
+
* default `merge <rev>` prefix in the fast-forward and merge-commit reflog
|
|
1106
|
+
* messages (e.g. `pull` → `pull: Fast-forward`). Defaults to `merge <rev>`.
|
|
1107
|
+
*/
|
|
1108
|
+
readonly reflogAction?: string;
|
|
1109
|
+
}
|
|
1110
|
+
interface MergeConflictDescriptor {
|
|
1111
|
+
readonly path: FilePath;
|
|
1112
|
+
readonly type: ConflictType;
|
|
1113
|
+
}
|
|
1114
|
+
type MergeResult = {
|
|
1115
|
+
readonly kind: 'up-to-date';
|
|
1116
|
+
readonly id: ObjectId;
|
|
1117
|
+
} | {
|
|
1118
|
+
readonly kind: 'fast-forward';
|
|
1119
|
+
readonly id: ObjectId;
|
|
1120
|
+
readonly branch: RefName;
|
|
1121
|
+
} | {
|
|
1122
|
+
readonly kind: 'merge';
|
|
1123
|
+
readonly id: ObjectId;
|
|
1124
|
+
readonly branch: RefName;
|
|
1125
|
+
readonly parents: ReadonlyArray<ObjectId>;
|
|
1126
|
+
} | {
|
|
1127
|
+
readonly kind: 'conflict';
|
|
1128
|
+
readonly conflicts: ReadonlyArray<MergeConflictDescriptor>;
|
|
1129
|
+
readonly mergeHead: ObjectId;
|
|
1130
|
+
readonly origHead: ObjectId;
|
|
1131
|
+
};
|
|
1132
|
+
declare const mergeRun: (ctx: Context, opts: MergeRunInput, internal?: MergeInternalOptions) => Promise<MergeResult>;
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* The nested-namespace surface for `repo.merge.*` (ADR-181/192/263). Each method
|
|
1136
|
+
* runs the caller-supplied `guard()` first (so a disposed repository throws
|
|
1137
|
+
* before any work) and forwards to the Context-aware command. Frozen.
|
|
1138
|
+
*
|
|
1139
|
+
* There is no `skip` verb — a merge applies a single integration, so the verbs
|
|
1140
|
+
* are `run` / `continue` / `abort` (git `merge` / `merge --continue` /
|
|
1141
|
+
* `merge --abort`). `run` never exposes `merge`'s internal reflog-action channel.
|
|
1142
|
+
*/
|
|
1143
|
+
interface MergeNamespace {
|
|
1144
|
+
readonly run: (input: MergeRunInput) => Promise<MergeResult>;
|
|
1145
|
+
readonly continue: (input?: MergeContinueInput) => Promise<MergeContinueResult>;
|
|
1146
|
+
readonly abort: () => Promise<MergeAbortResult>;
|
|
1147
|
+
}
|
|
1148
|
+
declare const bindMergeNamespace: (ctx: Context, guard: () => void) => MergeNamespace;
|
|
1149
|
+
|
|
1150
|
+
interface NotesAddInput {
|
|
1151
|
+
/** Commit-ish or full oid to annotate. */
|
|
1152
|
+
readonly object: string;
|
|
1153
|
+
/** Note bytes stored verbatim — no normalisation applied by the library. */
|
|
1154
|
+
readonly content: Uint8Array;
|
|
1155
|
+
/** Overwrite an existing note; without this, an existing note refuses. */
|
|
1156
|
+
readonly force?: boolean;
|
|
1157
|
+
/** Notes-ref override; selection rule: explicit → GIT_NOTES_REF → core.notesRef → default. */
|
|
1158
|
+
readonly ref?: string;
|
|
1159
|
+
}
|
|
1160
|
+
interface NotesAddResult {
|
|
1161
|
+
readonly notesCommit: ObjectId;
|
|
1162
|
+
readonly note: ObjectId;
|
|
1163
|
+
}
|
|
1164
|
+
interface NotesReadInput {
|
|
1165
|
+
readonly object: string;
|
|
1166
|
+
readonly ref?: string;
|
|
1167
|
+
}
|
|
1168
|
+
type NotesReadResult = {
|
|
1169
|
+
readonly object: ObjectId;
|
|
1170
|
+
readonly note: ObjectId;
|
|
1171
|
+
readonly content: Uint8Array;
|
|
1172
|
+
} | null;
|
|
1173
|
+
interface NotesListInput {
|
|
1174
|
+
readonly ref?: string;
|
|
1175
|
+
}
|
|
1176
|
+
type NotesListResult = ReadonlyArray<{
|
|
1177
|
+
readonly object: ObjectId;
|
|
1178
|
+
readonly note: ObjectId;
|
|
1179
|
+
}>;
|
|
1180
|
+
interface NotesRemoveInput {
|
|
1181
|
+
readonly object: string;
|
|
1182
|
+
readonly ref?: string;
|
|
1183
|
+
}
|
|
1184
|
+
interface NotesRemoveResult {
|
|
1185
|
+
readonly notesCommit: ObjectId;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Writes (or, with `force`, overwrites) a note for an object. Commits the new
|
|
1189
|
+
* notes tree and moves the notes ref, creating it if absent.
|
|
1190
|
+
*/
|
|
1191
|
+
declare const notesAdd: (ctx: Context, input: NotesAddInput) => Promise<NotesAddResult>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Returns the note recorded for an object, or `null` when the note or ref is
|
|
1194
|
+
* absent. Never throws for absence — callers distinguish "no note" from errors.
|
|
1195
|
+
*/
|
|
1196
|
+
declare const notesRead: (ctx: Context, input: NotesReadInput) => Promise<NotesReadResult>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Enumerates every `(annotated-object, note-blob)` pair in the notes ref by
|
|
1199
|
+
* walking the real notes tree, recursing through every fanout level. Returns an
|
|
1200
|
+
* empty array when the ref is absent. Skips non-note entries (directories and
|
|
1201
|
+
* any leaf whose de-slashed path is not a full-hex oid). Sorted by
|
|
1202
|
+
* annotated-object oid ascending (git tree order).
|
|
1203
|
+
*/
|
|
1204
|
+
declare const notesList: (ctx: Context, input?: NotesListInput) => Promise<NotesListResult>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Removes the note for an object. Commits the smaller (or empty) tree and
|
|
1207
|
+
* moves the notes ref. The ref is never deleted, even when the last note is
|
|
1208
|
+
* removed — an empty tree commit is stored instead.
|
|
1209
|
+
*/
|
|
1210
|
+
declare const notesRemove: (ctx: Context, input: NotesRemoveInput) => Promise<NotesRemoveResult>;
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* The nested-namespace surface for `repo.notes.*`. Each method runs the
|
|
1214
|
+
* caller-supplied `guard()` first (so a disposed repository throws before any
|
|
1215
|
+
* work) and then forwards to the corresponding context-aware command in
|
|
1216
|
+
* `commands/notes.ts`.
|
|
1217
|
+
*/
|
|
1218
|
+
interface NotesNamespace {
|
|
1219
|
+
readonly add: (input: NotesAddInput) => Promise<NotesAddResult>;
|
|
1220
|
+
readonly read: (input: NotesReadInput) => Promise<NotesReadResult>;
|
|
1221
|
+
readonly list: (input?: NotesListInput) => Promise<NotesListResult>;
|
|
1222
|
+
readonly remove: (input: NotesRemoveInput) => Promise<NotesRemoveResult>;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Bind the `repo.notes.*` nested-namespace dispatcher. `guard()` is the
|
|
1226
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1227
|
+
* it is invoked before every method forwards to its underlying command.
|
|
1228
|
+
*
|
|
1229
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1230
|
+
* the namespace at runtime.
|
|
1231
|
+
*/
|
|
1232
|
+
declare const bindNotesNamespace: (ctx: Context, guard: () => void) => NotesNamespace;
|
|
1233
|
+
|
|
1234
|
+
type RebaseTodoAction = 'pick' | 'reword' | 'edit' | 'squash' | 'fixup' | 'drop';
|
|
1235
|
+
|
|
1236
|
+
/** The interactive instruction verbs (`git rebase -i`). */
|
|
1237
|
+
type RebaseInteractiveAction = RebaseTodoAction;
|
|
1238
|
+
/** One post-`$EDITOR` interactive instruction — the edited-todo line as data. */
|
|
1239
|
+
interface RebaseInstruction {
|
|
1240
|
+
readonly action: RebaseInteractiveAction;
|
|
1241
|
+
/** A commit-ish in the `onto..HEAD` range. */
|
|
1242
|
+
readonly oid: string;
|
|
1243
|
+
/** reword: the new message (required). squash: the combined message
|
|
1244
|
+
* (optional — defaults to git's combination template). Ignored otherwise. */
|
|
1245
|
+
readonly message?: string;
|
|
1246
|
+
}
|
|
1247
|
+
interface RebaseRunInput {
|
|
1248
|
+
/** The fork-point side — a commit-ish (`git rebase <upstream>`). */
|
|
1249
|
+
readonly upstream: string;
|
|
1250
|
+
/** `--onto <newbase>`: replay onto this base instead of `upstream`. */
|
|
1251
|
+
readonly onto?: string;
|
|
1252
|
+
/** Present → interactive: the post-`$EDITOR` instruction list (`git rebase -i`). */
|
|
1253
|
+
readonly interactive?: ReadonlyArray<RebaseInstruction>;
|
|
1254
|
+
}
|
|
1255
|
+
interface RebasedCommit {
|
|
1256
|
+
readonly source: ObjectId;
|
|
1257
|
+
readonly created: ObjectId;
|
|
1258
|
+
}
|
|
1259
|
+
interface RebaseConflict {
|
|
1260
|
+
readonly path: FilePath;
|
|
1261
|
+
readonly type: ConflictType;
|
|
1262
|
+
}
|
|
1263
|
+
type RebaseResult = {
|
|
1264
|
+
readonly kind: 'rebased';
|
|
1265
|
+
readonly commits: ReadonlyArray<RebasedCommit>;
|
|
1266
|
+
} | {
|
|
1267
|
+
readonly kind: 'up-to-date';
|
|
1268
|
+
} | {
|
|
1269
|
+
readonly kind: 'conflict';
|
|
1270
|
+
readonly commit: ObjectId;
|
|
1271
|
+
readonly conflicts: ReadonlyArray<RebaseConflict>;
|
|
1272
|
+
readonly remaining: number;
|
|
1273
|
+
} | {
|
|
1274
|
+
readonly kind: 'stopped';
|
|
1275
|
+
readonly commit: ObjectId;
|
|
1276
|
+
readonly remaining: number;
|
|
1277
|
+
};
|
|
1278
|
+
declare const rebaseRun: (ctx: Context, input: RebaseRunInput) => Promise<RebaseResult>;
|
|
1279
|
+
interface RebaseAbortResult {
|
|
1280
|
+
readonly head: ObjectId;
|
|
1281
|
+
readonly headName: string;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Resume the rebase after the conflicted commit was resolved: commit the resolved
|
|
1285
|
+
* index as the stopped commit (preserved author from `author-script`, current
|
|
1286
|
+
* committer, `rebase (continue)` reflog), then replay the remaining todo.
|
|
1287
|
+
*/
|
|
1288
|
+
declare const rebaseContinue: (ctx: Context) => Promise<RebaseResult>;
|
|
1289
|
+
/** Drop the conflicted commit (hard-reset to the last good pick) and replay the rest. */
|
|
1290
|
+
declare const rebaseSkip: (ctx: Context) => Promise<RebaseResult>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Abort the rebase: hard-reset the working tree + index to the pre-rebase tip,
|
|
1293
|
+
* reattach `head-name`, record git's `rebase (abort): returning to <name>` reflog
|
|
1294
|
+
* (the branch never moved during the replay, so it gets no entry), clear state.
|
|
1295
|
+
*/
|
|
1296
|
+
declare const rebaseAbort: (ctx: Context) => Promise<RebaseAbortResult>;
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* The nested-namespace surface for `repo.rebase.*` (ADR-181/192/230). Each method
|
|
1300
|
+
* runs the caller-supplied `guard()` first (so a disposed repository throws before
|
|
1301
|
+
* any work) and forwards to the Context-aware command. Frozen.
|
|
1302
|
+
*/
|
|
1303
|
+
interface RebaseNamespace {
|
|
1304
|
+
readonly run: (input: RebaseRunInput) => Promise<RebaseResult>;
|
|
1305
|
+
readonly continue: () => Promise<RebaseResult>;
|
|
1306
|
+
readonly skip: () => Promise<RebaseResult>;
|
|
1307
|
+
readonly abort: () => Promise<RebaseAbortResult>;
|
|
1308
|
+
}
|
|
1309
|
+
declare const bindRebaseNamespace: (ctx: Context, guard: () => void) => RebaseNamespace;
|
|
1310
|
+
|
|
1311
|
+
/** Compact view of a remote pulled from `.git/config`. */
|
|
1312
|
+
interface RemoteInfo {
|
|
1313
|
+
readonly name: string;
|
|
1314
|
+
readonly url: string;
|
|
1315
|
+
readonly pushUrl: string | undefined;
|
|
1316
|
+
readonly fetchRefspecs: ReadonlyArray<string>;
|
|
1317
|
+
}
|
|
1318
|
+
/** Local-only `show` payload: config view + tracking refs + tracking branches. */
|
|
1319
|
+
interface RemoteShow extends RemoteInfo {
|
|
1320
|
+
readonly trackingRefs: ReadonlyMap<RefName, ObjectId>;
|
|
1321
|
+
readonly trackedBy: ReadonlyArray<{
|
|
1322
|
+
readonly branch: RefName;
|
|
1323
|
+
readonly merge: string | undefined;
|
|
1324
|
+
}>;
|
|
1325
|
+
}
|
|
1326
|
+
interface RemoteListResult {
|
|
1327
|
+
readonly remotes: ReadonlyArray<RemoteInfo>;
|
|
1328
|
+
}
|
|
1329
|
+
interface RemoteAddInput {
|
|
1330
|
+
readonly name: string;
|
|
1331
|
+
readonly url: string;
|
|
1332
|
+
readonly fetch?: string;
|
|
1333
|
+
}
|
|
1334
|
+
interface RemoteAddResult {
|
|
1335
|
+
readonly remote: RemoteInfo;
|
|
1336
|
+
}
|
|
1337
|
+
interface RemoteRemoveInput {
|
|
1338
|
+
readonly name: string;
|
|
1339
|
+
}
|
|
1340
|
+
interface RemoteRemoveResult {
|
|
1341
|
+
readonly name: string;
|
|
1342
|
+
readonly removedTrackingRefs: ReadonlyArray<RefName>;
|
|
1343
|
+
readonly clearedBranches: ReadonlyArray<RefName>;
|
|
1344
|
+
}
|
|
1345
|
+
interface RemoteRenameInput {
|
|
1346
|
+
readonly from: string;
|
|
1347
|
+
readonly to: string;
|
|
1348
|
+
}
|
|
1349
|
+
interface RemoteRenameResult {
|
|
1350
|
+
readonly from: string;
|
|
1351
|
+
readonly to: string;
|
|
1352
|
+
readonly movedTrackingRefs: ReadonlyArray<RefName>;
|
|
1353
|
+
readonly rewrittenBranches: ReadonlyArray<RefName>;
|
|
1354
|
+
}
|
|
1355
|
+
interface RemoteSetUrlInput {
|
|
1356
|
+
readonly name: string;
|
|
1357
|
+
readonly url: string;
|
|
1358
|
+
readonly push?: boolean;
|
|
1359
|
+
}
|
|
1360
|
+
interface RemoteSetUrlResult {
|
|
1361
|
+
readonly remote: RemoteInfo;
|
|
1362
|
+
}
|
|
1363
|
+
interface RemoteShowInput {
|
|
1364
|
+
readonly name: string;
|
|
1365
|
+
}
|
|
1366
|
+
interface RemoteShowResult {
|
|
1367
|
+
readonly remote: RemoteShow;
|
|
1368
|
+
}
|
|
1369
|
+
declare const remoteList: (ctx: Context) => Promise<RemoteListResult>;
|
|
1370
|
+
declare const remoteAdd: (ctx: Context, input: RemoteAddInput) => Promise<RemoteAddResult>;
|
|
1371
|
+
declare const remoteRemove: (ctx: Context, input: RemoteRemoveInput) => Promise<RemoteRemoveResult>;
|
|
1372
|
+
declare const remoteRename: (ctx: Context, input: RemoteRenameInput) => Promise<RemoteRenameResult>;
|
|
1373
|
+
declare const remoteSetUrl: (ctx: Context, input: RemoteSetUrlInput) => Promise<RemoteSetUrlResult>;
|
|
1374
|
+
declare const remoteShow: (ctx: Context, input: RemoteShowInput) => Promise<RemoteShowResult>;
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* The nested-namespace surface for `repo.remote.*`. Each method runs the
|
|
1378
|
+
* caller-supplied `guard()` first (so a disposed repository throws before any
|
|
1379
|
+
* work) and then forwards to the corresponding context-aware command in
|
|
1380
|
+
* `commands/remote.ts`.
|
|
1381
|
+
*/
|
|
1382
|
+
interface RemoteNamespace {
|
|
1383
|
+
readonly list: () => Promise<RemoteListResult>;
|
|
1384
|
+
readonly add: (input: RemoteAddInput) => Promise<RemoteAddResult>;
|
|
1385
|
+
readonly remove: (input: RemoteRemoveInput) => Promise<RemoteRemoveResult>;
|
|
1386
|
+
readonly rename: (input: RemoteRenameInput) => Promise<RemoteRenameResult>;
|
|
1387
|
+
readonly setUrl: (input: RemoteSetUrlInput) => Promise<RemoteSetUrlResult>;
|
|
1388
|
+
readonly show: (input: RemoteShowInput) => Promise<RemoteShowResult>;
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Bind the `repo.remote.*` nested-namespace dispatcher. `guard()` is the
|
|
1392
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1393
|
+
* it is invoked before every method forwards to its underlying command.
|
|
1394
|
+
*
|
|
1395
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1396
|
+
* the namespace at runtime.
|
|
1397
|
+
*/
|
|
1398
|
+
declare const bindRemoteNamespace: (ctx: Context, guard: () => void) => RemoteNamespace;
|
|
1399
|
+
|
|
1400
|
+
interface RevertRunInput {
|
|
1401
|
+
/** Revisions to revert, in argument order — a commit-ish each. */
|
|
1402
|
+
readonly commits: ReadonlyArray<string>;
|
|
1403
|
+
/** -n / --no-commit: apply each reverse change to the index + working tree
|
|
1404
|
+
* only; never commit, never persist REVERT_HEAD / sequencer state. */
|
|
1405
|
+
readonly noCommit?: boolean;
|
|
1406
|
+
}
|
|
1407
|
+
interface RevertedCommit {
|
|
1408
|
+
readonly source: ObjectId;
|
|
1409
|
+
readonly created: ObjectId;
|
|
1410
|
+
}
|
|
1411
|
+
interface RevertConflict {
|
|
1412
|
+
readonly path: FilePath;
|
|
1413
|
+
readonly type: ConflictType;
|
|
1414
|
+
}
|
|
1415
|
+
type RevertResult = {
|
|
1416
|
+
readonly kind: 'reverted';
|
|
1417
|
+
readonly commits: ReadonlyArray<RevertedCommit>;
|
|
1418
|
+
} | {
|
|
1419
|
+
readonly kind: 'no-commit';
|
|
1420
|
+
readonly sources: ReadonlyArray<ObjectId>;
|
|
1421
|
+
} | {
|
|
1422
|
+
readonly kind: 'conflict';
|
|
1423
|
+
readonly commit: ObjectId;
|
|
1424
|
+
readonly conflicts: ReadonlyArray<RevertConflict>;
|
|
1425
|
+
readonly remaining: number;
|
|
1426
|
+
} | {
|
|
1427
|
+
readonly kind: 'empty';
|
|
1428
|
+
readonly commit: ObjectId;
|
|
1429
|
+
readonly remaining: number;
|
|
1430
|
+
};
|
|
1431
|
+
declare const revertRun: (ctx: Context, input: RevertRunInput) => Promise<RevertResult>;
|
|
1432
|
+
/**
|
|
1433
|
+
* Finalise the in-progress conflicted revert (if any) as a single-parent commit,
|
|
1434
|
+
* then resume the remaining sequencer reverts. Refuses when nothing is in progress
|
|
1435
|
+
* or the index is unmerged; a resolution that yields no change re-stops empty.
|
|
1436
|
+
*/
|
|
1437
|
+
declare const revertContinue: (ctx: Context) => Promise<RevertResult>;
|
|
1438
|
+
interface RevertAbortResult {
|
|
1439
|
+
readonly head: ObjectId;
|
|
1440
|
+
readonly branch: RefName;
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Drop the in-progress revert: hard-reset to HEAD (discarding its half-applied
|
|
1444
|
+
* state), then resume the remaining sequencer reverts (if any).
|
|
1445
|
+
*/
|
|
1446
|
+
declare const revertSkip: (ctx: Context) => Promise<RevertResult>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Abort the revert: hard-reset the working tree, index, and branch to the
|
|
1449
|
+
* pre-sequence HEAD (sequencer `head`, or the current HEAD for a lone revert),
|
|
1450
|
+
* and clear all state. The branch update records git's faithful
|
|
1451
|
+
* `reset: moving to <oid>` reflog. Refuses when nothing is in progress.
|
|
1452
|
+
*/
|
|
1453
|
+
declare const revertAbort: (ctx: Context) => Promise<RevertAbortResult>;
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* The nested-namespace surface for `repo.revert.*` (ADR-181/192/210/217 lineage).
|
|
1457
|
+
* Each method runs the caller-supplied `guard()` first (so a disposed repository
|
|
1458
|
+
* throws before any work) and forwards to the Context-aware command. Frozen.
|
|
1459
|
+
* `continue` / `skip` take no arguments — revert has no resume-time options.
|
|
1460
|
+
*/
|
|
1461
|
+
interface RevertNamespace {
|
|
1462
|
+
readonly run: (input: RevertRunInput) => Promise<RevertResult>;
|
|
1463
|
+
readonly continue: () => Promise<RevertResult>;
|
|
1464
|
+
readonly skip: () => Promise<RevertResult>;
|
|
1465
|
+
readonly abort: () => Promise<RevertAbortResult>;
|
|
1466
|
+
}
|
|
1467
|
+
declare const bindRevertNamespace: (ctx: Context, guard: () => void) => RevertNamespace;
|
|
1468
|
+
|
|
1469
|
+
interface SparseCheckoutListResult {
|
|
1470
|
+
readonly cone: boolean;
|
|
1471
|
+
readonly patterns: ReadonlyArray<string>;
|
|
1472
|
+
}
|
|
1473
|
+
interface SparseCheckoutAppliedResult {
|
|
1474
|
+
readonly cone: boolean;
|
|
1475
|
+
readonly materialized: number;
|
|
1476
|
+
readonly removed: number;
|
|
1477
|
+
readonly retained: ReadonlyArray<FilePath>;
|
|
1478
|
+
}
|
|
1479
|
+
interface SparseCheckoutSetInput {
|
|
1480
|
+
readonly patterns: ReadonlyArray<string>;
|
|
1481
|
+
readonly cone?: boolean;
|
|
1482
|
+
readonly force?: boolean;
|
|
1483
|
+
}
|
|
1484
|
+
interface SparseCheckoutAddInput {
|
|
1485
|
+
readonly patterns: ReadonlyArray<string>;
|
|
1486
|
+
readonly force?: boolean;
|
|
1487
|
+
}
|
|
1488
|
+
interface SparseCheckoutReapplyInput {
|
|
1489
|
+
readonly force?: boolean;
|
|
1490
|
+
}
|
|
1491
|
+
interface SparseCheckoutDisableInput {
|
|
1492
|
+
readonly force?: boolean;
|
|
1493
|
+
}
|
|
1494
|
+
declare const sparseCheckoutList: (ctx: Context) => Promise<SparseCheckoutListResult>;
|
|
1495
|
+
declare const sparseCheckoutSet: (ctx: Context, input: SparseCheckoutSetInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1496
|
+
declare const sparseCheckoutAdd: (ctx: Context, input: SparseCheckoutAddInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1497
|
+
declare const sparseCheckoutReapply: (ctx: Context, input?: SparseCheckoutReapplyInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1498
|
+
declare const sparseCheckoutDisable: (ctx: Context, input?: SparseCheckoutDisableInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* The nested-namespace surface for `repo.sparseCheckout.*`. Each method runs
|
|
1502
|
+
* the caller-supplied `guard()` first (so a disposed repository throws before
|
|
1503
|
+
* any work) and then forwards to the corresponding context-aware command in
|
|
1504
|
+
* `commands/sparse-checkout.ts`.
|
|
1505
|
+
*/
|
|
1506
|
+
interface SparseCheckoutNamespace {
|
|
1507
|
+
readonly list: () => Promise<SparseCheckoutListResult>;
|
|
1508
|
+
readonly set: (input: SparseCheckoutSetInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1509
|
+
readonly add: (input: SparseCheckoutAddInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1510
|
+
readonly reapply: (input?: SparseCheckoutReapplyInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1511
|
+
readonly disable: (input?: SparseCheckoutDisableInput) => Promise<SparseCheckoutAppliedResult>;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Bind the `repo.sparseCheckout.*` nested-namespace dispatcher. `guard()` is
|
|
1515
|
+
* the lifecycle gate (typically the disposed/closed check from
|
|
1516
|
+
* `openRepository`); it is invoked before every method forwards to its
|
|
1517
|
+
* underlying command.
|
|
1518
|
+
*
|
|
1519
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1520
|
+
* the namespace at runtime.
|
|
1521
|
+
*/
|
|
1522
|
+
declare const bindSparseCheckoutNamespace: (ctx: Context, guard: () => void) => SparseCheckoutNamespace;
|
|
1523
|
+
|
|
1524
|
+
/** One entry of the stash stack, newest-first (`stash@{0}` = index 0). */
|
|
1525
|
+
interface StashStackEntry {
|
|
1526
|
+
readonly index: number;
|
|
1527
|
+
readonly selector: string;
|
|
1528
|
+
readonly stash: ObjectId;
|
|
1529
|
+
readonly message: string;
|
|
1530
|
+
}
|
|
1531
|
+
interface StashDropResult {
|
|
1532
|
+
readonly dropped: ObjectId;
|
|
1533
|
+
readonly remaining: number;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
interface StashPushInput {
|
|
1537
|
+
readonly message?: string;
|
|
1538
|
+
readonly includeUntracked?: boolean;
|
|
1539
|
+
readonly keepIndex?: boolean;
|
|
1540
|
+
}
|
|
1541
|
+
type StashPushResult = {
|
|
1542
|
+
readonly kind: 'saved';
|
|
1543
|
+
readonly stash: ObjectId;
|
|
1544
|
+
readonly message: string;
|
|
1545
|
+
} | {
|
|
1546
|
+
readonly kind: 'no-local-changes';
|
|
1547
|
+
};
|
|
1548
|
+
declare const stashPush: (ctx: Context, opts?: StashPushInput) => Promise<StashPushResult>;
|
|
1549
|
+
|
|
1550
|
+
type StashListEntry = StashStackEntry;
|
|
1551
|
+
interface StashListResult {
|
|
1552
|
+
readonly entries: ReadonlyArray<StashListEntry>;
|
|
1553
|
+
}
|
|
1554
|
+
/** List the stash stack, newest-first (`stash@{0}` first). */
|
|
1555
|
+
declare const stashList: (ctx: Context) => Promise<StashListResult>;
|
|
1556
|
+
interface StashDropInput {
|
|
1557
|
+
readonly index?: number;
|
|
1558
|
+
}
|
|
1559
|
+
/** Drop `stash@{index}` (default newest) from the stack. */
|
|
1560
|
+
declare const stashDrop: (ctx: Context, input?: StashDropInput) => Promise<StashDropResult>;
|
|
1561
|
+
interface StashApplyInput {
|
|
1562
|
+
readonly index?: number;
|
|
1563
|
+
readonly restoreIndex?: boolean;
|
|
1564
|
+
}
|
|
1565
|
+
interface StashConflict {
|
|
1566
|
+
readonly path: FilePath;
|
|
1567
|
+
readonly type: ConflictType;
|
|
1568
|
+
}
|
|
1569
|
+
type StashApplyResult = {
|
|
1570
|
+
readonly kind: 'applied';
|
|
1571
|
+
readonly stash: ObjectId;
|
|
1572
|
+
} | {
|
|
1573
|
+
readonly kind: 'conflict';
|
|
1574
|
+
readonly conflicts: ReadonlyArray<StashConflict>;
|
|
1575
|
+
};
|
|
1576
|
+
/** Apply `stash@{index}` (default newest) onto the working tree via a 3-way merge. */
|
|
1577
|
+
declare const stashApply: (ctx: Context, input?: StashApplyInput) => Promise<StashApplyResult>;
|
|
1578
|
+
type StashPopResult = {
|
|
1579
|
+
readonly kind: 'applied';
|
|
1580
|
+
readonly stash: ObjectId;
|
|
1581
|
+
readonly dropped: ObjectId;
|
|
1582
|
+
} | {
|
|
1583
|
+
readonly kind: 'conflict';
|
|
1584
|
+
readonly conflicts: ReadonlyArray<StashConflict>;
|
|
1585
|
+
};
|
|
1586
|
+
/** Apply `stash@{index}` then drop it; on conflict the stash is retained. */
|
|
1587
|
+
declare const stashPop: (ctx: Context, input?: StashApplyInput) => Promise<StashPopResult>;
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* The nested-namespace surface for `repo.stash.*` (ADR-181 / ADR-192). Each
|
|
1591
|
+
* method runs the caller-supplied `guard()` first (so a disposed repository
|
|
1592
|
+
* throws before any work) and then forwards to the corresponding Context-aware
|
|
1593
|
+
* command in `commands/stash.ts`. The returned object is frozen.
|
|
1594
|
+
*/
|
|
1595
|
+
interface StashNamespace {
|
|
1596
|
+
readonly push: (input?: StashPushInput) => Promise<StashPushResult>;
|
|
1597
|
+
readonly list: () => Promise<StashListResult>;
|
|
1598
|
+
readonly apply: (input?: StashApplyInput) => Promise<StashApplyResult>;
|
|
1599
|
+
readonly pop: (input?: StashApplyInput) => Promise<StashPopResult>;
|
|
1600
|
+
readonly drop: (input?: StashDropInput) => Promise<StashDropResult>;
|
|
1601
|
+
}
|
|
1602
|
+
declare const bindStashNamespace: (ctx: Context, guard: () => void) => StashNamespace;
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* The recognised `submodule.<name>.update` modes git copies from `.gitmodules`
|
|
1606
|
+
* into `.git/config` during `init`. A `!command` form or any other token is
|
|
1607
|
+
* refused (git: `fatal: invalid value for 'submodule.<name>.update'`) — only
|
|
1608
|
+
* these four are valid.
|
|
1609
|
+
*/
|
|
1610
|
+
type SubmoduleUpdateMode = 'checkout' | 'rebase' | 'merge' | 'none';
|
|
1611
|
+
|
|
1612
|
+
interface SubmoduleInitOptions {
|
|
1613
|
+
/** Submodule paths to register. Default: every submodule in `.gitmodules`. */
|
|
1614
|
+
readonly paths?: ReadonlyArray<string>;
|
|
1615
|
+
}
|
|
1616
|
+
interface SubmoduleInitEntry {
|
|
1617
|
+
readonly name: string;
|
|
1618
|
+
readonly path: FilePath;
|
|
1619
|
+
/** Resolved URL now in `.git/config` (newly written, or the preserved existing value). */
|
|
1620
|
+
readonly url: string;
|
|
1621
|
+
/** True when this call wrote the registration; false when it was already registered. */
|
|
1622
|
+
readonly registered: boolean;
|
|
1623
|
+
readonly update?: SubmoduleUpdateMode;
|
|
1624
|
+
}
|
|
1625
|
+
interface SubmoduleInitResult {
|
|
1626
|
+
readonly entries: ReadonlyArray<SubmoduleInitEntry>;
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Register submodules into `.git/config` (`git submodule init`). For each
|
|
1630
|
+
* un-registered submodule (no `submodule.<name>.url` in config) writes
|
|
1631
|
+
* `active = true`, the resolved `url`, and (when declared) a validated
|
|
1632
|
+
* `update` mode, in git's key order. An already-registered submodule keeps its
|
|
1633
|
+
* url untouched (`registered: false`). Relative `.gitmodules` URLs resolve
|
|
1634
|
+
* against the superproject's default-remote URL.
|
|
1635
|
+
*/
|
|
1636
|
+
declare const submoduleInit: (ctx: Context, opts?: SubmoduleInitOptions) => Promise<SubmoduleInitResult>;
|
|
1637
|
+
interface SubmoduleSyncOptions {
|
|
1638
|
+
/** Submodule paths to sync. Default: every initialised submodule. */
|
|
1639
|
+
readonly paths?: ReadonlyArray<string>;
|
|
1640
|
+
/** `--recursive`: descend into checked-out submodules and sync their nested ones. */
|
|
1641
|
+
readonly recursive?: boolean;
|
|
1642
|
+
}
|
|
1643
|
+
interface SubmoduleSyncEntry {
|
|
1644
|
+
readonly name: string;
|
|
1645
|
+
readonly path: FilePath;
|
|
1646
|
+
/** Resolved URL written to `submodule.<name>.url`. */
|
|
1647
|
+
readonly url: string;
|
|
1648
|
+
/** True when the checked-out submodule's own `remote.origin.url` was updated too. */
|
|
1649
|
+
readonly syncedRemote: boolean;
|
|
1650
|
+
}
|
|
1651
|
+
interface SubmoduleSyncResult {
|
|
1652
|
+
readonly entries: ReadonlyArray<SubmoduleSyncEntry>;
|
|
1653
|
+
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Re-point configured submodule URLs from `.gitmodules` (`git submodule sync`).
|
|
1656
|
+
* Operates only on **initialised** submodules (those already carrying
|
|
1657
|
+
* `submodule.<name>.url` in config); a fresh clone with nothing initialised is a
|
|
1658
|
+
* no-op. Overwrites `submodule.<name>.url` with the freshly resolved URL and,
|
|
1659
|
+
* when the submodule is checked out, its own `remote.origin.url`. With
|
|
1660
|
+
* `recursive`, descends into each checked-out submodule and syncs its nested ones.
|
|
1661
|
+
*/
|
|
1662
|
+
declare const submoduleSync: (ctx: Context, opts?: SubmoduleSyncOptions) => Promise<SubmoduleSyncResult>;
|
|
1663
|
+
interface SubmoduleDeinitOptions {
|
|
1664
|
+
/** Submodule paths to deinitialise. Required unless `all` is set. */
|
|
1665
|
+
readonly paths?: ReadonlyArray<string>;
|
|
1666
|
+
/** Deinitialise every submodule. Required when `paths` is empty/omitted. */
|
|
1667
|
+
readonly all?: boolean;
|
|
1668
|
+
/** Discard a submodule working tree that has local modifications. */
|
|
1669
|
+
readonly force?: boolean;
|
|
1670
|
+
}
|
|
1671
|
+
interface SubmoduleDeinitEntry {
|
|
1672
|
+
readonly name: string;
|
|
1673
|
+
readonly path: FilePath;
|
|
1674
|
+
/** The raw `.gitmodules` URL (git's unregister message reports this form). */
|
|
1675
|
+
readonly url: string;
|
|
1676
|
+
/** True when a populated working tree was cleared. */
|
|
1677
|
+
readonly cleared: boolean;
|
|
1678
|
+
}
|
|
1679
|
+
interface SubmoduleDeinitResult {
|
|
1680
|
+
readonly entries: ReadonlyArray<SubmoduleDeinitEntry>;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Unregister submodules and clear their working trees (`git submodule deinit`).
|
|
1684
|
+
* Requires `paths` or `all`. Removes each submodule's `.git/config` section and
|
|
1685
|
+
* clears its working-tree contents (the empty directory, `.gitmodules`, the
|
|
1686
|
+
* index gitlink, and `.git/modules/<name>` are all left intact). Refuses a
|
|
1687
|
+
* submodule with local modifications unless `force`.
|
|
1688
|
+
*/
|
|
1689
|
+
declare const submoduleDeinit: (ctx: Context, opts?: SubmoduleDeinitOptions) => Promise<SubmoduleDeinitResult>;
|
|
1690
|
+
interface SubmoduleListOptions {
|
|
1691
|
+
/** Tree-ish to walk. Default: `'HEAD'`. */
|
|
1692
|
+
readonly ref?: string;
|
|
1693
|
+
/** Descend into nested submodules' own `.gitmodules`. Default: `false`. */
|
|
1694
|
+
readonly recursive?: boolean;
|
|
1695
|
+
/**
|
|
1696
|
+
* Cap on recursion depth. Default: `MAX_SUBMODULE_DEPTH`. Entries at exactly
|
|
1697
|
+
* this depth are yielded but not recursed into.
|
|
1698
|
+
*/
|
|
1699
|
+
readonly maxDepth?: number;
|
|
1700
|
+
}
|
|
1701
|
+
interface SubmoduleListResult {
|
|
1702
|
+
readonly entries: ReadonlyArray<SubmoduleEntry>;
|
|
1703
|
+
}
|
|
1704
|
+
declare const submoduleList: (ctx: Context, opts?: SubmoduleListOptions) => Promise<SubmoduleListResult>;
|
|
1705
|
+
interface SubmoduleAddOptions {
|
|
1706
|
+
/** Submodule URL — stored verbatim in `.gitmodules`, resolved for `.git/config`. */
|
|
1707
|
+
readonly url: string;
|
|
1708
|
+
/** Worktree-relative checkout path. */
|
|
1709
|
+
readonly path: string;
|
|
1710
|
+
/** `.gitmodules` subsection name. Default: `path` (git's `--name` default). */
|
|
1711
|
+
readonly name?: string;
|
|
1712
|
+
/** `-b`: track this branch instead of the remote default HEAD. */
|
|
1713
|
+
readonly branch?: string;
|
|
1714
|
+
}
|
|
1715
|
+
interface SubmoduleAddEntry {
|
|
1716
|
+
readonly name: string;
|
|
1717
|
+
readonly path: FilePath;
|
|
1718
|
+
/** Resolved URL written to `.git/config` + the module's `remote.origin.url`. */
|
|
1719
|
+
readonly url: string;
|
|
1720
|
+
/** Submodule HEAD oid staged as the gitlink. */
|
|
1721
|
+
readonly id: ObjectId;
|
|
1722
|
+
/** Checked-out branch (remote default HEAD branch, or `branch`). */
|
|
1723
|
+
readonly branch: string;
|
|
1724
|
+
}
|
|
1725
|
+
type SubmoduleAddResult = SubmoduleAddEntry;
|
|
1726
|
+
/**
|
|
1727
|
+
* Clone a new submodule into the worktree + `.git/modules/<name>` and register
|
|
1728
|
+
* it (`git submodule add`). Clones the remote into the absorbed gitdir, writes
|
|
1729
|
+
* `core.worktree` + the `.git` gitfile, materialises the working tree on the
|
|
1730
|
+
* remote default branch, writes `.gitmodules`, stages the gitlink +
|
|
1731
|
+
* `.gitmodules` blob, and records `submodule.<name>.{url,active}` in
|
|
1732
|
+
* `.git/config`. Refuses an unsafe/empty name/path/url or an already-tracked path.
|
|
1733
|
+
*/
|
|
1734
|
+
declare const submoduleAdd: (ctx: Context, opts: SubmoduleAddOptions) => Promise<SubmoduleAddResult>;
|
|
1735
|
+
interface SubmoduleUpdateOptions {
|
|
1736
|
+
/** Submodule paths to update. Default: every registered submodule. */
|
|
1737
|
+
readonly paths?: ReadonlyArray<string>;
|
|
1738
|
+
/** `--init`: register an unregistered submodule before updating it. */
|
|
1739
|
+
readonly init?: boolean;
|
|
1740
|
+
/** `--checkout`/`--rebase`/`--merge`: override the configured update mode. */
|
|
1741
|
+
readonly mode?: SubmoduleUpdateMode;
|
|
1742
|
+
}
|
|
1743
|
+
interface SubmoduleUpdateEntry {
|
|
1744
|
+
readonly name: string;
|
|
1745
|
+
readonly path: FilePath;
|
|
1746
|
+
/** Pinned gitlink oid the submodule was reconciled to. */
|
|
1747
|
+
readonly id: ObjectId;
|
|
1748
|
+
/** Mode actually applied. */
|
|
1749
|
+
readonly mode: SubmoduleUpdateMode;
|
|
1750
|
+
/** True when this call cloned the module gitdir. */
|
|
1751
|
+
readonly cloned: boolean;
|
|
1752
|
+
/** True when the submodule HEAD/branch moved (false ⇒ already in sync / none). */
|
|
1753
|
+
readonly changed: boolean;
|
|
1754
|
+
}
|
|
1755
|
+
interface SubmoduleUpdateResult {
|
|
1756
|
+
readonly entries: ReadonlyArray<SubmoduleUpdateEntry>;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Clone-if-missing + reconcile each registered, selected submodule to its pinned
|
|
1760
|
+
* commit (`git submodule update`). The pinned oid is read from the superproject
|
|
1761
|
+
* index gitlink; the module is cloned into `.git/modules/<name>` when absent,
|
|
1762
|
+
* then brought to the pin per its `update` mode (`checkout`/`rebase`/`merge`/
|
|
1763
|
+
* `none`; `opts.mode` overrides). An unregistered submodule is skipped unless
|
|
1764
|
+
* `init`. Refuses `OBJECT_NOT_FOUND` when the pin is absent after cloning (the
|
|
1765
|
+
* remote-advanced case — tsgit has no incremental fetch).
|
|
1766
|
+
*/
|
|
1767
|
+
declare const submoduleUpdate: (ctx: Context, opts?: SubmoduleUpdateOptions) => Promise<SubmoduleUpdateResult>;
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* The nested-namespace surface for `repo.submodule.*`. Each method runs the
|
|
1771
|
+
* caller-supplied `guard()` first (so a disposed repository throws before any
|
|
1772
|
+
* work) and then forwards to the corresponding context-aware command in
|
|
1773
|
+
* `commands/submodule.ts`.
|
|
1774
|
+
*/
|
|
1775
|
+
interface SubmoduleNamespace {
|
|
1776
|
+
readonly list: (opts?: SubmoduleListOptions) => Promise<SubmoduleListResult>;
|
|
1777
|
+
readonly add: (opts: SubmoduleAddOptions) => Promise<SubmoduleAddResult>;
|
|
1778
|
+
readonly init: (opts?: SubmoduleInitOptions) => Promise<SubmoduleInitResult>;
|
|
1779
|
+
readonly update: (opts?: SubmoduleUpdateOptions) => Promise<SubmoduleUpdateResult>;
|
|
1780
|
+
readonly sync: (opts?: SubmoduleSyncOptions) => Promise<SubmoduleSyncResult>;
|
|
1781
|
+
readonly deinit: (opts?: SubmoduleDeinitOptions) => Promise<SubmoduleDeinitResult>;
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Bind the `repo.submodule.*` nested-namespace dispatcher. `guard()` is the
|
|
1785
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1786
|
+
* it is invoked before every method forwards to its underlying command. The
|
|
1787
|
+
* returned object is frozen — callers cannot monkey-patch the namespace.
|
|
1788
|
+
*/
|
|
1789
|
+
declare const bindSubmoduleNamespace: (ctx: Context, guard: () => void) => SubmoduleNamespace;
|
|
1790
|
+
|
|
1791
|
+
interface TagInfo {
|
|
1792
|
+
readonly name: RefName;
|
|
1793
|
+
readonly id: ObjectId;
|
|
1794
|
+
}
|
|
1795
|
+
interface TagListResult {
|
|
1796
|
+
readonly tags: ReadonlyArray<TagInfo>;
|
|
1797
|
+
}
|
|
1798
|
+
interface TagCreateInput {
|
|
1799
|
+
readonly name: string;
|
|
1800
|
+
readonly target?: string;
|
|
1801
|
+
readonly force?: boolean;
|
|
1802
|
+
/** Create an annotated tag object (git's `-a`). Implied by `message` and `sign`. */
|
|
1803
|
+
readonly annotate?: boolean;
|
|
1804
|
+
/** Annotated tag message (git's `-m`). Setting this implies `annotate`. */
|
|
1805
|
+
readonly message?: string;
|
|
1806
|
+
/** GPG-sign the annotated tag (git's `-s`). Implies `annotate`; falls back to `tag.gpgSign` when unset. */
|
|
1807
|
+
readonly sign?: boolean;
|
|
1808
|
+
/** Signer key override (git's `-u <keyid>` / `--local-user`). */
|
|
1809
|
+
readonly signKey?: string;
|
|
1810
|
+
}
|
|
1811
|
+
interface TagCreateResult {
|
|
1812
|
+
readonly name: RefName;
|
|
1813
|
+
readonly id: ObjectId;
|
|
1814
|
+
}
|
|
1815
|
+
interface TagDeleteInput {
|
|
1816
|
+
readonly name: string;
|
|
1817
|
+
}
|
|
1818
|
+
interface TagDeleteResult {
|
|
1819
|
+
readonly name: RefName;
|
|
1820
|
+
}
|
|
1821
|
+
declare const tagList: (ctx: Context) => Promise<TagListResult>;
|
|
1822
|
+
declare const tagCreate: (ctx: Context, input: TagCreateInput) => Promise<TagCreateResult>;
|
|
1823
|
+
declare const tagDelete: (ctx: Context, input: TagDeleteInput) => Promise<TagDeleteResult>;
|
|
1824
|
+
|
|
1825
|
+
/**
|
|
1826
|
+
* The nested-namespace surface for `repo.tag.*`. Each method runs the
|
|
1827
|
+
* caller-supplied `guard()` first (so a disposed repository throws before any
|
|
1828
|
+
* work) and then forwards to the corresponding context-aware command in
|
|
1829
|
+
* `commands/tag.ts`.
|
|
1830
|
+
*/
|
|
1831
|
+
interface TagNamespace {
|
|
1832
|
+
readonly list: () => Promise<TagListResult>;
|
|
1833
|
+
readonly create: (input: TagCreateInput) => Promise<TagCreateResult>;
|
|
1834
|
+
readonly delete: (input: TagDeleteInput) => Promise<TagDeleteResult>;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Bind the `repo.tag.*` nested-namespace dispatcher. `guard()` is the
|
|
1838
|
+
* lifecycle gate (typically the disposed/closed check from `openRepository`);
|
|
1839
|
+
* it is invoked before every method forwards to its underlying command.
|
|
1840
|
+
*
|
|
1841
|
+
* The returned object is frozen — callers cannot monkey-patch methods onto
|
|
1842
|
+
* the namespace at runtime.
|
|
1843
|
+
*/
|
|
1844
|
+
declare const bindTagNamespace: (ctx: Context, guard: () => void) => TagNamespace;
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* Enumerate the repository's worktrees — the main worktree first, then each
|
|
1848
|
+
* linked worktree registered under `<commonDir>/worktrees/<id>/`, sorted by
|
|
1849
|
+
* path. A pure read over the admin pointer files; the shared branch refs resolve
|
|
1850
|
+
* through the common-dir ref store.
|
|
1851
|
+
*/
|
|
1852
|
+
|
|
1853
|
+
interface WorktreeEntry {
|
|
1854
|
+
/** Admin-directory id (`<commonDir>/worktrees/<id>`); absent for the main worktree. */
|
|
1855
|
+
readonly id?: string;
|
|
1856
|
+
/** Absolute worktree path. */
|
|
1857
|
+
readonly path: FilePath;
|
|
1858
|
+
/** HEAD commit oid; absent for an unborn branch or a bare main worktree. */
|
|
1859
|
+
readonly head?: ObjectId;
|
|
1860
|
+
/** Full branch refname HEAD points at; absent when detached or bare. */
|
|
1861
|
+
readonly branch?: RefName;
|
|
1862
|
+
readonly detached: boolean;
|
|
1863
|
+
readonly bare: boolean;
|
|
1864
|
+
/** Present ⇒ locked; `reason` is the recorded reason (`''` when none). */
|
|
1865
|
+
readonly locked?: {
|
|
1866
|
+
readonly reason: string;
|
|
1867
|
+
};
|
|
1868
|
+
/** Present ⇒ the admin entry's worktree is gone (prunable). */
|
|
1869
|
+
readonly prunable?: {
|
|
1870
|
+
readonly reason: string;
|
|
1871
|
+
};
|
|
1872
|
+
/** True for the primary worktree. */
|
|
1873
|
+
readonly main: boolean;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* `worktree` porcelain — the `repo.worktree.*` nested namespace. Manages linked
|
|
1878
|
+
* working trees over one object store: `list` / `add` / `move` / `remove`.
|
|
1879
|
+
*
|
|
1880
|
+
* Per ADR-249 the results are structured data — `list` returns the per-worktree
|
|
1881
|
+
* fields (path, head oid, branch, detached, bare, locked, prunable), never a
|
|
1882
|
+
* rendered table. The namespace binder lives in
|
|
1883
|
+
* `internal/worktree-namespace.ts`.
|
|
1884
|
+
*/
|
|
1885
|
+
|
|
1886
|
+
interface WorktreeListResult {
|
|
1887
|
+
readonly entries: ReadonlyArray<WorktreeEntry>;
|
|
1888
|
+
}
|
|
1889
|
+
/**
|
|
1890
|
+
* List the repository's worktrees (`git worktree list`) — the main worktree
|
|
1891
|
+
* first, then each linked worktree sorted by path.
|
|
1892
|
+
*/
|
|
1893
|
+
declare const worktreeList: (ctx: Context) => Promise<WorktreeListResult>;
|
|
1894
|
+
interface WorktreeAddOptions {
|
|
1895
|
+
/** Worktree-relative or absolute target directory for the new worktree. */
|
|
1896
|
+
readonly path: string;
|
|
1897
|
+
/** Start point (commit-ish); default `HEAD`. */
|
|
1898
|
+
readonly commitish?: string;
|
|
1899
|
+
/** `-b`: create this new branch at the start point. */
|
|
1900
|
+
readonly branch?: string;
|
|
1901
|
+
/** `--detach`: detached HEAD at the start point instead of a branch. */
|
|
1902
|
+
readonly detach?: boolean;
|
|
1903
|
+
/** Override the existing-branch / checked-out refusals. */
|
|
1904
|
+
readonly force?: boolean;
|
|
1905
|
+
}
|
|
1906
|
+
interface WorktreeAddResult {
|
|
1907
|
+
readonly path: FilePath;
|
|
1908
|
+
readonly id: string;
|
|
1909
|
+
readonly head: ObjectId;
|
|
1910
|
+
/** Created/checked-out branch; absent when detached. */
|
|
1911
|
+
readonly branch?: RefName;
|
|
1912
|
+
readonly detached: boolean;
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Create a linked worktree (`git worktree add`). Resolves the start point,
|
|
1916
|
+
* decides the mode (new branch from `-b`/the path basename, checkout of an
|
|
1917
|
+
* existing branch, or detached), creates the branch when needed, lays down the
|
|
1918
|
+
* admin pointer files + the `.git` gitfile, and materialises the working tree +
|
|
1919
|
+
* per-worktree index. Refuses a non-empty target, an existing branch (without
|
|
1920
|
+
* force), or a branch already used by another worktree (without force).
|
|
1921
|
+
*/
|
|
1922
|
+
declare const worktreeAdd: (ctx: Context, opts: WorktreeAddOptions) => Promise<WorktreeAddResult>;
|
|
1923
|
+
interface WorktreeMoveOptions {
|
|
1924
|
+
/** Move even when the worktree is locked. */
|
|
1925
|
+
readonly force?: boolean;
|
|
1926
|
+
}
|
|
1927
|
+
interface WorktreeMoveResult {
|
|
1928
|
+
readonly from: FilePath;
|
|
1929
|
+
readonly to: FilePath;
|
|
1930
|
+
readonly id: string;
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Relocate a linked worktree (`git worktree move`). Renames the worktree
|
|
1934
|
+
* directory and re-points the admin `gitdir` file at the new `.git` location;
|
|
1935
|
+
* the `.git` gitfile itself moves with the directory and still points at the
|
|
1936
|
+
* (unchanged) admin dir. Refuses a locked worktree (without force), a non-empty
|
|
1937
|
+
* destination, the main worktree, or a non-worktree source.
|
|
1938
|
+
*/
|
|
1939
|
+
declare const worktreeMove: (ctx: Context, from: string, to: string, opts?: WorktreeMoveOptions) => Promise<WorktreeMoveResult>;
|
|
1940
|
+
interface WorktreeRemoveOptions {
|
|
1941
|
+
/** Remove even when the worktree is dirty or locked. */
|
|
1942
|
+
readonly force?: boolean;
|
|
1943
|
+
}
|
|
1944
|
+
interface WorktreeRemoveResult {
|
|
1945
|
+
readonly path: FilePath;
|
|
1946
|
+
readonly id: string;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Remove a linked worktree (`git worktree remove`). Refuses a locked worktree or
|
|
1950
|
+
* one with modified/untracked files (without force), then deletes the worktree
|
|
1951
|
+
* directory and its admin dir. The branch is left intact. Refuses the main
|
|
1952
|
+
* worktree or a non-worktree path.
|
|
1953
|
+
*/
|
|
1954
|
+
declare const worktreeRemove: (ctx: Context, path: string, opts?: WorktreeRemoveOptions) => Promise<WorktreeRemoveResult>;
|
|
1955
|
+
|
|
1956
|
+
/**
|
|
1957
|
+
* The nested-namespace surface for `repo.worktree.*`. Each method runs the
|
|
1958
|
+
* caller-supplied `guard()` first (so a disposed repository throws before any
|
|
1959
|
+
* work) and then forwards to the corresponding context-aware command in
|
|
1960
|
+
* `commands/worktree.ts`.
|
|
1961
|
+
*/
|
|
1962
|
+
interface WorktreeNamespace {
|
|
1963
|
+
readonly list: () => Promise<WorktreeListResult>;
|
|
1964
|
+
readonly add: (opts: WorktreeAddOptions) => Promise<WorktreeAddResult>;
|
|
1965
|
+
readonly move: (from: string, to: string, opts?: WorktreeMoveOptions) => Promise<WorktreeMoveResult>;
|
|
1966
|
+
readonly remove: (path: string, opts?: WorktreeRemoveOptions) => Promise<WorktreeRemoveResult>;
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Bind the `repo.worktree.*` nested-namespace dispatcher. `guard()` is the
|
|
1970
|
+
* lifecycle gate from `openRepository`; it is invoked before every method
|
|
1971
|
+
* forwards to its underlying command. The returned object is frozen.
|
|
1972
|
+
*/
|
|
1973
|
+
declare const bindWorktreeNamespace: (ctx: Context, guard: () => void) => WorktreeNamespace;
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Walk order. `'date'` (default) yields every reachable commit across all
|
|
1977
|
+
* parents, newest committer-date first (git's default `git log` order);
|
|
1978
|
+
* `'first-parent'` follows only the first parent (`git log --first-parent`).
|
|
1979
|
+
*/
|
|
1980
|
+
type LogOrder = 'date' | 'first-parent';
|
|
1981
|
+
interface LogOptions {
|
|
1982
|
+
readonly rev?: string;
|
|
1983
|
+
readonly order?: LogOrder;
|
|
1984
|
+
readonly limit?: number;
|
|
1985
|
+
readonly excluding?: ReadonlyArray<string>;
|
|
1986
|
+
readonly before?: Date;
|
|
1987
|
+
readonly minParents?: number;
|
|
1988
|
+
readonly maxParents?: number;
|
|
1989
|
+
}
|
|
1990
|
+
interface LogEntry {
|
|
1991
|
+
readonly id: ObjectId;
|
|
1992
|
+
readonly tree: ObjectId;
|
|
1993
|
+
readonly parents: ReadonlyArray<ObjectId>;
|
|
1994
|
+
readonly author: AuthorIdentity;
|
|
1995
|
+
readonly committer: AuthorIdentity;
|
|
1996
|
+
readonly message: string;
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Walk commits starting from `rev` (default: HEAD), yielding ordered `LogEntry`
|
|
2000
|
+
* records. By default walks every reachable commit across all parents in
|
|
2001
|
+
* committer-date order; `order: 'first-parent'` follows only the first parent.
|
|
2002
|
+
* Honors `limit`, `excluding` (commit-ish stops), `before` (only commits with
|
|
2003
|
+
* `committer.timestamp < before`), and `minParents`/`maxParents` (parent-count band).
|
|
2004
|
+
*/
|
|
2005
|
+
declare const log: (ctx: Context, opts?: LogOptions) => Promise<ReadonlyArray<LogEntry>>;
|
|
2006
|
+
|
|
2007
|
+
interface MvOptions {
|
|
2008
|
+
/** Overwrite an existing destination (a file source only). `-f`. */
|
|
2009
|
+
readonly force?: boolean;
|
|
2010
|
+
/** Validate and report the plan without touching index or working tree. `-n`. */
|
|
2011
|
+
readonly dryRun?: boolean;
|
|
2012
|
+
/** Skip refused (source → target) pairs instead of aborting the whole call. `-k`. */
|
|
2013
|
+
readonly skipErrors?: boolean;
|
|
2014
|
+
}
|
|
2015
|
+
interface MvMove {
|
|
2016
|
+
readonly from: FilePath;
|
|
2017
|
+
readonly to: FilePath;
|
|
2018
|
+
}
|
|
2019
|
+
/** Per-source refusals that `skipErrors` collects rather than throwing. */
|
|
2020
|
+
type MvSkipReason = 'source-not-tracked' | 'bad-source' | 'destination-exists' | 'into-self';
|
|
2021
|
+
interface MvSkipped {
|
|
2022
|
+
readonly source: FilePath;
|
|
2023
|
+
readonly reason: MvSkipReason;
|
|
2024
|
+
}
|
|
2025
|
+
interface MvResult {
|
|
2026
|
+
readonly moved: ReadonlyArray<MvMove>;
|
|
2027
|
+
readonly skipped: ReadonlyArray<MvSkipped>;
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* Move/rename tracked paths in the index and the working tree, faithful to
|
|
2031
|
+
* `git mv`. Each (source → target) pair is validated up front; on any refusal
|
|
2032
|
+
* nothing is moved (unless `skipErrors`). Blob ids and modes are copied from the
|
|
2033
|
+
* source's index entry — the working file is renamed as-is, never re-hashed.
|
|
2034
|
+
*/
|
|
2035
|
+
declare const mv: (ctx: Context, sources: ReadonlyArray<string>, destination: string, opts?: MvOptions) => Promise<MvResult>;
|
|
2036
|
+
|
|
2037
|
+
interface PullOptions {
|
|
2038
|
+
/**
|
|
2039
|
+
* Remote to pull from. Default: `branch.<current>.remote` ?? the sole
|
|
2040
|
+
* configured remote ?? `'origin'`.
|
|
2041
|
+
*/
|
|
2042
|
+
readonly remote?: string;
|
|
2043
|
+
/**
|
|
2044
|
+
* Remote ref to merge — a short branch name resolved as
|
|
2045
|
+
* `refs/remotes/<remote>/<ref>`. Default: short form of
|
|
2046
|
+
* `branch.<current>.merge`. When neither is resolvable, pull throws
|
|
2047
|
+
* `NO_UPSTREAM_CONFIGURED`.
|
|
2048
|
+
*/
|
|
2049
|
+
readonly ref?: string;
|
|
2050
|
+
/**
|
|
2051
|
+
* Fast-forward policy for the integrate step, forwarded to `merge` (git
|
|
2052
|
+
* `--ff` / `--ff-only` / `--no-ff`):
|
|
2053
|
+
* - `'allow'` (default) — fast-forward when possible, else a true merge.
|
|
2054
|
+
* - `'only'` — reject when a true merge would be required.
|
|
2055
|
+
* - `'never'` — always create a merge commit, even when a fast-forward is possible.
|
|
2056
|
+
*/
|
|
2057
|
+
readonly fastForward?: 'only' | 'never' | 'allow';
|
|
2058
|
+
/** Prune deleted remote-tracking refs during the fetch step. */
|
|
2059
|
+
readonly prune?: boolean;
|
|
2060
|
+
/** Shallow fetch depth, forwarded to fetch. */
|
|
2061
|
+
readonly depth?: number;
|
|
2062
|
+
/** Override the generated merge commit message / MERGE_MSG. */
|
|
2063
|
+
readonly message?: string;
|
|
2064
|
+
/** Identity for the merge commit (true-merge path only). */
|
|
2065
|
+
readonly author?: AuthorIdentity;
|
|
2066
|
+
readonly committer?: AuthorIdentity;
|
|
2067
|
+
}
|
|
2068
|
+
interface PullResult {
|
|
2069
|
+
readonly fetch: FetchResult;
|
|
2070
|
+
readonly merge: MergeResult;
|
|
2071
|
+
}
|
|
2072
|
+
declare const pull: (ctx: Context, opts?: PullOptions) => Promise<PullResult>;
|
|
2073
|
+
|
|
2074
|
+
interface PushOptions {
|
|
2075
|
+
readonly remote?: string;
|
|
2076
|
+
readonly refspecs?: ReadonlyArray<string>;
|
|
2077
|
+
readonly force?: boolean;
|
|
2078
|
+
readonly forceWithLease?: ObjectId | 'auto';
|
|
2079
|
+
/** Skip the `pre-push` hook (git's `--no-verify`). */
|
|
2080
|
+
readonly noVerify?: boolean;
|
|
2081
|
+
/**
|
|
2082
|
+
* GPG-sign the push certificate (git's `--signed`). `'yes'` refuses when
|
|
2083
|
+
* the receiving end doesn't advertise `push-cert`; `'if-asked'` falls back
|
|
2084
|
+
* to an unsigned push in that case. Falls back to `push.gpgSign` when unset.
|
|
2085
|
+
*/
|
|
2086
|
+
readonly signed?: 'yes' | 'no' | 'if-asked';
|
|
2087
|
+
}
|
|
2088
|
+
interface PushedRef {
|
|
2089
|
+
readonly name: RefName;
|
|
2090
|
+
readonly oldId: ObjectId;
|
|
2091
|
+
readonly newId: ObjectId;
|
|
2092
|
+
readonly status: 'ok' | 'rejected';
|
|
2093
|
+
readonly reason?: string;
|
|
2094
|
+
}
|
|
2095
|
+
interface PushResult {
|
|
2096
|
+
readonly remote: string;
|
|
2097
|
+
readonly url: string;
|
|
2098
|
+
readonly pushedRefs: ReadonlyArray<PushedRef>;
|
|
2099
|
+
}
|
|
2100
|
+
declare const push: (ctx: Context, opts?: PushOptions) => Promise<PushResult>;
|
|
2101
|
+
|
|
2102
|
+
/**
|
|
2103
|
+
* Order the corresponded patches into git's `range-diff` output sequence
|
|
2104
|
+
* (`output` in `range-diff.c`): drive by the new range, slotting deleted old
|
|
2105
|
+
* commits in once their predecessors are shown. Each emitted pair becomes a
|
|
2106
|
+
* structured `RangeDiffEntry` — status (`= ! < >`), the old/new commit position
|
|
2107
|
+
* + oid, the shown subject (old's when present), and, for a `changed` pair, the
|
|
2108
|
+
* structured diff-of-diffs (`diffLines` of the two `## ` patch texts).
|
|
2109
|
+
*/
|
|
2110
|
+
|
|
2111
|
+
type RangeDiffStatus = 'unchanged' | 'changed' | 'only-old' | 'only-new';
|
|
2112
|
+
interface RangeDiffCommit {
|
|
2113
|
+
/** 1-based position of the commit in its (merge-filtered, oldest-first) series. */
|
|
2114
|
+
readonly position: number;
|
|
2115
|
+
readonly id: ObjectId;
|
|
2116
|
+
}
|
|
2117
|
+
interface RangeDiffEntry {
|
|
2118
|
+
readonly status: RangeDiffStatus;
|
|
2119
|
+
readonly old?: RangeDiffCommit;
|
|
2120
|
+
readonly new?: RangeDiffCommit;
|
|
2121
|
+
readonly subject: string;
|
|
2122
|
+
/** The diff-of-diffs (`diffLines(old.patch, new.patch)`); present iff `changed`. */
|
|
2123
|
+
readonly diffOfDiffs?: LineDiff;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
/**
|
|
2127
|
+
* Tier-1 `range-diff` command — git's `git range-diff`: compare two commit
|
|
2128
|
+
* ranges and report, commit-by-commit, which patches were added, removed, left
|
|
2129
|
+
* unchanged, or changed. Returns structured data only (ADR-249): the ordered
|
|
2130
|
+
* correspondence list, each changed pair carrying the structured diff-of-diffs.
|
|
2131
|
+
* The command owns the I/O — resolving the range endpoints, walking each
|
|
2132
|
+
* `base..tip` (date order, oldest-first, merges excluded), and reading the trees
|
|
2133
|
+
* and blobs — then hands the pure domain orchestrator two hydrated patch series.
|
|
2134
|
+
*/
|
|
2135
|
+
|
|
2136
|
+
/** A commit range — `base..tip`, each a commit-ish (full rev grammar). */
|
|
2137
|
+
interface RangeDiffRange {
|
|
2138
|
+
readonly base: string;
|
|
2139
|
+
readonly tip: string;
|
|
2140
|
+
}
|
|
2141
|
+
interface RangeDiffOptions {
|
|
2142
|
+
/** The first / "old" range. */
|
|
2143
|
+
readonly old: RangeDiffRange;
|
|
2144
|
+
/** The second / "new" range. */
|
|
2145
|
+
readonly new: RangeDiffRange;
|
|
2146
|
+
/** git's `--creation-factor` (percentage); default `60`. */
|
|
2147
|
+
readonly creationFactor?: number;
|
|
2148
|
+
}
|
|
2149
|
+
declare const rangeDiff: (ctx: Context, opts: RangeDiffOptions) => Promise<ReadonlyArray<RangeDiffEntry>>;
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* Tier-1 `readFileAt` command — read a file's bytes as of a revision, the
|
|
2153
|
+
* structured equivalent of `git show <rev>:<path>` / `git cat-file blob
|
|
2154
|
+
* <rev>:<path>`.
|
|
2155
|
+
*
|
|
2156
|
+
* Resolves `rev` through the full rev-parse grammar (short names, `~`/`^`
|
|
2157
|
+
* navigation, abbreviated oids, reflog selectors), peels to its root tree,
|
|
2158
|
+
* descends `path`'s `/`-separated components, and returns the addressed blob —
|
|
2159
|
+
* refusing a directory or gitlink with `UNEXPECTED_OBJECT_TYPE` and a missing
|
|
2160
|
+
* path with `PATH_NOT_IN_TREE`. The library renders nothing; the caller owns any
|
|
2161
|
+
* display.
|
|
2162
|
+
*/
|
|
2163
|
+
|
|
2164
|
+
/** Structured result of reading a file's bytes as of a revision. */
|
|
2165
|
+
interface ReadFileAtResult {
|
|
2166
|
+
/** The addressed blob's object id. */
|
|
2167
|
+
readonly id: ObjectId;
|
|
2168
|
+
/** The file's tree-entry mode (`100644` | `100755` | `120000`). */
|
|
2169
|
+
readonly mode: FileMode;
|
|
2170
|
+
/** The blob's raw, verbatim committed bytes. */
|
|
2171
|
+
readonly content: Uint8Array;
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Read the file addressed by `path` in the tree of `rev`.
|
|
2175
|
+
*
|
|
2176
|
+
* @param rev - any rev-parse expression (e.g. `HEAD`, `main`, `v1.0`, `HEAD~3`,
|
|
2177
|
+
* an abbreviated oid).
|
|
2178
|
+
* @param path - a `/`-separated tree path to the file.
|
|
2179
|
+
* @param options - forwarded to the final blob read; `maxBytes` bounds the file
|
|
2180
|
+
* (`OBJECT_TOO_LARGE` when exceeded), `verifyHash` re-checks its hash.
|
|
2181
|
+
*/
|
|
2182
|
+
declare const readFileAt: (ctx: Context, rev: string, path: string, options?: ReadObjectOptions) => Promise<ReadFileAtResult>;
|
|
2183
|
+
|
|
2184
|
+
type ReflogAction = {
|
|
2185
|
+
readonly action?: 'show';
|
|
2186
|
+
readonly ref?: string;
|
|
2187
|
+
} | {
|
|
2188
|
+
readonly action: 'exists';
|
|
2189
|
+
readonly ref: string;
|
|
2190
|
+
} | {
|
|
2191
|
+
readonly action: 'delete';
|
|
2192
|
+
readonly ref: string;
|
|
2193
|
+
readonly index: number;
|
|
2194
|
+
readonly rewrite?: boolean;
|
|
2195
|
+
} | {
|
|
2196
|
+
readonly action: 'expire';
|
|
2197
|
+
readonly ref?: string;
|
|
2198
|
+
readonly all?: boolean;
|
|
2199
|
+
readonly expire?: string;
|
|
2200
|
+
readonly expireUnreachable?: string;
|
|
2201
|
+
};
|
|
2202
|
+
/** One reflog entry as `show` presents it: newest-first, with a selector. */
|
|
2203
|
+
interface ReflogShowEntry {
|
|
2204
|
+
readonly index: number;
|
|
2205
|
+
readonly selector: string;
|
|
2206
|
+
readonly entry: ReflogEntry;
|
|
2207
|
+
}
|
|
2208
|
+
type ReflogResult = {
|
|
2209
|
+
readonly kind: 'show';
|
|
2210
|
+
readonly ref: RefName;
|
|
2211
|
+
readonly entries: ReadonlyArray<ReflogShowEntry>;
|
|
2212
|
+
} | {
|
|
2213
|
+
readonly kind: 'exists';
|
|
2214
|
+
readonly exists: boolean;
|
|
2215
|
+
} | {
|
|
2216
|
+
readonly kind: 'expire';
|
|
2217
|
+
readonly removed: number;
|
|
2218
|
+
readonly kept: number;
|
|
2219
|
+
} | {
|
|
2220
|
+
readonly kind: 'delete';
|
|
2221
|
+
readonly removed: ReflogEntry;
|
|
2222
|
+
};
|
|
2223
|
+
declare const reflog: (ctx: Context, opts?: ReflogAction) => Promise<ReflogResult>;
|
|
2224
|
+
|
|
2225
|
+
type ResetMode = 'soft' | 'mixed' | 'hard';
|
|
2226
|
+
interface ResetOptions {
|
|
2227
|
+
readonly mode: ResetMode;
|
|
2228
|
+
readonly rev: string;
|
|
2229
|
+
}
|
|
2230
|
+
interface ResetResult {
|
|
2231
|
+
readonly mode: ResetMode;
|
|
2232
|
+
readonly id: ObjectId;
|
|
2233
|
+
readonly branch: RefName | undefined;
|
|
2234
|
+
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Reset HEAD (and optionally index/working tree) to `rev`.
|
|
2237
|
+
*
|
|
2238
|
+
* - `soft`: HEAD only.
|
|
2239
|
+
* - `mixed`: HEAD + rebuild the index from the target commit's tree
|
|
2240
|
+
* (stat-cache donor strategy preserves cache for unchanged paths —
|
|
2241
|
+
* ). Working tree is NOT touched.
|
|
2242
|
+
* - `hard`: HEAD + index + working tree — materialise the target tree onto
|
|
2243
|
+
* the working tree with `force: true`, then commit the post-write
|
|
2244
|
+
* index entries. Bare repos are rejected upfront.
|
|
2245
|
+
*
|
|
2246
|
+
* Ordering: working tree → index → HEAD. The index lock wraps both the
|
|
2247
|
+
* working-tree write AND the index commit, matching tightened
|
|
2248
|
+
* pattern. A crash between the index commit and HEAD update leaves the index
|
|
2249
|
+
* ahead of HEAD — same recoverable hazard as canonical git.
|
|
2250
|
+
*/
|
|
2251
|
+
declare const reset: (ctx: Context, opts: ResetOptions) => Promise<ResetResult>;
|
|
2252
|
+
|
|
2253
|
+
declare const revParse: (ctx: Context, expression: string) => Promise<ObjectId>;
|
|
2254
|
+
|
|
2255
|
+
interface RmOptions {
|
|
2256
|
+
readonly cached?: boolean;
|
|
2257
|
+
/** Override the safety valve (`-f`) — remove even staged / locally-modified paths. */
|
|
2258
|
+
readonly force?: boolean;
|
|
2259
|
+
}
|
|
2260
|
+
interface RmResult {
|
|
2261
|
+
readonly removed: ReadonlyArray<FilePath>;
|
|
2262
|
+
}
|
|
2263
|
+
/**
|
|
2264
|
+
* Remove the given paths from the index (and from the working tree unless
|
|
2265
|
+
* `cached: true`). Refuses when a path isn't tracked, matches `git rm`'s default.
|
|
2266
|
+
*/
|
|
2267
|
+
declare const rm: (ctx: Context, paths: ReadonlyArray<string>, opts?: RmOptions) => Promise<RmResult>;
|
|
2268
|
+
|
|
2269
|
+
/** One commit within a `shortlog` group. */
|
|
2270
|
+
interface ShortlogCommit {
|
|
2271
|
+
readonly id: ObjectId;
|
|
2272
|
+
readonly email: string;
|
|
2273
|
+
readonly subject: string;
|
|
2274
|
+
}
|
|
2275
|
+
/** A per-identity-name `shortlog` group; commits are oldest first. */
|
|
2276
|
+
interface ShortlogGroup {
|
|
2277
|
+
readonly name: string;
|
|
2278
|
+
readonly commits: ReadonlyArray<ShortlogCommit>;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Tier-1 `shortlog` command — git's `git shortlog`: walk the commits reachable
|
|
2283
|
+
* from a revision and group them by author (or committer) identity. Returns
|
|
2284
|
+
* structured data only (ADR-249): per-author groups keyed by the identity name,
|
|
2285
|
+
* each commit carrying `{ id, email, subject }` (git's cleaned shortlog oneline),
|
|
2286
|
+
* oldest first; groups byte-sorted by name. The `-e` / `-n` / `-s` renderings are
|
|
2287
|
+
* caller projections.
|
|
2288
|
+
*/
|
|
2289
|
+
|
|
2290
|
+
/** Which identity keys the grouping. */
|
|
2291
|
+
type ShortlogBy = 'author' | 'committer';
|
|
2292
|
+
interface ShortlogOptions {
|
|
2293
|
+
/** Commit-ish to start the walk from (full rev grammar); default `'HEAD'`. */
|
|
2294
|
+
readonly rev?: string;
|
|
2295
|
+
/** Commit-ish stops excluded from the walk (git's `A..B` / `^X` ranges). */
|
|
2296
|
+
readonly excluding?: ReadonlyArray<string>;
|
|
2297
|
+
/** Group by author (default) or committer identity. */
|
|
2298
|
+
readonly by?: ShortlogBy;
|
|
2299
|
+
}
|
|
2300
|
+
declare const shortlog: (ctx: Context, opts?: ShortlogOptions) => Promise<ReadonlyArray<ShortlogGroup>>;
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Tier-1 `show` command — structured object data for commit / tag / tree / blob
|
|
2304
|
+
* revisions. Resolves each revision (full rev-parse grammar, no tag auto-peel),
|
|
2305
|
+
* reads the object, and returns a structured `ShowResult`: a commit carries its
|
|
2306
|
+
* `CommitData` plus the diff against its parent (`patch`) or, for a merge, one
|
|
2307
|
+
* diff per parent (`perParent`); a tag carries its `TagData` and the recursively
|
|
2308
|
+
* shown target; a tree carries its entries; a blob carries its raw content.
|
|
2309
|
+
*
|
|
2310
|
+
* The library renders nothing — assembling `git show`'s display (commit/Merge
|
|
2311
|
+
* headers, dates, the unified patch, combined-diff for merges) from these fields
|
|
2312
|
+
* is the caller's concern.
|
|
2313
|
+
*/
|
|
2314
|
+
|
|
2315
|
+
type ShowInput = string | ReadonlyArray<string>;
|
|
2316
|
+
interface ShowOptions {
|
|
2317
|
+
/**
|
|
2318
|
+
* Attach per-file line counts (`added` / `deleted` / `binary`) to the diff(s)
|
|
2319
|
+
* — the data half of git's `--numstat`. Off by default (no blob reads).
|
|
2320
|
+
*/
|
|
2321
|
+
readonly withStat?: boolean;
|
|
2322
|
+
}
|
|
2323
|
+
interface ShowTreeEntry {
|
|
2324
|
+
readonly name: string;
|
|
2325
|
+
readonly mode: FileMode;
|
|
2326
|
+
readonly id: ObjectId;
|
|
2327
|
+
}
|
|
2328
|
+
interface ShowCommitResult<D = TreeDiff> {
|
|
2329
|
+
readonly kind: 'commit';
|
|
2330
|
+
readonly id: ObjectId;
|
|
2331
|
+
readonly commit: CommitData;
|
|
2332
|
+
/** Diff against the single parent (root: against the empty tree). Absent for merges. */
|
|
2333
|
+
readonly patch?: D;
|
|
2334
|
+
/** One diff per parent, for a merge (≥2 parents). Absent for non-merges. */
|
|
2335
|
+
readonly perParent?: ReadonlyArray<D>;
|
|
2336
|
+
}
|
|
2337
|
+
interface ShowTagResult<D = TreeDiff> {
|
|
2338
|
+
readonly kind: 'tag';
|
|
2339
|
+
readonly id: ObjectId;
|
|
2340
|
+
readonly tag: TagData;
|
|
2341
|
+
readonly target: ShowResult<D>;
|
|
2342
|
+
}
|
|
2343
|
+
interface ShowTreeResult {
|
|
2344
|
+
readonly kind: 'tree';
|
|
2345
|
+
readonly id: ObjectId;
|
|
2346
|
+
readonly entries: ReadonlyArray<ShowTreeEntry>;
|
|
2347
|
+
}
|
|
2348
|
+
interface ShowBlobResult {
|
|
2349
|
+
readonly kind: 'blob';
|
|
2350
|
+
readonly id: ObjectId;
|
|
2351
|
+
readonly content: Uint8Array;
|
|
2352
|
+
}
|
|
2353
|
+
type ShowResult<D = TreeDiff> = ShowCommitResult<D> | ShowTagResult<D> | ShowTreeResult | ShowBlobResult;
|
|
2354
|
+
declare function show(ctx: Context, rev: ReadonlyArray<string>, opts: ShowOptions & {
|
|
2355
|
+
withStat: true;
|
|
2356
|
+
}): Promise<ReadonlyArray<ShowResult<StatTreeDiff>>>;
|
|
2357
|
+
declare function show(ctx: Context, rev: string | undefined, opts: ShowOptions & {
|
|
2358
|
+
withStat: true;
|
|
2359
|
+
}): Promise<ShowResult<StatTreeDiff>>;
|
|
2360
|
+
declare function show(ctx: Context, rev: ReadonlyArray<string>, opts?: ShowOptions): Promise<ReadonlyArray<ShowResult>>;
|
|
2361
|
+
declare function show(ctx: Context, rev?: string, opts?: ShowOptions): Promise<ShowResult>;
|
|
2362
|
+
|
|
2363
|
+
type ChangeKind = 'modified' | 'added' | 'deleted' | 'type-changed' | 'mode-changed';
|
|
2364
|
+
|
|
2365
|
+
/** A blob reference on one side of a comparison: its object id and file mode. */
|
|
2366
|
+
interface BlobSide {
|
|
2367
|
+
readonly id: ObjectId;
|
|
2368
|
+
readonly mode: FileMode;
|
|
2369
|
+
}
|
|
2370
|
+
/**
|
|
2371
|
+
* The working-tree side of a change: mode only. The working file need not be in
|
|
2372
|
+
* the object store, so git reports its mode (`mW`) but no working blob oid.
|
|
2373
|
+
*/
|
|
2374
|
+
interface WorktreeSide {
|
|
2375
|
+
readonly mode: FileMode;
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* One tracked path with a staged and/or unstaged change — the structured form of
|
|
2379
|
+
* `git status --porcelain=v2`'s ordinary changed-entry line. At least one of
|
|
2380
|
+
* `staged` (index vs HEAD, git's X) and `unstaged` (worktree vs index, git's Y) is
|
|
2381
|
+
* present. The `head` / `index` / `worktree` sides carry the blobs that form the
|
|
2382
|
+
* change's diffs; a side is omitted when the path does not exist there (staged add
|
|
2383
|
+
* → no `head`; staged delete → no `index`; deleted in the worktree → no
|
|
2384
|
+
* `worktree`). The hunks for any path are one read away — staged: `head` blob ↔
|
|
2385
|
+
* `index` blob; unstaged: `index` blob ↔ the working file at `path`.
|
|
2386
|
+
*/
|
|
2387
|
+
interface ChangedPath {
|
|
2388
|
+
readonly path: FilePath;
|
|
2389
|
+
readonly staged?: ChangeKind;
|
|
2390
|
+
readonly unstaged?: ChangeKind;
|
|
2391
|
+
readonly head?: BlobSide;
|
|
2392
|
+
readonly index?: BlobSide;
|
|
2393
|
+
readonly worktree?: WorktreeSide;
|
|
2394
|
+
}
|
|
2395
|
+
/**
|
|
2396
|
+
* An unmerged (conflicted) path: its git conflict state plus the per-stage blobs
|
|
2397
|
+
* (`base` = stage 1, `ours` = stage 2, `theirs` = stage 3; omitted when that stage
|
|
2398
|
+
* is absent) and the conflicted file's on-disk mode (`worktree`, git's `mW`;
|
|
2399
|
+
* omitted when the file is absent on disk). The stages plus `worktree` make the
|
|
2400
|
+
* entry lossless against git's porcelain unmerged reporting (v1 `XY` from `kind`,
|
|
2401
|
+
* the full v2 `u`-line modes/oids from the stages and `worktree`).
|
|
2402
|
+
*/
|
|
2403
|
+
interface UnmergedEntry {
|
|
2404
|
+
readonly kind: ConflictKind;
|
|
2405
|
+
readonly path: FilePath;
|
|
2406
|
+
readonly base?: BlobSide;
|
|
2407
|
+
readonly ours?: BlobSide;
|
|
2408
|
+
readonly theirs?: BlobSide;
|
|
2409
|
+
readonly worktree?: WorktreeSide;
|
|
2410
|
+
}
|
|
2411
|
+
interface StatusResult {
|
|
2412
|
+
readonly branch: RefName | undefined;
|
|
2413
|
+
readonly detached: boolean;
|
|
2414
|
+
readonly changes: ReadonlyArray<ChangedPath>;
|
|
2415
|
+
readonly untracked: ReadonlyArray<FilePath>;
|
|
2416
|
+
readonly unmerged: ReadonlyArray<UnmergedEntry>;
|
|
2417
|
+
readonly clean: boolean;
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Summarize the state of the working tree against git's columns, one correlated
|
|
2421
|
+
* record per changed path. `changes` carries each tracked path's **staged** column
|
|
2422
|
+
* (index vs HEAD-tree, git's "Changes to be committed") and **working-tree** column
|
|
2423
|
+
* (index vs working tree) together with the blob endpoints of each side — the
|
|
2424
|
+
* structured form of `git status --porcelain=v2`'s ordinary line. `untracked` is
|
|
2425
|
+
* the separate set of untracked paths (git's `?` lines); `unmerged` is the
|
|
2426
|
+
* conflicted column (stage 1/2/3 blobs, git's "Unmerged paths"). A conflicted path
|
|
2427
|
+
* is reported only under `unmerged`. `clean` is true only when all three are empty.
|
|
2428
|
+
*
|
|
2429
|
+
* Progress reporting: emits `status:scan` start before the working-tree fan-out,
|
|
2430
|
+
* updates every 100 lstat completions, and end in a finally block so the consumer
|
|
2431
|
+
* always pairs start with end. `total` is undefined — a design choice that avoids
|
|
2432
|
+
* revealing repository size to non-trusted progress sinks.
|
|
2433
|
+
*/
|
|
2434
|
+
declare const status: (ctx: Context) => Promise<StatusResult>;
|
|
2435
|
+
|
|
2436
|
+
/**
|
|
2437
|
+
* Tier-1 `whatchanged` command — git's `git whatchanged` (modern alias for
|
|
2438
|
+
* `git log --raw --no-merges`): walk the commits reachable from a revision and
|
|
2439
|
+
* pair each non-merge commit with the raw structured changes it introduced
|
|
2440
|
+
* against its first parent (root: against the empty tree). Merge commits are
|
|
2441
|
+
* excluded from the output but still traversed for reachability.
|
|
2442
|
+
*
|
|
2443
|
+
* Returns structured data only (ADR-249): each entry reuses `log`'s commit
|
|
2444
|
+
* projection (`WhatchangedEntry extends LogEntry`) plus a `TreeDiff`. The `--raw`
|
|
2445
|
+
* line rendering, oid abbreviation, and date formatting are caller concerns.
|
|
2446
|
+
*/
|
|
2447
|
+
|
|
2448
|
+
interface WhatchangedOptions {
|
|
2449
|
+
readonly rev?: string;
|
|
2450
|
+
readonly order?: LogOrder;
|
|
2451
|
+
readonly limit?: number;
|
|
2452
|
+
readonly excluding?: ReadonlyArray<string>;
|
|
2453
|
+
readonly before?: Date;
|
|
2454
|
+
}
|
|
2455
|
+
interface WhatchangedEntry extends LogEntry {
|
|
2456
|
+
/** Raw changes against the first parent (root: against the empty tree). */
|
|
2457
|
+
readonly changes: TreeDiff;
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Walk commits from `rev` (default HEAD), excluding merges (≥2 parents), and pair
|
|
2461
|
+
* each with its first-parent `TreeDiff` (recursive, rename-detecting like
|
|
2462
|
+
* `git show`). Honors `order`, `limit` (counts emitted entries), `excluding`
|
|
2463
|
+
* (commit-ish stops), and `before` (only `committer.timestamp < before`).
|
|
2464
|
+
*/
|
|
2465
|
+
declare const whatchanged: (ctx: Context, opts?: WhatchangedOptions) => Promise<ReadonlyArray<WhatchangedEntry>>;
|
|
2466
|
+
|
|
2467
|
+
export { BINARY_DETECTION_BYTES as B, MAX_DIFF_EDIT_DISTANCE as aL, MAX_DIFF_ITERATION_FACTOR as aM, MAX_DIFF_LINES as aN, MAX_LINES as aO, MAX_LINE_BYTES as aP, nameRev as d$, add as d1, archive as d2, bindBranchNamespace as d3, bindBundleNamespace as d4, bindCherryPickNamespace as d5, bindConfigNamespace as d6, bindMergeNamespace as d7, bindNotesNamespace as d8, bindRebaseNamespace as d9, configGet as dA, configGetAll as dB, configGetRegexp as dC, configList as dD, configRemoveSection as dE, configRenameSection as dF, configSet as dG, configUnset as dH, configUnsetAll as dI, conflictsToIndexEntries as dJ, createPromisorRemote as dK, describe as dL, diff as dM, diffIndexAgainstTree as dN, diffLines as dO, fetch as dP, fetchMissing as dQ, fsck as dR, grep as dS, groupUnmergedEntries as dT, init as dU, isBinary as dV, log as dW, mergeAbort as dX, mergeContinue as dY, mergeRun as dZ, mv as d_, bindRemoteNamespace as da, bindRevertNamespace as db, bindSparseCheckoutNamespace as dc, bindStashNamespace as dd, bindSubmoduleNamespace as de, bindTagNamespace as df, bindWorktreeNamespace as dg, blame as dh, branchCreate as di, branchDelete as dj, branchList as dk, branchRename as dl, buildGrepMatcher as dm, bundleCreate as dn, bundleListHeads as dp, bundleVerify as dq, catFile as dr, checkout as ds, cherryPickAbort as dt, cherryPickContinue as du, cherryPickRun as dv, cherryPickSkip as dw, classifyUnmerged as dx, clone as dy, commit as dz, notesAdd as e0, notesList as e1, notesRead as e2, notesRemove as e3, pull as e4, push as e5, rangeDiff as e6, readFileAt as e7, rebaseAbort as e8, rebaseContinue as e9, stashApply as eA, stashDrop as eB, stashList as eC, stashPop as eD, stashPush as eE, status as eF, submoduleAdd as eG, submoduleDeinit as eH, submoduleInit as eI, submoduleList as eJ, submoduleSync as eK, submoduleUpdate as eL, tagCreate as eM, tagDelete as eN, tagList as eO, whatchanged as eP, worktreeAdd as eQ, worktreeList as eR, worktreeMove as eS, worktreeRemove as eT, rebaseRun as ea, rebaseSkip as eb, recordedPaths as ec, reflog as ed, remoteAdd as ee, remoteList as ef, remoteRemove as eg, remoteRename as eh, remoteSetUrl as ei, remoteShow as ej, reset as ek, revParse as el, revertAbort as em, revertContinue as en, revertRun as eo, revertSkip as ep, rm as eq, shortlog as er, show as es, sortedRecordedPaths as et, sparseCheckoutAdd as eu, sparseCheckoutDisable as ev, sparseCheckoutList as ew, sparseCheckoutReapply as ex, sparseCheckoutSet as ey, splitLines as ez };
|
|
2468
|
+
export type { ConfigGetInput as $, AddOptions as A, BundleRevArg as C, BundleVerifyInput as D, BundleVerifyResult as E, BundleVersion as F, CatFileInput as G, CatFileResult as H, ChangeKind as I, ChangedPath as J, CheckoutOptions as K, CheckoutResult as L, CherryPickAbortResult as M, CherryPickConflict as N, CherryPickContinueInput as O, CherryPickNamespace as P, CherryPickResult as Q, CherryPickRunInput as R, CherryPickedCommit as S, CloneOptions as T, CloneResult as U, CommitOptions as V, CommitResult as W, CommittedBlameLine as X, ConfigEntryView as Y, ConfigGetAllInput as Z, ConfigGetAllResult as _, AddResult as a, MvSkipped as a$, ConfigGetRegexpInput as a0, ConfigGetRegexpResult as a1, ConfigGetResult as a2, ConfigListInput as a3, ConfigListResult as a4, ConfigNamespace as a5, ConfigRemoveSectionInput as a6, ConfigRemoveSectionResult as a7, ConfigRenameSectionInput as a8, ConfigRenameSectionResult as a9, GrepResult as aA, GroupedIndex as aB, InitOptions as aC, InitResult as aD, LineDiff as aE, LineDiffOptions as aF, LineHunk as aG, LineVerdict as aH, LogEntry as aI, LogOptions as aJ, LogOrder as aK, MatchSpan as aQ, MergeAbortResult as aR, MergeContinueInput as aS, MergeContinueResult as aT, MergeNamespace as aU, MergeResult as aV, MergeRunInput as aW, MvMove as aX, MvOptions as aY, MvResult as aZ, MvSkipReason as a_, ConfigSetInput as aa, ConfigSetResult as ab, ConfigUnsetAllInput as ac, ConfigUnsetAllResult as ad, ConfigUnsetInput as ae, ConfigUnsetResult as af, ConflictKind as ag, DescribeOptions as ah, DescribeResult as ai, DiffOptions as aj, FetchMissingOptions as ak, FetchMissingResult as al, FetchOptions as am, FetchResult as an, FsckFinding as ao, FsckObjectType as ap, FsckOptions as aq, FsckResult as ar, FsckSeverity as as, GrepFixedPattern as at, GrepLineHit as au, GrepMatcher as av, GrepMatcherOptions as aw, GrepOptions as ax, GrepPathResult as ay, GrepPattern as az, ArchiveEntry as b, ShowCommitResult as b$, NameRevOptions as b0, NameRevResult as b1, NameRevStep as b2, NotesAddInput as b3, NotesAddResult as b4, NotesListInput as b5, NotesListResult as b6, NotesNamespace as b7, NotesReadInput as b8, NotesReadResult as b9, RemoteListResult as bA, RemoteNamespace as bB, RemoteRemoveInput as bC, RemoteRemoveResult as bD, RemoteRenameInput as bE, RemoteRenameResult as bF, RemoteSetUrlInput as bG, RemoteSetUrlResult as bH, RemoteShow as bI, RemoteShowInput as bJ, RemoteShowResult as bK, ResetMode as bL, ResetOptions as bM, ResetResult as bN, RevertAbortResult as bO, RevertConflict as bP, RevertNamespace as bQ, RevertResult as bR, RevertRunInput as bS, RevertedCommit as bT, RmOptions as bU, RmResult as bV, ShortlogBy as bW, ShortlogCommit as bX, ShortlogGroup as bY, ShortlogOptions as bZ, ShowBlobResult as b_, NotesRemoveInput as ba, NotesRemoveResult as bb, PullOptions as bc, PullResult as bd, PushOptions as be, PushResult as bf, RangeDiffCommit as bg, RangeDiffEntry as bh, RangeDiffOptions as bi, RangeDiffRange as bj, RangeDiffStatus as bk, ReadFileAtResult as bl, RebaseAbortResult as bm, RebaseConflict as bn, RebaseInstruction as bo, RebaseInteractiveAction as bp, RebaseNamespace as bq, RebaseResult as br, RebaseRunInput as bs, RebasedCommit as bt, ReflogAction as bu, ReflogResult as bv, ReflogShowEntry as bw, RemoteAddInput as bx, RemoteAddResult as by, RemoteInfo as bz, ArchiveOptions as c, WorktreeRemoveResult as c$, ShowInput as c0, ShowOptions as c1, ShowResult as c2, ShowTagResult as c3, ShowTreeEntry as c4, ShowTreeResult as c5, SparseCheckoutAddInput as c6, SparseCheckoutAppliedResult as c7, SparseCheckoutDisableInput as c8, SparseCheckoutListResult as c9, SubmoduleNamespace as cA, SubmoduleSyncEntry as cB, SubmoduleSyncOptions as cC, SubmoduleSyncResult as cD, SubmoduleUpdateEntry as cE, SubmoduleUpdateOptions as cF, SubmoduleUpdateResult as cG, TagCreateInput as cH, TagCreateResult as cI, TagDeleteInput as cJ, TagDeleteResult as cK, TagInfo as cL, TagListResult as cM, TagNamespace as cN, UncommittedBlameLine as cO, UnmergedEntry as cP, UnmergedEntryGroup as cQ, WhatchangedEntry as cR, WhatchangedOptions as cS, WorktreeAddOptions as cT, WorktreeAddResult as cU, WorktreeEntry as cV, WorktreeListResult as cW, WorktreeMoveOptions as cX, WorktreeMoveResult as cY, WorktreeNamespace as cZ, WorktreeRemoveOptions as c_, SparseCheckoutNamespace as ca, SparseCheckoutReapplyInput as cb, SparseCheckoutSetInput as cc, StashApplyInput as cd, StashApplyResult as ce, StashConflict as cf, StashDropInput as cg, StashDropResult as ch, StashListEntry as ci, StashListResult as cj, StashNamespace as ck, StashPopResult as cl, StashPushInput as cm, StashPushResult as cn, StatusResult as co, SubmoduleAddEntry as cp, SubmoduleAddOptions as cq, SubmoduleAddResult as cr, SubmoduleDeinitEntry as cs, SubmoduleDeinitOptions as ct, SubmoduleDeinitResult as cu, SubmoduleInitEntry as cv, SubmoduleInitOptions as cw, SubmoduleInitResult as cx, SubmoduleListOptions as cy, SubmoduleListResult as cz, ArchiveResult as d, WorktreeSide as d0, BlameLine as e, BlameLineBase as f, BlameOptions as g, BlameResult as h, BlobSide as i, BranchCreateInput as j, BranchCreateResult as k, BranchDeleteInput as l, BranchDeleteResult as m, BranchInfo as n, BranchListResult as o, BranchNamespace as p, BranchRenameInput as q, BranchRenameResult as r, BundleCreateOptions as s, BundleCreateResult as t, BundleHashAlgorithm as u, BundleListHeadsInput as v, BundleListHeadsResult as w, BundleNamespace as x, BundlePrerequisite as y, BundleRef as z };
|