@scolladon/tsgit 1.0.0 → 1.2.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 +29 -137
- package/dist/cjs/adapters/browser/index.cjs +1 -1
- package/dist/cjs/adapters/browser/index.cjs.map +1 -1
- package/dist/cjs/adapters/memory/index.cjs +1 -1
- package/dist/cjs/adapters/memory/index.cjs.map +1 -1
- package/dist/cjs/adapters/node/index.cjs +1 -1
- package/dist/cjs/adapters/node/index.cjs.map +1 -1
- package/dist/cjs/chunks/browser-http-transport-D4NH-8oJ.cjs +2 -0
- package/dist/cjs/chunks/browser-http-transport-D4NH-8oJ.cjs.map +1 -0
- package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +1 -1
- package/dist/cjs/chunks/error-CDLOBdNU.cjs +2 -0
- package/dist/cjs/chunks/error-CDLOBdNU.cjs.map +1 -0
- package/dist/cjs/chunks/index-BVArBKuk.cjs +2 -0
- package/dist/cjs/chunks/index-BVArBKuk.cjs.map +1 -0
- package/dist/cjs/chunks/index-DE9HSiWf.cjs +2 -0
- package/dist/cjs/chunks/index-DE9HSiWf.cjs.map +1 -0
- package/dist/cjs/chunks/{logger-Cz9r6yt5.cjs → logger-CVG0zcPH.cjs} +2 -2
- package/dist/cjs/chunks/{logger-Cz9r6yt5.cjs.map → logger-CVG0zcPH.cjs.map} +1 -1
- package/dist/cjs/chunks/memory-http-transport-DXwDGKtR.cjs +2 -0
- package/dist/cjs/chunks/memory-http-transport-DXwDGKtR.cjs.map +1 -0
- package/dist/cjs/chunks/node-http-transport-vrbnNEDb.cjs +2 -0
- package/dist/cjs/chunks/node-http-transport-vrbnNEDb.cjs.map +1 -0
- package/dist/cjs/chunks/{progress-CK7CT9vU.cjs → progress-Bj2w-90A.cjs} +2 -2
- package/dist/cjs/chunks/{progress-CK7CT9vU.cjs.map → progress-Bj2w-90A.cjs.map} +1 -1
- package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +2 -0
- package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +1 -0
- package/dist/cjs/chunks/repository-BJwTSiGf.cjs +2 -0
- package/dist/cjs/chunks/repository-BJwTSiGf.cjs.map +1 -0
- package/dist/cjs/commands/index.cjs +1 -1
- package/dist/cjs/index.browser.cjs +1 -1
- package/dist/cjs/index.browser.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.default.cjs +1 -1
- package/dist/cjs/index.default.cjs.map +1 -1
- package/dist/cjs/index.node.cjs +1 -1
- package/dist/cjs/index.node.cjs.map +1 -1
- package/dist/cjs/operators/index.cjs +1 -1
- package/dist/cjs/operators/index.cjs.map +1 -1
- package/dist/cjs/primitives/index.cjs +1 -1
- package/dist/cjs/primitives/index.cjs.map +1 -1
- package/dist/cjs/transport/index.cjs.map +1 -1
- package/dist/esm/adapters/browser/index.js +1 -1
- package/dist/esm/adapters/browser/index.js.map +1 -1
- package/dist/esm/adapters/memory/index.js +1 -1
- package/dist/esm/adapters/memory/index.js.map +1 -1
- package/dist/esm/adapters/node/index.js +1 -1
- package/dist/esm/adapters/node/index.js.map +1 -1
- package/dist/esm/chunks/browser-http-transport-DL8bkNdg.js +2 -0
- package/dist/esm/chunks/browser-http-transport-DL8bkNdg.js.map +1 -0
- package/dist/esm/chunks/context-CumKOV7K.js.map +1 -1
- package/dist/esm/chunks/error-MOmSzp9Z.js +2 -0
- package/dist/esm/chunks/error-MOmSzp9Z.js.map +1 -0
- package/dist/esm/chunks/index-BjmofbKE.js +2 -0
- package/dist/esm/chunks/index-BjmofbKE.js.map +1 -0
- package/dist/esm/chunks/index-Jh5R-UmU.js +2 -0
- package/dist/esm/chunks/index-Jh5R-UmU.js.map +1 -0
- package/dist/esm/chunks/{logger-84ixEPbQ.js → logger-DP2cCpvL.js} +2 -2
- package/dist/esm/chunks/{logger-84ixEPbQ.js.map → logger-DP2cCpvL.js.map} +1 -1
- package/dist/esm/chunks/memory-http-transport-COJU6VOL.js +2 -0
- package/dist/esm/chunks/memory-http-transport-COJU6VOL.js.map +1 -0
- package/dist/esm/chunks/node-http-transport-DYCFIJbc.js +2 -0
- package/dist/esm/chunks/node-http-transport-DYCFIJbc.js.map +1 -0
- package/dist/esm/chunks/{progress-OTDhgmPO.js → progress-NePjO3Kd.js} +2 -2
- package/dist/esm/chunks/{progress-OTDhgmPO.js.map → progress-NePjO3Kd.js.map} +1 -1
- package/dist/esm/chunks/readable-stream-CGuf8k1J.js +2 -0
- package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +1 -0
- package/dist/esm/chunks/repository-Cs-dbHqO.js +2 -0
- package/dist/esm/chunks/repository-Cs-dbHqO.js.map +1 -0
- package/dist/esm/commands/index.js +1 -1
- package/dist/esm/index.browser.js +1 -1
- package/dist/esm/index.browser.js.map +1 -1
- package/dist/esm/index.default.js +1 -1
- package/dist/esm/index.default.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.node.js +1 -1
- package/dist/esm/index.node.js.map +1 -1
- package/dist/esm/operators/index.js +1 -1
- package/dist/esm/operators/index.js.map +1 -1
- package/dist/esm/primitives/index.js +1 -1
- package/dist/esm/primitives/index.js.map +1 -1
- package/dist/esm/transport/index.js.map +1 -1
- package/dist/types/adapters/browser/index.d.cts +2 -1
- package/dist/types/adapters/browser/index.d.ts +2 -1
- package/dist/types/adapters/memory/index.d.cts +23 -2
- package/dist/types/adapters/memory/index.d.ts +23 -2
- package/dist/types/adapters/node/index.d.cts +178 -3
- package/dist/types/adapters/node/index.d.ts +178 -3
- package/dist/types/chunks/{context-CTaXSPiP.d.ts → context-BORy7yXb.d.ts} +133 -20
- package/dist/types/chunks/{context-d36639-i.d.cts → context-CMrHCVwK.d.cts} +133 -20
- package/dist/types/chunks/reflog-entry-BIf-zt__.d.cts +331 -0
- package/dist/types/chunks/reflog-entry-D9P2hCgv.d.ts +331 -0
- package/dist/types/chunks/{repository-CFT9j9H6.d.cts → repository-BqibvTOu.d.cts} +23 -4
- package/dist/types/chunks/{repository-ntg7eXb2.d.ts → repository-C4rN09Am.d.ts} +23 -4
- package/dist/types/chunks/write-tree-B8G6kgTy.d.cts +154 -0
- package/dist/types/chunks/write-tree-BXCDChvv.d.ts +154 -0
- package/dist/types/commands/index.d.cts +229 -37
- package/dist/types/commands/index.d.ts +229 -37
- package/dist/types/index.browser.d.cts +4 -4
- package/dist/types/index.browser.d.ts +4 -4
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.default.d.cts +4 -4
- package/dist/types/index.default.d.ts +4 -4
- package/dist/types/index.node.d.cts +4 -4
- package/dist/types/index.node.d.ts +4 -4
- package/dist/types/operators/index.d.cts +17 -1
- package/dist/types/operators/index.d.ts +17 -1
- package/dist/types/primitives/index.d.cts +393 -171
- package/dist/types/primitives/index.d.ts +393 -171
- package/package.json +76 -10
- package/dist/cjs/chunks/browser-http-transport-BBF8uw-f.cjs +0 -2
- package/dist/cjs/chunks/browser-http-transport-BBF8uw-f.cjs.map +0 -1
- package/dist/cjs/chunks/error-DL4SHCBJ.cjs +0 -2
- package/dist/cjs/chunks/error-DL4SHCBJ.cjs.map +0 -1
- package/dist/cjs/chunks/error-DN8Vnwr4.cjs +0 -2
- package/dist/cjs/chunks/error-DN8Vnwr4.cjs.map +0 -1
- package/dist/cjs/chunks/index-iUd-bwwm.cjs +0 -2
- package/dist/cjs/chunks/index-iUd-bwwm.cjs.map +0 -1
- package/dist/cjs/chunks/memory-http-transport-DGll7Af4.cjs +0 -2
- package/dist/cjs/chunks/memory-http-transport-DGll7Af4.cjs.map +0 -1
- package/dist/cjs/chunks/merge-base-DlGWnkxP.cjs +0 -2
- package/dist/cjs/chunks/merge-base-DlGWnkxP.cjs.map +0 -1
- package/dist/cjs/chunks/node-http-transport-CuOgJlws.cjs +0 -2
- package/dist/cjs/chunks/node-http-transport-CuOgJlws.cjs.map +0 -1
- package/dist/cjs/chunks/repository-Cfo6Bj8T.cjs +0 -2
- package/dist/cjs/chunks/repository-Cfo6Bj8T.cjs.map +0 -1
- package/dist/esm/chunks/browser-http-transport-mZQKkInJ.js +0 -2
- package/dist/esm/chunks/browser-http-transport-mZQKkInJ.js.map +0 -1
- package/dist/esm/chunks/error-CnIcr6IG.js +0 -2
- package/dist/esm/chunks/error-CnIcr6IG.js.map +0 -1
- package/dist/esm/chunks/error-DTEP18A3.js +0 -2
- package/dist/esm/chunks/error-DTEP18A3.js.map +0 -1
- package/dist/esm/chunks/index-CJc-SKMj.js +0 -2
- package/dist/esm/chunks/index-CJc-SKMj.js.map +0 -1
- package/dist/esm/chunks/memory-http-transport-BmHjaEWj.js +0 -2
- package/dist/esm/chunks/memory-http-transport-BmHjaEWj.js.map +0 -1
- package/dist/esm/chunks/merge-base-DmuOYxfP.js +0 -2
- package/dist/esm/chunks/merge-base-DmuOYxfP.js.map +0 -1
- package/dist/esm/chunks/node-http-transport-Bz3noIS3.js +0 -2
- package/dist/esm/chunks/node-http-transport-Bz3noIS3.js.map +0 -1
- package/dist/esm/chunks/repository-qcX3-LkP.js +0 -2
- package/dist/esm/chunks/repository-qcX3-LkP.js.map +0 -1
- package/dist/types/chunks/diff-change-B09vxnxy.d.cts +0 -59
- package/dist/types/chunks/diff-change-D7xSeCn9.d.ts +0 -59
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { O as ObjectId, d as FilePath, R as RefName, e as FileStat } from './context-BORy7yXb.js';
|
|
2
|
+
|
|
3
|
+
interface AuthorIdentity {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly email: string;
|
|
6
|
+
readonly timestamp: number;
|
|
7
|
+
readonly timezoneOffset: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Blob {
|
|
11
|
+
readonly type: 'blob';
|
|
12
|
+
readonly id: ObjectId;
|
|
13
|
+
readonly content: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ExtraHeader {
|
|
17
|
+
readonly key: string;
|
|
18
|
+
readonly value: string;
|
|
19
|
+
}
|
|
20
|
+
interface CommitData {
|
|
21
|
+
readonly tree: ObjectId;
|
|
22
|
+
readonly parents: ReadonlyArray<ObjectId>;
|
|
23
|
+
readonly author: AuthorIdentity;
|
|
24
|
+
readonly committer: AuthorIdentity;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly gpgSignature?: string;
|
|
27
|
+
readonly extraHeaders: ReadonlyArray<ExtraHeader>;
|
|
28
|
+
}
|
|
29
|
+
interface Commit {
|
|
30
|
+
readonly type: 'commit';
|
|
31
|
+
readonly id: ObjectId;
|
|
32
|
+
readonly data: CommitData;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare const FILE_MODE: {
|
|
36
|
+
readonly REGULAR: "100644";
|
|
37
|
+
readonly EXECUTABLE: "100755";
|
|
38
|
+
readonly SYMLINK: "120000";
|
|
39
|
+
readonly DIRECTORY: "40000";
|
|
40
|
+
readonly GITLINK: "160000";
|
|
41
|
+
};
|
|
42
|
+
type FileMode = (typeof FILE_MODE)[keyof typeof FILE_MODE];
|
|
43
|
+
|
|
44
|
+
type ObjectType = 'blob' | 'tree' | 'commit' | 'tag';
|
|
45
|
+
|
|
46
|
+
interface TagData {
|
|
47
|
+
readonly object: ObjectId;
|
|
48
|
+
readonly objectType: ObjectType;
|
|
49
|
+
readonly tagName: string;
|
|
50
|
+
readonly tagger?: AuthorIdentity;
|
|
51
|
+
readonly message: string;
|
|
52
|
+
readonly gpgSignature?: string;
|
|
53
|
+
readonly extraHeaders: ReadonlyArray<ExtraHeader>;
|
|
54
|
+
}
|
|
55
|
+
interface Tag {
|
|
56
|
+
readonly type: 'tag';
|
|
57
|
+
readonly id: ObjectId;
|
|
58
|
+
readonly data: TagData;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface TreeEntry {
|
|
62
|
+
readonly mode: FileMode;
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly id: ObjectId;
|
|
65
|
+
}
|
|
66
|
+
interface Tree {
|
|
67
|
+
readonly type: 'tree';
|
|
68
|
+
readonly id: ObjectId;
|
|
69
|
+
readonly entries: ReadonlyArray<TreeEntry>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type GitObject = Blob | Tree | Commit | Tag;
|
|
73
|
+
|
|
74
|
+
interface AddChange {
|
|
75
|
+
readonly type: 'add';
|
|
76
|
+
readonly newPath: FilePath;
|
|
77
|
+
readonly newId: ObjectId;
|
|
78
|
+
readonly newMode: FileMode;
|
|
79
|
+
}
|
|
80
|
+
interface DeleteChange {
|
|
81
|
+
readonly type: 'delete';
|
|
82
|
+
readonly oldPath: FilePath;
|
|
83
|
+
readonly oldId: ObjectId;
|
|
84
|
+
readonly oldMode: FileMode;
|
|
85
|
+
}
|
|
86
|
+
interface ModifyChange {
|
|
87
|
+
readonly type: 'modify';
|
|
88
|
+
readonly path: FilePath;
|
|
89
|
+
readonly oldId: ObjectId;
|
|
90
|
+
readonly newId: ObjectId;
|
|
91
|
+
readonly oldMode: FileMode;
|
|
92
|
+
readonly newMode: FileMode;
|
|
93
|
+
}
|
|
94
|
+
interface RenameChange {
|
|
95
|
+
readonly type: 'rename';
|
|
96
|
+
readonly oldPath: FilePath;
|
|
97
|
+
readonly newPath: FilePath;
|
|
98
|
+
readonly id: ObjectId;
|
|
99
|
+
readonly mode: FileMode;
|
|
100
|
+
}
|
|
101
|
+
interface TypeChangeChange {
|
|
102
|
+
readonly type: 'type-change';
|
|
103
|
+
readonly path: FilePath;
|
|
104
|
+
readonly oldId: ObjectId;
|
|
105
|
+
readonly newId: ObjectId;
|
|
106
|
+
readonly oldMode: FileMode;
|
|
107
|
+
readonly newMode: FileMode;
|
|
108
|
+
}
|
|
109
|
+
type DiffChange = AddChange | DeleteChange | ModifyChange | RenameChange | TypeChangeChange;
|
|
110
|
+
interface TreeDiff {
|
|
111
|
+
readonly changes: ReadonlyArray<DiffChange>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface RenameDetectOptions {
|
|
115
|
+
readonly limit?: number;
|
|
116
|
+
readonly maxSameIdDeletes?: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Primitive option shapes, walker value types, and shared constants.
|
|
121
|
+
* Defined in one location to avoid circular imports between primitive modules.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/** Max symbolic-ref dereferences resolveRef will follow. */
|
|
125
|
+
declare const MAX_SYMBOLIC_REF_DEPTH = 5;
|
|
126
|
+
/** Max tag-peel hops resolveRef / readTree will follow when peeling. */
|
|
127
|
+
declare const MAX_PEEL_DEPTH = 5;
|
|
128
|
+
/** Max seeds walkCommits.from can contain. */
|
|
129
|
+
declare const MAX_WALK_SEEDS = 1024;
|
|
130
|
+
/** Hard cap on walkCommits' pending queue size to prevent unbounded heap growth. */
|
|
131
|
+
declare const MAX_WALK_QUEUE_SIZE: number;
|
|
132
|
+
/** Max.git/index file size readIndex will accept. */
|
|
133
|
+
declare const MAX_INDEX_BYTES: number;
|
|
134
|
+
/** Max commit message byte length createCommit will accept. */
|
|
135
|
+
declare const MAX_COMMIT_MESSAGE_BYTES: number;
|
|
136
|
+
/**
|
|
137
|
+
* Per-file size cap enforced by `add --all` before reading working-tree
|
|
138
|
+
* bytes into memory. Mirrors `MAX_CONFLICT_OUTPUT_BYTES` (256 MiB) so the
|
|
139
|
+
* write-side memory ceiling matches the read-side ceiling.
|
|
140
|
+
* See `docs/adr/032-add-all-large-file-guard.md`.
|
|
141
|
+
*/
|
|
142
|
+
declare const MAX_WORKING_TREE_BLOB_BYTES: number;
|
|
143
|
+
/**
|
|
144
|
+
* Per-file cap on `.gitignore`, `.git/info/exclude`, and the global
|
|
145
|
+
* excludesFile. 1 MiB leaves a 20× margin over real-world max-size
|
|
146
|
+
* gitignore corpora. See `docs/adr/036-gitignore-bounded-read.md`.
|
|
147
|
+
*/
|
|
148
|
+
declare const MAX_GITIGNORE_BYTES: number;
|
|
149
|
+
/**
|
|
150
|
+
* Per-file cap on a single `.git/logs/<ref>` reflog file. 16 MiB is generous
|
|
151
|
+
* — `reflog expire` is the size-management story; this guard only stops an
|
|
152
|
+
* adversarial or corrupt log from being buffered unbounded into memory.
|
|
153
|
+
*/
|
|
154
|
+
declare const MAX_REFLOG_BYTES: number;
|
|
155
|
+
interface ReadObjectOptions {
|
|
156
|
+
readonly verifyHash?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Reject objects whose serialised payload exceeds this byte count, before
|
|
159
|
+
* inflating the full content into memory. Counts the raw object content
|
|
160
|
+
* (post-inflate, pre-loose-header). When unset, no cap applies.
|
|
161
|
+
*
|
|
162
|
+
* Used by `merge`'s content merger to bound peak memory when an adversarial
|
|
163
|
+
* remote ships pathologically large blobs. See `docs/design/phase-13-8-
|
|
164
|
+
* bounded-object-reads.md`.
|
|
165
|
+
*/
|
|
166
|
+
readonly maxBytes?: number;
|
|
167
|
+
}
|
|
168
|
+
interface ResolveRefOptions {
|
|
169
|
+
readonly peel?: boolean;
|
|
170
|
+
readonly maxSymbolicDepth?: number;
|
|
171
|
+
readonly maxPeelDepth?: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* `updateRef` option shapes. A write requires a `reflogMessage` — git's
|
|
175
|
+
* builtins always supply a reason string; the type checker forces every
|
|
176
|
+
* present and future ref write to state why the ref moved. A delete drops the
|
|
177
|
+
* reflog file, so it carries no message.
|
|
178
|
+
*/
|
|
179
|
+
type UpdateRefOptions = {
|
|
180
|
+
readonly delete?: false;
|
|
181
|
+
readonly expected?: ObjectId | 'absent';
|
|
182
|
+
readonly reflogMessage: string;
|
|
183
|
+
} | {
|
|
184
|
+
readonly delete: true;
|
|
185
|
+
readonly expected?: ObjectId | 'absent';
|
|
186
|
+
};
|
|
187
|
+
interface WalkCommitsOptions {
|
|
188
|
+
readonly from: ReadonlyArray<ObjectId>;
|
|
189
|
+
readonly until?: ReadonlyArray<ObjectId>;
|
|
190
|
+
readonly order?: 'topo' | 'first-parent';
|
|
191
|
+
readonly ignoreMissing?: boolean;
|
|
192
|
+
readonly verifyHash?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Commits whose parents must NOT be enqueued. Used for shallow boundaries
|
|
195
|
+
* . The commit itself is still yielded — only its parents are
|
|
196
|
+
* skipped. Callers that want to also skip the boundary commit pass it in
|
|
197
|
+
* `until`.
|
|
198
|
+
*/
|
|
199
|
+
readonly shallow?: ReadonlySet<ObjectId>;
|
|
200
|
+
}
|
|
201
|
+
/** Maximum `have` lines a single-round fetch will send. */
|
|
202
|
+
declare const MAX_HAVES = 256;
|
|
203
|
+
/** Hard cap on objects enumerated for a single push. design */
|
|
204
|
+
declare const MAX_PUSH_OBJECTS = 1000000;
|
|
205
|
+
interface WalkTreeEntry {
|
|
206
|
+
readonly path: FilePath;
|
|
207
|
+
readonly id: ObjectId;
|
|
208
|
+
readonly mode: FileMode;
|
|
209
|
+
}
|
|
210
|
+
interface WalkTreeOptions {
|
|
211
|
+
readonly recursive?: boolean;
|
|
212
|
+
readonly maxDepth?: number;
|
|
213
|
+
readonly maxEntries?: number;
|
|
214
|
+
}
|
|
215
|
+
interface WalkWorkingTreeEntry {
|
|
216
|
+
readonly path: FilePath;
|
|
217
|
+
readonly stat: FileStat;
|
|
218
|
+
}
|
|
219
|
+
type WalkIgnorePredicate = (path: FilePath, isDirectory: boolean) => boolean | Promise<boolean>;
|
|
220
|
+
interface WalkWorkingTreeOptions {
|
|
221
|
+
readonly maxDepth?: number;
|
|
222
|
+
readonly maxEntries?: number;
|
|
223
|
+
/**
|
|
224
|
+
* predicate. Invoked on every directory BEFORE descent
|
|
225
|
+
* (returning `true` prunes the entire subtree, skipping its `lstat`
|
|
226
|
+
* cost) and on every leaf BEFORE yielding (returning `true` drops
|
|
227
|
+
* the leaf). May be sync or async.
|
|
228
|
+
*/
|
|
229
|
+
readonly ignore?: WalkIgnorePredicate;
|
|
230
|
+
}
|
|
231
|
+
interface CreateCommitInput {
|
|
232
|
+
readonly tree: ObjectId;
|
|
233
|
+
readonly parents: ReadonlyArray<ObjectId>;
|
|
234
|
+
readonly author: AuthorIdentity;
|
|
235
|
+
readonly committer: AuthorIdentity;
|
|
236
|
+
readonly message: string;
|
|
237
|
+
readonly gpgSignature?: string;
|
|
238
|
+
readonly extraHeaders?: ReadonlyArray<ExtraHeader>;
|
|
239
|
+
}
|
|
240
|
+
type DiffTreesInput = Tree | ObjectId | undefined;
|
|
241
|
+
interface DiffTreesOptions {
|
|
242
|
+
readonly detectRenames?: boolean;
|
|
243
|
+
readonly renameOptions?: RenameDetectOptions;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Per-file cap on a single `.gitmodules` blob. 1 MiB matches the
|
|
247
|
+
* `MAX_GITIGNORE_BYTES` budget: real `.gitmodules` files are KB-scale even in
|
|
248
|
+
* very large superprojects, so a 1 MiB ceiling is a generous DoS guard
|
|
249
|
+
* applied before inflate.
|
|
250
|
+
*/
|
|
251
|
+
declare const MAX_GITMODULES_BYTES: number;
|
|
252
|
+
/**
|
|
253
|
+
* Recursion backstop for `walkSubmodules` — the cycle guard (visited gitdir
|
|
254
|
+
* set) handles the genuine-cycle case; this cap stops a pathologically deep
|
|
255
|
+
* but acyclic nest from running away.
|
|
256
|
+
*/
|
|
257
|
+
declare const MAX_SUBMODULE_DEPTH = 100;
|
|
258
|
+
/** One submodule surfaced by `walkSubmodules`: a gitlink joined with its `.gitmodules` row. */
|
|
259
|
+
interface SubmoduleEntry {
|
|
260
|
+
/**
|
|
261
|
+
* The `[submodule "<name>"]` subsection name in the `.gitmodules` of the
|
|
262
|
+
* tree that contains this gitlink. Falls back to `path` when no row matches
|
|
263
|
+
* the gitlink (a gitlink committed without a corresponding config entry).
|
|
264
|
+
*/
|
|
265
|
+
readonly name: string;
|
|
266
|
+
/** Slash-joined path from the *superproject* root to the gitlink. */
|
|
267
|
+
readonly path: FilePath;
|
|
268
|
+
/** `submodule.<name>.url` — absent when no `.gitmodules` row matched. */
|
|
269
|
+
readonly url?: string;
|
|
270
|
+
/** `submodule.<name>.branch` — absent when the key is unset. */
|
|
271
|
+
readonly branch?: string;
|
|
272
|
+
/** The commit object id the gitlink pins (the tree entry's id). */
|
|
273
|
+
readonly commit: ObjectId;
|
|
274
|
+
/** Recursion depth; 0 for a direct submodule of the superproject. */
|
|
275
|
+
readonly depth: number;
|
|
276
|
+
/** Path of the containing submodule; absent for `depth === 0` entries. */
|
|
277
|
+
readonly parent?: FilePath;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* One entry yielded by `catFileBatch` — a discriminated union so that a
|
|
281
|
+
* single bad id never aborts the stream. `ok: true` carries the parsed
|
|
282
|
+
* object plus its canonical payload size (matches the `<size>` field of
|
|
283
|
+
* `git cat-file --batch`'s header). `ok: false` is shaped to extend later:
|
|
284
|
+
* `reason` is a literal union so a future variant is an additive change.
|
|
285
|
+
*/
|
|
286
|
+
/**
|
|
287
|
+
* Optional knobs for the `catFileBatch` primitive — currently a single
|
|
288
|
+
* `maxBytes` cap forwarded to each per-id `readObject` call so a long
|
|
289
|
+
* batch over untrusted ids cannot exhaust the heap. Defaults to no cap.
|
|
290
|
+
*/
|
|
291
|
+
interface CatFileBatchOptions {
|
|
292
|
+
/**
|
|
293
|
+
* Per-object byte cap. Rejected pre-inflate; same semantics as
|
|
294
|
+
* `ReadObjectOptions.maxBytes`. When unset, no cap applies (parity
|
|
295
|
+
* with `readObject`).
|
|
296
|
+
*/
|
|
297
|
+
readonly maxBytes?: number;
|
|
298
|
+
}
|
|
299
|
+
type CatFileBatchEntry = {
|
|
300
|
+
readonly ok: true;
|
|
301
|
+
readonly id: ObjectId;
|
|
302
|
+
readonly type: GitObject['type'];
|
|
303
|
+
readonly size: number;
|
|
304
|
+
readonly object: GitObject;
|
|
305
|
+
} | {
|
|
306
|
+
readonly ok: false;
|
|
307
|
+
readonly id: ObjectId;
|
|
308
|
+
readonly reason: 'missing';
|
|
309
|
+
};
|
|
310
|
+
interface WalkSubmodulesOptions {
|
|
311
|
+
/** Tree-ish to walk. Default: `HEAD`. */
|
|
312
|
+
readonly ref?: RefName | ObjectId;
|
|
313
|
+
/** Descend into nested submodules' own `.gitmodules`. Default: `false`. */
|
|
314
|
+
readonly recursive?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Cap on recursion depth. Default: `MAX_SUBMODULE_DEPTH`. Entries at exactly
|
|
317
|
+
* this depth are yielded but not recursed into.
|
|
318
|
+
*/
|
|
319
|
+
readonly maxDepth?: number;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** One line of a reflog file: a single ref movement from `oldId` to `newId`. */
|
|
323
|
+
interface ReflogEntry {
|
|
324
|
+
readonly oldId: ObjectId;
|
|
325
|
+
readonly newId: ObjectId;
|
|
326
|
+
readonly identity: AuthorIdentity;
|
|
327
|
+
readonly message: string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export { MAX_COMMIT_MESSAGE_BYTES as M, MAX_GITIGNORE_BYTES as e, MAX_GITMODULES_BYTES as f, MAX_HAVES as g, MAX_INDEX_BYTES as h, MAX_PEEL_DEPTH as i, MAX_PUSH_OBJECTS as j, MAX_REFLOG_BYTES as k, MAX_SUBMODULE_DEPTH as l, MAX_SYMBOLIC_REF_DEPTH as m, MAX_WALK_QUEUE_SIZE as n, MAX_WALK_SEEDS as o, MAX_WORKING_TREE_BLOB_BYTES as p };
|
|
331
|
+
export type { AuthorIdentity as A, Blob as B, CatFileBatchEntry as C, DiffTreesInput as D, FileMode as F, GitObject as G, ReadObjectOptions as R, SubmoduleEntry as S, Tree as T, UpdateRefOptions as U, WalkCommitsOptions as W, CatFileBatchOptions as a, Commit as b, CreateCommitInput as c, DiffTreesOptions as d, ReflogEntry as q, ResolveRefOptions as r, TreeDiff as s, TreeEntry as t, WalkIgnorePredicate as u, WalkSubmodulesOptions as v, WalkTreeEntry as w, WalkTreeOptions as x, WalkWorkingTreeEntry as y, WalkWorkingTreeOptions as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from '../commands/index.cjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { add, branch, catFile, checkout, clone, commit, diff, fetch, fetchMissing, init, log, merge, push, reflog, reset, revParse, rm, sparseCheckout, status, submodules, tag } from '../commands/index.cjs';
|
|
2
|
+
import { f as FileSystem, H as HashService, C as Compressor, n as RepositoryConfig, L as Logger, P as ProgressReporter, k as HookRunner, b as Context } from './context-CMrHCVwK.cjs';
|
|
3
|
+
import { c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, h as recordRefUpdate, i as resolveRef, j as runHook, u as updateRef, w as walkCommits, k as walkSubmodules, l as walkTree, n as walkWorkingTree, o as writeObject, p as writeSymbolicRef, q as writeTree } from './write-tree-B8G6kgTy.cjs';
|
|
4
4
|
import { b as HttpTransport } from './http-transport-DirKfK2S.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -12,7 +12,7 @@ type BindCtx<F> = F extends (ctx: Context, ...rest: infer A) => infer R ? (...ar
|
|
|
12
12
|
* User-facing options passed to `openRepository`. Subset of the design's
|
|
13
13
|
* `OpenRepositoryOptions` that this Step 3 implementation honors. Every field
|
|
14
14
|
* is optional; the facade fills sensible defaults. Field-level validation runs
|
|
15
|
-
* eagerly before the Repository is returned
|
|
15
|
+
* eagerly before the Repository is returned.
|
|
16
16
|
*/
|
|
17
17
|
interface OpenRepositoryOptions {
|
|
18
18
|
/** Working directory. Default: `process.cwd()` on Node, `'/'` on browser/memory. */
|
|
@@ -30,6 +30,15 @@ interface OpenRepositoryOptions {
|
|
|
30
30
|
readonly progress?: ProgressReporter;
|
|
31
31
|
/** AbortSignal threaded into every bound method's ctx.signal. */
|
|
32
32
|
readonly signal?: AbortSignal;
|
|
33
|
+
/**
|
|
34
|
+
* Hook runner. Omit to inherit the runtime default (Node wires one; the
|
|
35
|
+
* browser does not). Pass `false` to disable hooks entirely.
|
|
36
|
+
*
|
|
37
|
+
* WARNING: a wired runner spawns `.git/hooks/*` scripts that inherit the
|
|
38
|
+
* full `process.env` of the calling process — including any secrets it
|
|
39
|
+
* holds. Pass `false` when operating on a repository you do not trust.
|
|
40
|
+
*/
|
|
41
|
+
readonly hooks?: HookRunner | false;
|
|
33
42
|
/**
|
|
34
43
|
* Opt OUT of adapter validator wrapping for `fs` and `transport`. NEVER set
|
|
35
44
|
* with adapters whose code you do not control; a raw transport receives
|
|
@@ -45,21 +54,27 @@ interface OpenRepositoryOptions {
|
|
|
45
54
|
interface Repository {
|
|
46
55
|
readonly add: BindCtx<typeof add>;
|
|
47
56
|
readonly branch: BindCtx<typeof branch>;
|
|
57
|
+
readonly catFile: BindCtx<typeof catFile>;
|
|
48
58
|
readonly checkout: BindCtx<typeof checkout>;
|
|
49
59
|
readonly clone: BindCtx<typeof clone>;
|
|
50
60
|
readonly commit: BindCtx<typeof commit>;
|
|
51
61
|
readonly diff: BindCtx<typeof diff>;
|
|
52
62
|
readonly fetch: BindCtx<typeof fetch>;
|
|
63
|
+
readonly fetchMissing: BindCtx<typeof fetchMissing>;
|
|
53
64
|
readonly init: BindCtx<typeof init>;
|
|
54
65
|
readonly log: BindCtx<typeof log>;
|
|
55
66
|
readonly merge: BindCtx<typeof merge>;
|
|
56
67
|
readonly push: BindCtx<typeof push>;
|
|
68
|
+
readonly reflog: BindCtx<typeof reflog>;
|
|
57
69
|
readonly reset: BindCtx<typeof reset>;
|
|
58
70
|
readonly revParse: BindCtx<typeof revParse>;
|
|
59
71
|
readonly rm: BindCtx<typeof rm>;
|
|
72
|
+
readonly sparseCheckout: BindCtx<typeof sparseCheckout>;
|
|
60
73
|
readonly status: BindCtx<typeof status>;
|
|
74
|
+
readonly submodules: BindCtx<typeof submodules>;
|
|
61
75
|
readonly tag: BindCtx<typeof tag>;
|
|
62
76
|
readonly primitives: {
|
|
77
|
+
readonly catFileBatch: BindCtx<typeof catFileBatch>;
|
|
63
78
|
readonly createCommit: BindCtx<typeof createCommit>;
|
|
64
79
|
readonly diffTrees: BindCtx<typeof diffTrees>;
|
|
65
80
|
readonly getRepoRoot: BindCtx<typeof getRepoRoot>;
|
|
@@ -68,10 +83,14 @@ interface Repository {
|
|
|
68
83
|
readonly readIndex: BindCtx<typeof readIndex>;
|
|
69
84
|
readonly readObject: BindCtx<typeof readObject>;
|
|
70
85
|
readonly readTree: BindCtx<typeof readTree>;
|
|
86
|
+
readonly recordRefUpdate: BindCtx<typeof recordRefUpdate>;
|
|
71
87
|
readonly resolveRef: BindCtx<typeof resolveRef>;
|
|
88
|
+
readonly runHook: BindCtx<typeof runHook>;
|
|
72
89
|
readonly updateRef: BindCtx<typeof updateRef>;
|
|
73
90
|
readonly walkCommits: BindCtx<typeof walkCommits>;
|
|
91
|
+
readonly walkSubmodules: BindCtx<typeof walkSubmodules>;
|
|
74
92
|
readonly walkTree: BindCtx<typeof walkTree>;
|
|
93
|
+
readonly walkWorkingTree: BindCtx<typeof walkWorkingTree>;
|
|
75
94
|
readonly writeObject: BindCtx<typeof writeObject>;
|
|
76
95
|
readonly writeSymbolicRef: BindCtx<typeof writeSymbolicRef>;
|
|
77
96
|
readonly writeTree: BindCtx<typeof writeTree>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from '../commands/index.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { add, branch, catFile, checkout, clone, commit, diff, fetch, fetchMissing, init, log, merge, push, reflog, reset, revParse, rm, sparseCheckout, status, submodules, tag } from '../commands/index.js';
|
|
2
|
+
import { f as FileSystem, H as HashService, C as Compressor, n as RepositoryConfig, L as Logger, P as ProgressReporter, k as HookRunner, b as Context } from './context-BORy7yXb.js';
|
|
3
|
+
import { c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, h as recordRefUpdate, i as resolveRef, j as runHook, u as updateRef, w as walkCommits, k as walkSubmodules, l as walkTree, n as walkWorkingTree, o as writeObject, p as writeSymbolicRef, q as writeTree } from './write-tree-BXCDChvv.js';
|
|
4
4
|
import { b as HttpTransport } from './http-transport-DirKfK2S.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -12,7 +12,7 @@ type BindCtx<F> = F extends (ctx: Context, ...rest: infer A) => infer R ? (...ar
|
|
|
12
12
|
* User-facing options passed to `openRepository`. Subset of the design's
|
|
13
13
|
* `OpenRepositoryOptions` that this Step 3 implementation honors. Every field
|
|
14
14
|
* is optional; the facade fills sensible defaults. Field-level validation runs
|
|
15
|
-
* eagerly before the Repository is returned
|
|
15
|
+
* eagerly before the Repository is returned.
|
|
16
16
|
*/
|
|
17
17
|
interface OpenRepositoryOptions {
|
|
18
18
|
/** Working directory. Default: `process.cwd()` on Node, `'/'` on browser/memory. */
|
|
@@ -30,6 +30,15 @@ interface OpenRepositoryOptions {
|
|
|
30
30
|
readonly progress?: ProgressReporter;
|
|
31
31
|
/** AbortSignal threaded into every bound method's ctx.signal. */
|
|
32
32
|
readonly signal?: AbortSignal;
|
|
33
|
+
/**
|
|
34
|
+
* Hook runner. Omit to inherit the runtime default (Node wires one; the
|
|
35
|
+
* browser does not). Pass `false` to disable hooks entirely.
|
|
36
|
+
*
|
|
37
|
+
* WARNING: a wired runner spawns `.git/hooks/*` scripts that inherit the
|
|
38
|
+
* full `process.env` of the calling process — including any secrets it
|
|
39
|
+
* holds. Pass `false` when operating on a repository you do not trust.
|
|
40
|
+
*/
|
|
41
|
+
readonly hooks?: HookRunner | false;
|
|
33
42
|
/**
|
|
34
43
|
* Opt OUT of adapter validator wrapping for `fs` and `transport`. NEVER set
|
|
35
44
|
* with adapters whose code you do not control; a raw transport receives
|
|
@@ -45,21 +54,27 @@ interface OpenRepositoryOptions {
|
|
|
45
54
|
interface Repository {
|
|
46
55
|
readonly add: BindCtx<typeof add>;
|
|
47
56
|
readonly branch: BindCtx<typeof branch>;
|
|
57
|
+
readonly catFile: BindCtx<typeof catFile>;
|
|
48
58
|
readonly checkout: BindCtx<typeof checkout>;
|
|
49
59
|
readonly clone: BindCtx<typeof clone>;
|
|
50
60
|
readonly commit: BindCtx<typeof commit>;
|
|
51
61
|
readonly diff: BindCtx<typeof diff>;
|
|
52
62
|
readonly fetch: BindCtx<typeof fetch>;
|
|
63
|
+
readonly fetchMissing: BindCtx<typeof fetchMissing>;
|
|
53
64
|
readonly init: BindCtx<typeof init>;
|
|
54
65
|
readonly log: BindCtx<typeof log>;
|
|
55
66
|
readonly merge: BindCtx<typeof merge>;
|
|
56
67
|
readonly push: BindCtx<typeof push>;
|
|
68
|
+
readonly reflog: BindCtx<typeof reflog>;
|
|
57
69
|
readonly reset: BindCtx<typeof reset>;
|
|
58
70
|
readonly revParse: BindCtx<typeof revParse>;
|
|
59
71
|
readonly rm: BindCtx<typeof rm>;
|
|
72
|
+
readonly sparseCheckout: BindCtx<typeof sparseCheckout>;
|
|
60
73
|
readonly status: BindCtx<typeof status>;
|
|
74
|
+
readonly submodules: BindCtx<typeof submodules>;
|
|
61
75
|
readonly tag: BindCtx<typeof tag>;
|
|
62
76
|
readonly primitives: {
|
|
77
|
+
readonly catFileBatch: BindCtx<typeof catFileBatch>;
|
|
63
78
|
readonly createCommit: BindCtx<typeof createCommit>;
|
|
64
79
|
readonly diffTrees: BindCtx<typeof diffTrees>;
|
|
65
80
|
readonly getRepoRoot: BindCtx<typeof getRepoRoot>;
|
|
@@ -68,10 +83,14 @@ interface Repository {
|
|
|
68
83
|
readonly readIndex: BindCtx<typeof readIndex>;
|
|
69
84
|
readonly readObject: BindCtx<typeof readObject>;
|
|
70
85
|
readonly readTree: BindCtx<typeof readTree>;
|
|
86
|
+
readonly recordRefUpdate: BindCtx<typeof recordRefUpdate>;
|
|
71
87
|
readonly resolveRef: BindCtx<typeof resolveRef>;
|
|
88
|
+
readonly runHook: BindCtx<typeof runHook>;
|
|
72
89
|
readonly updateRef: BindCtx<typeof updateRef>;
|
|
73
90
|
readonly walkCommits: BindCtx<typeof walkCommits>;
|
|
91
|
+
readonly walkSubmodules: BindCtx<typeof walkSubmodules>;
|
|
74
92
|
readonly walkTree: BindCtx<typeof walkTree>;
|
|
93
|
+
readonly walkWorkingTree: BindCtx<typeof walkWorkingTree>;
|
|
75
94
|
readonly writeObject: BindCtx<typeof writeObject>;
|
|
76
95
|
readonly writeSymbolicRef: BindCtx<typeof writeSymbolicRef>;
|
|
77
96
|
readonly writeTree: BindCtx<typeof writeTree>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { O as ObjectId, d as FilePath, b as Context, R as RefName, h as HookName } from './context-CMrHCVwK.cjs';
|
|
2
|
+
import { F as FileMode, a as CatFileBatchOptions, C as CatFileBatchEntry, c as CreateCommitInput, D as DiffTreesInput, d as DiffTreesOptions, s as TreeDiff, R as ReadObjectOptions, B as Blob, G as GitObject, T as Tree, r as ResolveRefOptions, U as UpdateRefOptions, W as WalkCommitsOptions, b as Commit, v as WalkSubmodulesOptions, S as SubmoduleEntry, x as WalkTreeOptions, w as WalkTreeEntry, z as WalkWorkingTreeOptions, y as WalkWorkingTreeEntry, t as TreeEntry } from './reflog-entry-BIf-zt__.cjs';
|
|
3
|
+
|
|
4
|
+
interface IndexEntryFlags {
|
|
5
|
+
readonly assumeValid: boolean;
|
|
6
|
+
readonly stage: 0 | 1 | 2 | 3;
|
|
7
|
+
/** Index v3 extended flag — the path is intentionally absent from the working tree. */
|
|
8
|
+
readonly skipWorktree: boolean;
|
|
9
|
+
/** Index v3 extended flag — `git add -N` placeholder. Modelled for faithful round-tripping. */
|
|
10
|
+
readonly intentToAdd: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface IndexEntry {
|
|
13
|
+
readonly ctimeSeconds: number;
|
|
14
|
+
readonly ctimeNanoseconds: number;
|
|
15
|
+
readonly mtimeSeconds: number;
|
|
16
|
+
readonly mtimeNanoseconds: number;
|
|
17
|
+
readonly dev: number;
|
|
18
|
+
readonly ino: number;
|
|
19
|
+
readonly mode: FileMode;
|
|
20
|
+
readonly uid: number;
|
|
21
|
+
readonly gid: number;
|
|
22
|
+
readonly fileSize: number;
|
|
23
|
+
readonly id: ObjectId;
|
|
24
|
+
readonly flags: IndexEntryFlags;
|
|
25
|
+
readonly path: FilePath;
|
|
26
|
+
}
|
|
27
|
+
interface IndexExtension {
|
|
28
|
+
readonly signature: string;
|
|
29
|
+
readonly data: Uint8Array;
|
|
30
|
+
}
|
|
31
|
+
interface GitIndex {
|
|
32
|
+
readonly version: 2 | 3;
|
|
33
|
+
readonly entries: ReadonlyArray<IndexEntry>;
|
|
34
|
+
readonly extensions: ReadonlyArray<IndexExtension>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare function catFileBatch(ctx: Context, ids: AsyncIterable<ObjectId> | Iterable<ObjectId>, options?: CatFileBatchOptions): AsyncIterable<CatFileBatchEntry>;
|
|
38
|
+
|
|
39
|
+
declare function createCommit(ctx: Context, input: CreateCommitInput): Promise<ObjectId>;
|
|
40
|
+
|
|
41
|
+
declare function diffTrees(ctx: Context, a: DiffTreesInput, b: DiffTreesInput, options?: DiffTreesOptions): Promise<TreeDiff>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Compute a merge base — the first commit reachable from BOTH `a` and `b`.
|
|
45
|
+
*
|
|
46
|
+
* Algorithm: bidirectional BFS with two visited sets. After each layer
|
|
47
|
+
* advance, check the intersection. When non-empty, return the
|
|
48
|
+
* lexicographically smallest oid (deterministic tie-breaker).
|
|
49
|
+
*
|
|
50
|
+
* Returns `undefined` for unrelated histories. Documented limitation: cherry-picks
|
|
51
|
+
* and criss-cross merges may yield non-optimal bases — `recursive`-strategy
|
|
52
|
+
* multi-base resolution is v2.
|
|
53
|
+
*/
|
|
54
|
+
declare const mergeBase: (ctx: Context, a: ObjectId, b: ObjectId) => Promise<ObjectId | undefined>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pure path helpers composing `ctx.layout.gitDir` with known sub-paths.
|
|
58
|
+
* No I/O. No port access. Primitive step 3.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Repository working-tree root. Returns the workDir from the current context;
|
|
63
|
+
* facade-tier code is responsible for discovery / realpath pinning
|
|
64
|
+
* at construction time. Primitives consume the already-resolved path.
|
|
65
|
+
*/
|
|
66
|
+
declare const getRepoRoot: (ctx: Context) => FilePath;
|
|
67
|
+
declare const sparseCheckoutPath: (gitDir: string) => string;
|
|
68
|
+
|
|
69
|
+
declare function readBlob(ctx: Context, id: ObjectId, options?: ReadObjectOptions): Promise<Blob>;
|
|
70
|
+
|
|
71
|
+
declare function readIndex(ctx: Context): Promise<GitIndex>;
|
|
72
|
+
|
|
73
|
+
declare function readObject(ctx: Context, id: ObjectId, options?: ReadObjectOptions): Promise<GitObject>;
|
|
74
|
+
|
|
75
|
+
declare function readTree(ctx: Context, ref: RefName | ObjectId): Promise<Tree>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The single reflog *writer*. Self-contained: reads config, applies the gate,
|
|
79
|
+
* resolves identity, sanitises the message, and appends one entry. Callers
|
|
80
|
+
* supply only a human-readable message.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Append a reflog entry for `ref` if logging applies. A no-op when the gate is
|
|
85
|
+
* closed for `ref` — once a reflog file exists every update appends to it,
|
|
86
|
+
* otherwise the `core.logAllRefUpdates` prefix rule decides.
|
|
87
|
+
*/
|
|
88
|
+
declare function recordRefUpdate(ctx: Context, ref: RefName, oldId: ObjectId, newId: ObjectId, message: string): Promise<void>;
|
|
89
|
+
|
|
90
|
+
declare function resolveRef(ctx: Context, name: RefName | 'HEAD', options?: ResolveRefOptions): Promise<ObjectId>;
|
|
91
|
+
|
|
92
|
+
/** Optional arguments and stdin a caller threads into a hook invocation. */
|
|
93
|
+
interface HookInput {
|
|
94
|
+
readonly args?: ReadonlyArray<string>;
|
|
95
|
+
readonly stdin?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Run a named git hook through `ctx.hooks`. A no-op when no `HookRunner` is
|
|
99
|
+
* wired (browser, or opted out), when the hook file is absent / not executable
|
|
100
|
+
* (`skipped`), or when the hook exits 0. Throws `HOOK_FAILED` on a non-zero
|
|
101
|
+
* exit.
|
|
102
|
+
*/
|
|
103
|
+
declare const runHook: (ctx: Context, name: HookName, input?: HookInput) => Promise<void>;
|
|
104
|
+
|
|
105
|
+
declare function updateRef(ctx: Context, name: RefName, newId: ObjectId, options: UpdateRefOptions): Promise<void>;
|
|
106
|
+
|
|
107
|
+
declare function walkCommits(ctx: Context, options: WalkCommitsOptions): AsyncIterable<Commit>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Yield every gitlink reachable in `ref`'s tree, joined with its `.gitmodules`
|
|
111
|
+
* metadata. With `recursive: true`, descend into each nested submodule whose
|
|
112
|
+
* absorbed gitdir (`${gitDir}/modules/<name>`) is locally available; nested
|
|
113
|
+
* yields carry `depth >= 1` and a `parent` path. Uninitialised / missing /
|
|
114
|
+
* cyclic nested submodules contribute their own entry but no children — the
|
|
115
|
+
* absence of further yields is the signal, matching `git submodule status
|
|
116
|
+
* --recursive`.
|
|
117
|
+
*/
|
|
118
|
+
declare function walkSubmodules(ctx: Context, options?: WalkSubmodulesOptions): AsyncIterable<SubmoduleEntry>;
|
|
119
|
+
|
|
120
|
+
declare function walkTree(ctx: Context, treeIdOrObject: ObjectId | Tree, options?: WalkTreeOptions): AsyncIterable<WalkTreeEntry>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Depth-first walk of the working tree starting at `ctx.layout.workDir`.
|
|
124
|
+
*
|
|
125
|
+
* Yields leaf entries (files and symlinks) as `{ path, stat }`. Directories
|
|
126
|
+
* are descended into, not yielded. `.git` at any level is skipped
|
|
127
|
+
* (case-insensitive, NTFS-trimmed). Embedded repositories (directories
|
|
128
|
+
* containing a `.git` child) are skipped entirely — yields nothing under
|
|
129
|
+
* them. Symlinks are surfaced via `lstat` (no follow); a symlink to a
|
|
130
|
+
* directory is yielded as a leaf, not descended into.
|
|
131
|
+
*
|
|
132
|
+
* The host repository's own `.git` is NOT treated as an embedded-repo
|
|
133
|
+
* marker — at the workDir root we only skip the `.git` entry itself, not
|
|
134
|
+
* the workDir.
|
|
135
|
+
*/
|
|
136
|
+
declare function walkWorkingTree(ctx: Context, options?: WalkWorkingTreeOptions): AsyncIterable<WalkWorkingTreeEntry>;
|
|
137
|
+
|
|
138
|
+
declare function writeObject(ctx: Context, object: GitObject): Promise<ObjectId>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Write a symbolic ref atomically. Used for HEAD updates that point at a
|
|
142
|
+
* branch, branch renames affecting the current HEAD, and `clone`/`init`
|
|
143
|
+
* to set the initial HEAD.
|
|
144
|
+
*
|
|
145
|
+
* Single-level only in v1: target MUST be a direct ref name (no chained
|
|
146
|
+
* symrefs). Validation runs through `validateRefName` for both `name` and
|
|
147
|
+
* `target` — invalid inputs throw INVALID_REF before any I/O.
|
|
148
|
+
*/
|
|
149
|
+
declare const writeSymbolicRef: (ctx: Context, name: RefName, target: RefName) => Promise<void>;
|
|
150
|
+
|
|
151
|
+
declare function writeTree(ctx: Context, entries: ReadonlyArray<TreeEntry>): Promise<ObjectId>;
|
|
152
|
+
|
|
153
|
+
export { createCommit as a, readIndex as b, catFileBatch as c, diffTrees as d, readObject as e, readTree as f, getRepoRoot as g, recordRefUpdate as h, resolveRef as i, runHook as j, walkSubmodules as k, walkTree as l, mergeBase as m, walkWorkingTree as n, writeObject as o, writeSymbolicRef as p, writeTree as q, readBlob as r, sparseCheckoutPath as s, updateRef as u, walkCommits as w };
|
|
154
|
+
export type { GitIndex as G, HookInput as H, IndexEntry as I };
|