isomorphic-git 1.32.3 → 1.33.1

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.
@@ -0,0 +1,953 @@
1
+ export const __esModule: boolean;
2
+ export type TreeEntry = {
3
+ /**
4
+ * - the 6 digit hexadecimal mode
5
+ */
6
+ mode: string;
7
+ /**
8
+ * - the name of the file or directory
9
+ */
10
+ path: string;
11
+ /**
12
+ * - the SHA-1 object id of the blob or tree
13
+ */
14
+ oid: string;
15
+ /**
16
+ * - the type of object
17
+ */
18
+ type: "commit" | "blob" | "tree";
19
+ };
20
+ export type GitProgressEvent = {
21
+ phase: string;
22
+ loaded: number;
23
+ total: number;
24
+ };
25
+ export type ProgressCallback = (progress: GitProgressEvent) => void | Promise<void>;
26
+ export type GitHttpRequest = {
27
+ /**
28
+ * - The URL to request
29
+ */
30
+ url: string;
31
+ /**
32
+ * - The HTTP method to use
33
+ */
34
+ method?: string | undefined;
35
+ /**
36
+ * - Headers to include in the HTTP request
37
+ */
38
+ headers?: {
39
+ [x: string]: string;
40
+ } | undefined;
41
+ /**
42
+ * - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
43
+ */
44
+ agent?: any;
45
+ /**
46
+ * - An async iterator of Uint8Arrays that make up the body of POST requests
47
+ */
48
+ body?: AsyncIterableIterator<Uint8Array>;
49
+ /**
50
+ * - Reserved for future use (emitting `GitProgressEvent`s)
51
+ */
52
+ onProgress?: ProgressCallback | undefined;
53
+ /**
54
+ * - Reserved for future use (canceling a request)
55
+ */
56
+ signal?: object;
57
+ };
58
+ export type GitHttpResponse = {
59
+ /**
60
+ * - The final URL that was fetched after any redirects
61
+ */
62
+ url: string;
63
+ /**
64
+ * - The HTTP method that was used
65
+ */
66
+ method?: string | undefined;
67
+ /**
68
+ * - HTTP response headers
69
+ */
70
+ headers?: {
71
+ [x: string]: string;
72
+ } | undefined;
73
+ /**
74
+ * - An async iterator of Uint8Arrays that make up the body of the response
75
+ */
76
+ body?: AsyncIterableIterator<Uint8Array>;
77
+ /**
78
+ * - The HTTP status code
79
+ */
80
+ statusCode: number;
81
+ /**
82
+ * - The HTTP status message
83
+ */
84
+ statusMessage: string;
85
+ };
86
+ export type HttpFetch = (request: GitHttpRequest) => Promise<GitHttpResponse>;
87
+ export type HttpClient = {
88
+ request: HttpFetch;
89
+ };
90
+ /**
91
+ * A git commit object.
92
+ */
93
+ export type CommitObject = {
94
+ /**
95
+ * Commit message
96
+ */
97
+ message: string;
98
+ /**
99
+ * SHA-1 object id of corresponding file tree
100
+ */
101
+ tree: string;
102
+ /**
103
+ * an array of zero or more SHA-1 object ids
104
+ */
105
+ parent: string[];
106
+ author: {
107
+ name: string;
108
+ email: string;
109
+ timestamp: number;
110
+ timezoneOffset: number;
111
+ };
112
+ committer: {
113
+ name: string;
114
+ email: string;
115
+ timestamp: number;
116
+ timezoneOffset: number;
117
+ };
118
+ /**
119
+ * PGP signature (if present)
120
+ */
121
+ gpgsig?: string | undefined;
122
+ };
123
+ /**
124
+ * A git tree object. Trees represent a directory snapshot.
125
+ */
126
+ export type TreeObject = TreeEntry[];
127
+ /**
128
+ * A git annotated tag object.
129
+ */
130
+ export type TagObject = {
131
+ /**
132
+ * SHA-1 object id of object being tagged
133
+ */
134
+ object: string;
135
+ /**
136
+ * the type of the object being tagged
137
+ */
138
+ type: "blob" | "tree" | "commit" | "tag";
139
+ /**
140
+ * the tag name
141
+ */
142
+ tag: string;
143
+ tagger: {
144
+ name: string;
145
+ email: string;
146
+ timestamp: number;
147
+ timezoneOffset: number;
148
+ };
149
+ /**
150
+ * tag message
151
+ */
152
+ message: string;
153
+ /**
154
+ * PGP signature (if present)
155
+ */
156
+ gpgsig?: string | undefined;
157
+ };
158
+ export type ReadCommitResult = {
159
+ /**
160
+ * - SHA-1 object id of this commit
161
+ */
162
+ oid: string;
163
+ /**
164
+ * - the parsed commit object
165
+ */
166
+ commit: CommitObject;
167
+ /**
168
+ * - PGP signing payload
169
+ */
170
+ payload: string;
171
+ };
172
+ /**
173
+ * - This object has the following schema:
174
+ */
175
+ export type ServerRef = {
176
+ /**
177
+ * - The name of the ref
178
+ */
179
+ ref: string;
180
+ /**
181
+ * - The SHA-1 object id the ref points to
182
+ */
183
+ oid: string;
184
+ /**
185
+ * - The target ref pointed to by a symbolic ref
186
+ */
187
+ target?: string | undefined;
188
+ /**
189
+ * - If the oid is the SHA-1 object id of an annotated tag, this is the SHA-1 object id that the annotated tag points to
190
+ */
191
+ peeled?: string | undefined;
192
+ };
193
+ export type Walker = {
194
+ /**
195
+ * ('GitWalkerSymbol')
196
+ */
197
+ Symbol: Symbol;
198
+ };
199
+ /**
200
+ * Normalized subset of filesystem `stat` data:
201
+ */
202
+ export type Stat = {
203
+ ctimeSeconds: number;
204
+ ctimeNanoseconds: number;
205
+ mtimeSeconds: number;
206
+ mtimeNanoseconds: number;
207
+ dev: number;
208
+ ino: number;
209
+ mode: number;
210
+ uid: number;
211
+ gid: number;
212
+ size: number;
213
+ };
214
+ /**
215
+ * The `WalkerEntry` is an interface that abstracts computing many common tree / blob stats.
216
+ */
217
+ export type WalkerEntry = {
218
+ type: () => Promise<"tree" | "blob" | "special" | "commit">;
219
+ mode: () => Promise<number>;
220
+ oid: () => Promise<string>;
221
+ content: () => Promise<Uint8Array | void>;
222
+ stat: () => Promise<Stat>;
223
+ };
224
+ export type CallbackFsClient = {
225
+ /**
226
+ * - https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback
227
+ */
228
+ readFile: Function;
229
+ /**
230
+ * - https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback
231
+ */
232
+ writeFile: Function;
233
+ /**
234
+ * - https://nodejs.org/api/fs.html#fs_fs_unlink_path_callback
235
+ */
236
+ unlink: Function;
237
+ /**
238
+ * - https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback
239
+ */
240
+ readdir: Function;
241
+ /**
242
+ * - https://nodejs.org/api/fs.html#fs_fs_mkdir_path_mode_callback
243
+ */
244
+ mkdir: Function;
245
+ /**
246
+ * - https://nodejs.org/api/fs.html#fs_fs_rmdir_path_callback
247
+ */
248
+ rmdir: Function;
249
+ /**
250
+ * - https://nodejs.org/api/fs.html#fs_fs_stat_path_options_callback
251
+ */
252
+ stat: Function;
253
+ /**
254
+ * - https://nodejs.org/api/fs.html#fs_fs_lstat_path_options_callback
255
+ */
256
+ lstat: Function;
257
+ /**
258
+ * - https://nodejs.org/api/fs.html#fs_fs_readlink_path_options_callback
259
+ */
260
+ readlink?: Function | undefined;
261
+ /**
262
+ * - https://nodejs.org/api/fs.html#fs_fs_symlink_target_path_type_callback
263
+ */
264
+ symlink?: Function | undefined;
265
+ /**
266
+ * - https://nodejs.org/api/fs.html#fs_fs_chmod_path_mode_callback
267
+ */
268
+ chmod?: Function | undefined;
269
+ };
270
+ export type PromiseFsClient = {
271
+ promises: {
272
+ readFile: Function;
273
+ writeFile: Function;
274
+ unlink: Function;
275
+ readdir: Function;
276
+ mkdir: Function;
277
+ rmdir: Function;
278
+ stat: Function;
279
+ lstat: Function;
280
+ readlink?: Function | undefined;
281
+ symlink?: Function | undefined;
282
+ chmod?: Function | undefined;
283
+ };
284
+ };
285
+ export type FsClient = CallbackFsClient | PromiseFsClient;
286
+ export type MessageCallback = (message: string) => void | Promise<void>;
287
+ export type GitAuth = {
288
+ username?: string | undefined;
289
+ password?: string | undefined;
290
+ headers?: {
291
+ [x: string]: string;
292
+ } | undefined;
293
+ /**
294
+ * Tells git to throw a `UserCanceledError` (instead of an `HttpError`).
295
+ */
296
+ cancel?: boolean | undefined;
297
+ };
298
+ export type AuthCallback = (url: string, auth: GitAuth) => GitAuth | void | Promise<GitAuth | void>;
299
+ export type AuthFailureCallback = (url: string, auth: GitAuth) => GitAuth | void | Promise<GitAuth | void>;
300
+ export type AuthSuccessCallback = (url: string, auth: GitAuth) => void | Promise<void>;
301
+ export type SignParams = {
302
+ /**
303
+ * - a plaintext message
304
+ */
305
+ payload: string;
306
+ /**
307
+ * - an 'ASCII armor' encoded PGP key (technically can actually contain _multiple_ keys)
308
+ */
309
+ secretKey: string;
310
+ };
311
+ export type SignCallback = (args: SignParams) => {
312
+ signature: string;
313
+ } | Promise<{
314
+ signature: string;
315
+ }>;
316
+ export type MergeDriverParams = {
317
+ branches: Array<string>;
318
+ contents: Array<string>;
319
+ path: string;
320
+ };
321
+ export type MergeDriverCallback = (args: MergeDriverParams) => {
322
+ cleanMerge: boolean;
323
+ mergedText: string;
324
+ } | Promise<{
325
+ cleanMerge: boolean;
326
+ mergedText: string;
327
+ }>;
328
+ export type WalkerMap = (filename: string, entries: WalkerEntry[]) => Promise<any>;
329
+ export type WalkerReduce = (parent: any, children: any[]) => Promise<any>;
330
+ export type WalkerIterateCallback = (entries: WalkerEntry[]) => Promise<any[]>;
331
+ export type WalkerIterate = (walk: WalkerIterateCallback, children: IterableIterator<WalkerEntry[]>) => Promise<any[]>;
332
+ export type RefUpdateStatus = {
333
+ ok: boolean;
334
+ error: string;
335
+ };
336
+ export type PushResult = {
337
+ ok: boolean;
338
+ error: string | null;
339
+ refs: {
340
+ [x: string]: RefUpdateStatus;
341
+ };
342
+ headers?: {
343
+ [x: string]: string;
344
+ } | undefined;
345
+ };
346
+ export type HeadStatus = 0 | 1;
347
+ export type WorkdirStatus = 0 | 1 | 2;
348
+ export type StageStatus = 0 | 1 | 2 | 3;
349
+ export type StatusRow = [string, HeadStatus, WorkdirStatus, StageStatus];
350
+ /**
351
+ * the type of stash ops
352
+ */
353
+ export type StashOp = "push" | "pop" | "apply" | "drop" | "list" | "clear";
354
+ /**
355
+ * - when compare WORDIR to HEAD, 'remove' could mean 'untracked'
356
+ */
357
+ export type StashChangeType = "equal" | "modify" | "add" | "remove" | "unknown";
358
+ export type ClientRef = {
359
+ /**
360
+ * The name of the ref
361
+ */
362
+ ref: string;
363
+ /**
364
+ * The SHA-1 object id the ref points to
365
+ */
366
+ oid: string;
367
+ };
368
+ export type PrePushParams = {
369
+ /**
370
+ * The expanded name of target remote
371
+ */
372
+ remote: string;
373
+ /**
374
+ * The URL address of target remote
375
+ */
376
+ url: string;
377
+ /**
378
+ * The ref which the client wants to push to the remote
379
+ */
380
+ localRef: ClientRef;
381
+ /**
382
+ * The ref which is known by the remote
383
+ */
384
+ remoteRef: ClientRef;
385
+ };
386
+ export type PrePushCallback = (args: PrePushParams) => boolean | Promise<boolean>;
387
+ export type PostCheckoutParams = {
388
+ /**
389
+ * The SHA-1 object id of HEAD before checkout
390
+ */
391
+ previousHead: string;
392
+ /**
393
+ * The SHA-1 object id of HEAD after checkout
394
+ */
395
+ newHead: string;
396
+ /**
397
+ * flag determining whether a branch or a set of files was checked
398
+ */
399
+ type: "branch" | "file";
400
+ };
401
+ export type PostCheckoutCallback = (args: PostCheckoutParams) => void | Promise<void>;
402
+ /**
403
+ * Manages access to the Git configuration file, providing methods to read and save configurations.
404
+ */
405
+ export class GitConfigManager {
406
+ /**
407
+ * Reads the Git configuration file from the specified `.git` directory.
408
+ *
409
+ * @param {object} opts - Options for reading the Git configuration.
410
+ * @param {FSClient} opts.fs - A file system implementation.
411
+ * @param {string} opts.gitdir - The path to the `.git` directory.
412
+ * @returns {Promise<GitConfig>} A `GitConfig` object representing the parsed configuration.
413
+ */
414
+ static get({ fs, gitdir }: {
415
+ fs: FSClient;
416
+ gitdir: string;
417
+ }): Promise<GitConfig>;
418
+ /**
419
+ * Saves the provided Git configuration to the specified `.git` directory.
420
+ *
421
+ * @param {object} opts - Options for saving the Git configuration.
422
+ * @param {FSClient} opts.fs - A file system implementation.
423
+ * @param {string} opts.gitdir - The path to the `.git` directory.
424
+ * @param {GitConfig} opts.config - The `GitConfig` object to save.
425
+ * @returns {Promise<void>} Resolves when the configuration has been successfully saved.
426
+ */
427
+ static save({ fs, gitdir, config }: {
428
+ fs: FSClient;
429
+ gitdir: string;
430
+ config: GitConfig;
431
+ }): Promise<void>;
432
+ }
433
+ export class GitIgnoreManager {
434
+ /**
435
+ * Determines whether a given file is ignored based on `.gitignore` rules and exclusion files.
436
+ *
437
+ * @param {Object} args
438
+ * @param {FSClient} args.fs - A file system implementation.
439
+ * @param {string} args.dir - The working directory.
440
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
441
+ * @param {string} args.filepath - The path of the file to check.
442
+ * @returns {Promise<boolean>} - `true` if the file is ignored, `false` otherwise.
443
+ */
444
+ static isIgnored({ fs, dir, gitdir, filepath }: {
445
+ fs: FSClient;
446
+ dir: string;
447
+ gitdir?: string | undefined;
448
+ filepath: string;
449
+ }): Promise<boolean>;
450
+ }
451
+ export class GitIndexManager {
452
+ /**
453
+ * Manages access to the Git index file, ensuring thread-safe operations and caching.
454
+ *
455
+ * @param {object} opts - Options for acquiring the Git index.
456
+ * @param {FSClient} opts.fs - A file system implementation.
457
+ * @param {string} opts.gitdir - The path to the `.git` directory.
458
+ * @param {object} opts.cache - A shared cache object for storing index data.
459
+ * @param {boolean} [opts.allowUnmerged=true] - Whether to allow unmerged paths in the index.
460
+ * @param {function(GitIndex): any} closure - A function to execute with the Git index.
461
+ * @returns {Promise<any>} The result of the closure function.
462
+ * @throws {UnmergedPathsError} If unmerged paths exist and `allowUnmerged` is `false`.
463
+ */
464
+ static acquire({ fs, gitdir, cache, allowUnmerged }: {
465
+ fs: FSClient;
466
+ gitdir: string;
467
+ cache: object;
468
+ allowUnmerged?: boolean | undefined;
469
+ }, closure: (arg0: GitIndex) => any): Promise<any>;
470
+ }
471
+ /**
472
+ * A class for managing Git references, including reading, writing, deleting, and resolving refs.
473
+ */
474
+ export class GitRefManager {
475
+ /**
476
+ * Updates remote refs based on the provided refspecs and options.
477
+ *
478
+ * @param {Object} args
479
+ * @param {FSClient} args.fs - A file system implementation.
480
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
481
+ * @param {string} args.remote - The name of the remote.
482
+ * @param {Map<string, string>} args.refs - A map of refs to their object IDs.
483
+ * @param {Map<string, string>} args.symrefs - A map of symbolic refs.
484
+ * @param {boolean} args.tags - Whether to fetch tags.
485
+ * @param {string[]} [args.refspecs = undefined] - The refspecs to use.
486
+ * @param {boolean} [args.prune = false] - Whether to prune stale refs.
487
+ * @param {boolean} [args.pruneTags = false] - Whether to prune tags.
488
+ * @returns {Promise<Object>} - An object containing pruned refs.
489
+ */
490
+ static updateRemoteRefs({ fs, gitdir, remote, refs, symrefs, tags, refspecs, prune, pruneTags, }: {
491
+ fs: FSClient;
492
+ gitdir?: string | undefined;
493
+ remote: string;
494
+ refs: Map<string, string>;
495
+ symrefs: Map<string, string>;
496
+ tags: boolean;
497
+ refspecs?: string[] | undefined;
498
+ prune?: boolean | undefined;
499
+ pruneTags?: boolean | undefined;
500
+ }): Promise<any>;
501
+ /**
502
+ * Writes a ref to the file system.
503
+ *
504
+ * @param {Object} args
505
+ * @param {FSClient} args.fs - A file system implementation.
506
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
507
+ * @param {string} args.ref - The ref to write.
508
+ * @param {string} args.value - The object ID to write.
509
+ * @returns {Promise<void>}
510
+ */
511
+ static writeRef({ fs, gitdir, ref, value }: {
512
+ fs: FSClient;
513
+ gitdir?: string | undefined;
514
+ ref: string;
515
+ value: string;
516
+ }): Promise<void>;
517
+ /**
518
+ * Writes a symbolic ref to the file system.
519
+ *
520
+ * @param {Object} args
521
+ * @param {FSClient} args.fs - A file system implementation.
522
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
523
+ * @param {string} args.ref - The ref to write.
524
+ * @param {string} args.value - The target ref.
525
+ * @returns {Promise<void>}
526
+ */
527
+ static writeSymbolicRef({ fs, gitdir, ref, value }: {
528
+ fs: FSClient;
529
+ gitdir?: string | undefined;
530
+ ref: string;
531
+ value: string;
532
+ }): Promise<void>;
533
+ /**
534
+ * Deletes a single ref.
535
+ *
536
+ * @param {Object} args
537
+ * @param {FSClient} args.fs - A file system implementation.
538
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
539
+ * @param {string} args.ref - The ref to delete.
540
+ * @returns {Promise<void>}
541
+ */
542
+ static deleteRef({ fs, gitdir, ref }: {
543
+ fs: FSClient;
544
+ gitdir?: string | undefined;
545
+ ref: string;
546
+ }): Promise<void>;
547
+ /**
548
+ * Deletes multiple refs.
549
+ *
550
+ * @param {Object} args
551
+ * @param {FSClient} args.fs - A file system implementation.
552
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
553
+ * @param {string[]} args.refs - The refs to delete.
554
+ * @returns {Promise<void>}
555
+ */
556
+ static deleteRefs({ fs, gitdir, refs }: {
557
+ fs: FSClient;
558
+ gitdir?: string | undefined;
559
+ refs: string[];
560
+ }): Promise<void>;
561
+ /**
562
+ * Resolves a ref to its object ID.
563
+ *
564
+ * @param {Object} args
565
+ * @param {FSClient} args.fs - A file system implementation.
566
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
567
+ * @param {string} args.ref - The ref to resolve.
568
+ * @param {number} [args.depth = undefined] - The maximum depth to resolve symbolic refs.
569
+ * @returns {Promise<string>} - The resolved object ID.
570
+ */
571
+ static resolve({ fs, gitdir, ref, depth }: {
572
+ fs: FSClient;
573
+ gitdir?: string | undefined;
574
+ ref: string;
575
+ depth?: number | undefined;
576
+ }): Promise<string>;
577
+ /**
578
+ * Checks if a ref exists.
579
+ *
580
+ * @param {Object} args
581
+ * @param {FSClient} args.fs - A file system implementation.
582
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
583
+ * @param {string} args.ref - The ref to check.
584
+ * @returns {Promise<boolean>} - True if the ref exists, false otherwise.
585
+ */
586
+ static exists({ fs, gitdir, ref }: {
587
+ fs: FSClient;
588
+ gitdir?: string | undefined;
589
+ ref: string;
590
+ }): Promise<boolean>;
591
+ /**
592
+ * Expands a ref to its full name.
593
+ *
594
+ * @param {Object} args
595
+ * @param {FSClient} args.fs - A file system implementation.
596
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
597
+ * @param {string} args.ref - The ref to expand.
598
+ * @returns {Promise<string>} - The full ref name.
599
+ */
600
+ static expand({ fs, gitdir, ref }: {
601
+ fs: FSClient;
602
+ gitdir?: string | undefined;
603
+ ref: string;
604
+ }): Promise<string>;
605
+ /**
606
+ * Expands a ref against a provided map.
607
+ *
608
+ * @param {Object} args
609
+ * @param {string} args.ref - The ref to expand.
610
+ * @param {Map<string, string>} args.map - The map of refs.
611
+ * @returns {Promise<string>} - The expanded ref.
612
+ */
613
+ static expandAgainstMap({ ref, map }: {
614
+ ref: string;
615
+ map: Map<string, string>;
616
+ }): Promise<string>;
617
+ /**
618
+ * Resolves a ref against a provided map.
619
+ *
620
+ * @param {Object} args
621
+ * @param {string} args.ref - The ref to resolve.
622
+ * @param {string} [args.fullref = args.ref] - The full ref name.
623
+ * @param {number} [args.depth = undefined] - The maximum depth to resolve symbolic refs.
624
+ * @param {Map<string, string>} args.map - The map of refs.
625
+ * @returns {Object} - An object containing the full ref and its object ID.
626
+ */
627
+ static resolveAgainstMap({ ref, fullref, depth, map }: {
628
+ ref: string;
629
+ fullref?: string | undefined;
630
+ depth?: number | undefined;
631
+ map: Map<string, string>;
632
+ }): any;
633
+ /**
634
+ * Reads the packed refs file and returns a map of refs.
635
+ *
636
+ * @param {Object} args
637
+ * @param {FSClient} args.fs - A file system implementation.
638
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
639
+ * @returns {Promise<Map<string, string>>} - A map of packed refs.
640
+ */
641
+ static packedRefs({ fs, gitdir }: {
642
+ fs: FSClient;
643
+ gitdir?: string | undefined;
644
+ }): Promise<Map<string, string>>;
645
+ /**
646
+ * Lists all refs matching a given filepath prefix.
647
+ *
648
+ * @param {Object} args
649
+ * @param {FSClient} args.fs - A file system implementation.
650
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
651
+ * @param {string} args.filepath - The filepath prefix to match.
652
+ * @returns {Promise<string[]>} - A sorted list of refs.
653
+ */
654
+ static listRefs({ fs, gitdir, filepath }: {
655
+ fs: FSClient;
656
+ gitdir?: string | undefined;
657
+ filepath: string;
658
+ }): Promise<string[]>;
659
+ /**
660
+ * Lists all branches, optionally filtered by remote.
661
+ *
662
+ * @param {Object} args
663
+ * @param {FSClient} args.fs - A file system implementation.
664
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
665
+ * @param {string} [args.remote] - The remote to filter branches by.
666
+ * @returns {Promise<string[]>} - A list of branch names.
667
+ */
668
+ static listBranches({ fs, gitdir, remote }: {
669
+ fs: FSClient;
670
+ gitdir?: string | undefined;
671
+ remote?: string | undefined;
672
+ }): Promise<string[]>;
673
+ /**
674
+ * Lists all tags.
675
+ *
676
+ * @param {Object} args
677
+ * @param {FSClient} args.fs - A file system implementation.
678
+ * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
679
+ * @returns {Promise<string[]>} - A list of tag names.
680
+ */
681
+ static listTags({ fs, gitdir }: {
682
+ fs: FSClient;
683
+ gitdir?: string | undefined;
684
+ }): Promise<string[]>;
685
+ }
686
+ export class GitRemoteHTTP {
687
+ /**
688
+ * Returns the capabilities of the GitRemoteHTTP class.
689
+ *
690
+ * @returns {Promise<string[]>} - An array of supported capabilities.
691
+ */
692
+ static capabilities(): Promise<string[]>;
693
+ /**
694
+ * Discovers references from a remote Git repository.
695
+ *
696
+ * @param {Object} args
697
+ * @param {HttpClient} args.http - The HTTP client to use for requests.
698
+ * @param {ProgressCallback} [args.onProgress] - Callback for progress updates.
699
+ * @param {AuthCallback} [args.onAuth] - Callback for providing authentication credentials.
700
+ * @param {AuthFailureCallback} [args.onAuthFailure] - Callback for handling authentication failures.
701
+ * @param {AuthSuccessCallback} [args.onAuthSuccess] - Callback for handling successful authentication.
702
+ * @param {string} [args.corsProxy] - Optional CORS proxy URL.
703
+ * @param {string} args.service - The Git service (e.g., "git-upload-pack").
704
+ * @param {string} args.url - The URL of the remote repository.
705
+ * @param {Object<string, string>} args.headers - HTTP headers to include in the request.
706
+ * @param {1 | 2} args.protocolVersion - The Git protocol version to use.
707
+ * @returns {Promise<Object>} - The parsed response from the remote repository.
708
+ * @throws {HttpError} - If the HTTP request fails.
709
+ * @throws {SmartHttpError} - If the response cannot be parsed.
710
+ * @throws {UserCanceledError} - If the user cancels the operation.
711
+ */
712
+ static discover({ http, onProgress, onAuth, onAuthSuccess, onAuthFailure, corsProxy, service, url: _origUrl, headers, protocolVersion, }: {
713
+ http: HttpClient;
714
+ onProgress?: ProgressCallback | undefined;
715
+ onAuth?: AuthCallback | undefined;
716
+ onAuthFailure?: AuthFailureCallback | undefined;
717
+ onAuthSuccess?: AuthSuccessCallback | undefined;
718
+ corsProxy?: string | undefined;
719
+ service: string;
720
+ url: string;
721
+ headers: {
722
+ [x: string]: string;
723
+ };
724
+ protocolVersion: 1 | 2;
725
+ }): Promise<any>;
726
+ /**
727
+ * Connects to a remote Git repository and sends a request.
728
+ *
729
+ * @param {Object} args
730
+ * @param {HttpClient} args.http - The HTTP client to use for requests.
731
+ * @param {ProgressCallback} [args.onProgress] - Callback for progress updates.
732
+ * @param {string} [args.corsProxy] - Optional CORS proxy URL.
733
+ * @param {string} args.service - The Git service (e.g., "git-upload-pack").
734
+ * @param {string} args.url - The URL of the remote repository.
735
+ * @param {Object<string, string>} [args.headers] - HTTP headers to include in the request.
736
+ * @param {any} args.body - The request body to send.
737
+ * @param {any} args.auth - Authentication credentials.
738
+ * @returns {Promise<GitHttpResponse>} - The HTTP response from the remote repository.
739
+ * @throws {HttpError} - If the HTTP request fails.
740
+ */
741
+ static connect({ http, onProgress, corsProxy, service, url, auth, body, headers, }: {
742
+ http: HttpClient;
743
+ onProgress?: ProgressCallback | undefined;
744
+ corsProxy?: string | undefined;
745
+ service: string;
746
+ url: string;
747
+ headers?: {
748
+ [x: string]: string;
749
+ } | undefined;
750
+ body: any;
751
+ auth: any;
752
+ }): Promise<GitHttpResponse>;
753
+ }
754
+ /**
755
+ * A class for managing Git remotes and determining the appropriate remote helper for a given URL.
756
+ */
757
+ export class GitRemoteManager {
758
+ /**
759
+ * Determines the appropriate remote helper for the given URL.
760
+ *
761
+ * @param {Object} args
762
+ * @param {string} args.url - The URL of the remote repository.
763
+ * @returns {Object} - The remote helper class for the specified transport.
764
+ * @throws {UrlParseError} - If the URL cannot be parsed.
765
+ * @throws {UnknownTransportError} - If the transport is not supported.
766
+ */
767
+ static getRemoteHelperFor({ url }: {
768
+ url: string;
769
+ }): any;
770
+ }
771
+ export class GitShallowManager {
772
+ /**
773
+ * Reads the `shallow` file in the Git repository and returns a set of object IDs (OIDs).
774
+ *
775
+ * @param {Object} args
776
+ * @param {FSClient} args.fs - A file system implementation.
777
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
778
+ * @returns {Promise<Set<string>>} - A set of shallow object IDs.
779
+ */
780
+ static read({ fs, gitdir }: {
781
+ fs: FSClient;
782
+ gitdir?: string | undefined;
783
+ }): Promise<Set<string>>;
784
+ /**
785
+ * Writes a set of object IDs (OIDs) to the `shallow` file in the Git repository.
786
+ * If the set is empty, the `shallow` file is removed.
787
+ *
788
+ * @param {Object} args
789
+ * @param {FSClient} args.fs - A file system implementation.
790
+ * @param {string} [args.gitdir] - [required] The [git directory](dir-vs-gitdir.md) path
791
+ * @param {Set<string>} args.oids - A set of shallow object IDs to write.
792
+ * @returns {Promise<void>}
793
+ */
794
+ static write({ fs, gitdir, oids }: {
795
+ fs: FSClient;
796
+ gitdir?: string | undefined;
797
+ oids: Set<string>;
798
+ }): Promise<void>;
799
+ }
800
+ export class GitStashManager {
801
+ /**
802
+ * Gets the reference name for the stash.
803
+ *
804
+ * @returns {string} - The stash reference name.
805
+ */
806
+ static get refStash(): string;
807
+ /**
808
+ * Gets the reference name for the stash reflogs.
809
+ *
810
+ * @returns {string} - The stash reflogs reference name.
811
+ */
812
+ static get refLogsStash(): string;
813
+ /**
814
+ * Creates an instance of GitStashManager.
815
+ *
816
+ * @param {Object} args
817
+ * @param {FSClient} args.fs - A file system implementation.
818
+ * @param {string} args.dir - The working directory.
819
+ * @param {string}[args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
820
+ */
821
+ constructor({ fs, dir, gitdir }: {
822
+ fs: FSClient;
823
+ dir: string;
824
+ gitdir?: string | undefined;
825
+ });
826
+ /**
827
+ * Gets the file path for the stash reference.
828
+ *
829
+ * @returns {string} - The file path for the stash reference.
830
+ */
831
+ get refStashPath(): string;
832
+ /**
833
+ * Gets the file path for the stash reflogs.
834
+ *
835
+ * @returns {string} - The file path for the stash reflogs.
836
+ */
837
+ get refLogsStashPath(): string;
838
+ /**
839
+ * Retrieves the author information for the stash.
840
+ *
841
+ * @returns {Promise<Object>} - The author object.
842
+ * @throws {MissingNameError} - If the author name is missing.
843
+ */
844
+ getAuthor(): Promise<any>;
845
+ _author: void | {
846
+ name: string;
847
+ email: string;
848
+ timestamp: number;
849
+ timezoneOffset: number;
850
+ } | undefined;
851
+ /**
852
+ * Gets the SHA of a stash entry by its index.
853
+ *
854
+ * @param {number} refIdx - The index of the stash entry.
855
+ * @param {string[]} [stashEntries] - Optional preloaded stash entries.
856
+ * @returns {Promise<string|null>} - The SHA of the stash entry or `null` if not found.
857
+ */
858
+ getStashSHA(refIdx: number, stashEntries?: string[]): Promise<string | null>;
859
+ /**
860
+ * Writes a stash commit to the repository.
861
+ *
862
+ * @param {Object} args
863
+ * @param {string} args.message - The commit message.
864
+ * @param {string} args.tree - The tree object ID.
865
+ * @param {string[]} args.parent - The parent commit object IDs.
866
+ * @returns {Promise<string>} - The object ID of the written commit.
867
+ */
868
+ writeStashCommit({ message, tree, parent }: {
869
+ message: string;
870
+ tree: string;
871
+ parent: string[];
872
+ }): Promise<string>;
873
+ /**
874
+ * Reads a stash commit by its index.
875
+ *
876
+ * @param {number} refIdx - The index of the stash entry.
877
+ * @returns {Promise<Object>} - The stash commit object.
878
+ * @throws {InvalidRefNameError} - If the index is invalid.
879
+ */
880
+ readStashCommit(refIdx: number): Promise<any>;
881
+ /**
882
+ * Writes a stash reference to the repository.
883
+ *
884
+ * @param {string} stashCommit - The object ID of the stash commit.
885
+ * @returns {Promise<void>}
886
+ */
887
+ writeStashRef(stashCommit: string): Promise<void>;
888
+ /**
889
+ * Writes a reflog entry for a stash commit.
890
+ *
891
+ * @param {Object} args
892
+ * @param {string} args.stashCommit - The object ID of the stash commit.
893
+ * @param {string} args.message - The reflog message.
894
+ * @returns {Promise<void>}
895
+ */
896
+ writeStashReflogEntry({ stashCommit, message }: {
897
+ stashCommit: string;
898
+ message: string;
899
+ }): Promise<void>;
900
+ /**
901
+ * Reads the stash reflogs.
902
+ *
903
+ * @param {Object} args
904
+ * @param {boolean} [args.parsed=false] - Whether to parse the reflog entries.
905
+ * @returns {Promise<string[]|Object[]>} - The reflog entries as strings or parsed objects.
906
+ */
907
+ readStashReflogs({ parsed }: {
908
+ parsed?: boolean | undefined;
909
+ }): Promise<string[] | any[]>;
910
+ }
911
+ declare class GitConfig {
912
+ static from(text: any): GitConfig;
913
+ constructor(text: any);
914
+ parsedConfig: any;
915
+ get(path: any, getall?: boolean): Promise<any>;
916
+ getall(path: any): Promise<any>;
917
+ getSubsections(section: any): Promise<any>;
918
+ deleteSection(section: any, subsection: any): Promise<void>;
919
+ append(path: any, value: any): Promise<void>;
920
+ set(path: any, value: any, append?: boolean): Promise<void>;
921
+ toString(): any;
922
+ }
923
+ declare class GitIndex {
924
+ [x: number]: () => {};
925
+ static from(buffer: any): Promise<GitIndex>;
926
+ static fromBuffer(buffer: any): Promise<GitIndex>;
927
+ static _entryToBuffer(entry: any): Promise<any>;
928
+ constructor(entries: any, unmergedPaths: any);
929
+ _dirty: boolean;
930
+ _unmergedPaths: any;
931
+ _entries: any;
932
+ _addEntry(entry: any): void;
933
+ get unmergedPaths(): any[];
934
+ get entries(): any[];
935
+ get entriesMap(): any;
936
+ get entriesFlat(): any;
937
+ insert({ filepath, stats, oid, stage }: {
938
+ filepath: any;
939
+ stats: any;
940
+ oid: any;
941
+ stage?: number | undefined;
942
+ }): void;
943
+ delete({ filepath }: {
944
+ filepath: any;
945
+ }): void;
946
+ clear(): void;
947
+ has({ filepath }: {
948
+ filepath: any;
949
+ }): any;
950
+ render(): string;
951
+ toObject(): Promise<any>;
952
+ }
953
+ export {};