es-git 0.5.0-next.170 → 0.5.0-next.172

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.
Files changed (3) hide show
  1. package/index.d.ts +876 -0
  2. package/index.js +8 -0
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -2374,6 +2374,201 @@ export declare class Reference {
2374
2374
  rename(newName: string, options?: RenameReferenceOptions | undefined | null): Reference
2375
2375
  }
2376
2376
 
2377
+ /** A class to represent a git reflog. */
2378
+ export declare class Reflog {
2379
+ /**
2380
+ * Append a new entry to the reflog.
2381
+ *
2382
+ * @category Reflog/Methods
2383
+ *
2384
+ * @signature
2385
+ * ```ts
2386
+ * class Reflog {
2387
+ * append(newOid: string, committer: Signature, msg?: string | null | undefined): void;
2388
+ * }
2389
+ * ```
2390
+ *
2391
+ * @param {string} newOid - New object ID (SHA1) for this reflog entry.
2392
+ * @param {Signature} committer - Committer signature for this reflog entry.
2393
+ * @param {string} [msg] - Optional message for this reflog entry.
2394
+ * @throws Throws error if the OID is invalid or if appending fails.
2395
+ */
2396
+ append(newOid: string, committer: Signature, msg?: string | undefined | null): void
2397
+ /**
2398
+ * Remove an entry from the reflog.
2399
+ *
2400
+ * @category Reflog/Methods
2401
+ *
2402
+ * @signature
2403
+ * ```ts
2404
+ * class Reflog {
2405
+ * remove(i: number, rewritePreviousEntry?: boolean): void;
2406
+ * }
2407
+ * ```
2408
+ *
2409
+ * @param {number} i - Index of the entry to remove.
2410
+ * @param {boolean} [rewritePreviousEntry] - Whether to rewrite the previous entry. Defaults to `false`.
2411
+ * @throws Throws error if the index is invalid or if removal fails.
2412
+ */
2413
+ remove(i: number, rewritePreviousEntry?: boolean | undefined | null): void
2414
+ /**
2415
+ * Get a reflog entry by index.
2416
+ *
2417
+ * @category Reflog/Methods
2418
+ *
2419
+ * @signature
2420
+ * ```ts
2421
+ * class Reflog {
2422
+ * get(i: number): ReflogEntry | null;
2423
+ * }
2424
+ * ```
2425
+ *
2426
+ * @param {number} i - Index of the entry to get.
2427
+ * @returns Reflog entry at the given index. Returns `null` if the index is out of bounds.
2428
+ */
2429
+ get(i: number): ReflogEntry | null
2430
+ /**
2431
+ * Get the number of entries in the reflog.
2432
+ *
2433
+ * @category Reflog/Methods
2434
+ *
2435
+ * @signature
2436
+ * ```ts
2437
+ * class Reflog {
2438
+ * len(): number;
2439
+ * }
2440
+ * ```
2441
+ *
2442
+ * @returns Number of entries in the reflog.
2443
+ */
2444
+ len(): number
2445
+ /**
2446
+ * Check if the reflog is empty.
2447
+ *
2448
+ * @category Reflog/Methods
2449
+ *
2450
+ * @signature
2451
+ * ```ts
2452
+ * class Reflog {
2453
+ * isEmpty(): boolean;
2454
+ * }
2455
+ * ```
2456
+ *
2457
+ * @returns `true` if the reflog is empty, `false` otherwise.
2458
+ */
2459
+ isEmpty(): boolean
2460
+ /**
2461
+ * Create an iterator over the entries in the reflog.
2462
+ *
2463
+ * @category Reflog/Methods
2464
+ *
2465
+ * @signature
2466
+ * ```ts
2467
+ * class Reflog {
2468
+ * iter(): ReflogIter;
2469
+ * }
2470
+ * ```
2471
+ *
2472
+ * @returns Iterator over the reflog entries.
2473
+ * @throws Throws error if the reflog cannot be accessed.
2474
+ */
2475
+ iter(): ReflogIter
2476
+ /**
2477
+ * Write the reflog to disk.
2478
+ *
2479
+ * @category Reflog/Methods
2480
+ *
2481
+ * @signature
2482
+ * ```ts
2483
+ * class Reflog {
2484
+ * write(): void;
2485
+ * }
2486
+ * ```
2487
+ *
2488
+ * @throws Throws error if writing fails.
2489
+ */
2490
+ write(): void
2491
+ }
2492
+
2493
+ /** A class to represent a git reflog entry. */
2494
+ export declare class ReflogEntry {
2495
+ /**
2496
+ * Get the committer of this reflog entry.
2497
+ *
2498
+ * @category ReflogEntry/Methods
2499
+ *
2500
+ * @signature
2501
+ * ```ts
2502
+ * class ReflogEntry {
2503
+ * committer(): Signature;
2504
+ * }
2505
+ * ```
2506
+ *
2507
+ * @returns Committer signature of this reflog entry.
2508
+ */
2509
+ committer(): Signature
2510
+ /**
2511
+ * Get the new object ID (SHA1) of this reflog entry.
2512
+ *
2513
+ * @category ReflogEntry/Methods
2514
+ *
2515
+ * @signature
2516
+ * ```ts
2517
+ * class ReflogEntry {
2518
+ * idNew(): string;
2519
+ * }
2520
+ * ```
2521
+ *
2522
+ * @returns New object ID (SHA1) of this reflog entry.
2523
+ */
2524
+ idNew(): string
2525
+ /**
2526
+ * Get the old object ID (SHA1) of this reflog entry.
2527
+ *
2528
+ * @category ReflogEntry/Methods
2529
+ *
2530
+ * @signature
2531
+ * ```ts
2532
+ * class ReflogEntry {
2533
+ * idOld(): string;
2534
+ * }
2535
+ * ```
2536
+ *
2537
+ * @returns Old object ID (SHA1) of this reflog entry.
2538
+ */
2539
+ idOld(): string
2540
+ /**
2541
+ * Get the message of this reflog entry.
2542
+ *
2543
+ * @category ReflogEntry/Methods
2544
+ *
2545
+ * @signature
2546
+ * ```ts
2547
+ * class ReflogEntry {
2548
+ * message(): string;
2549
+ * }
2550
+ * ```
2551
+ *
2552
+ * @returns Message of this reflog entry. Returns `null` if no message is present.
2553
+ * @throws Throws error if the message is not valid utf-8.
2554
+ */
2555
+ message(): string | null
2556
+ }
2557
+
2558
+ /**
2559
+ * An iterator over the entries in a reflog.
2560
+ *
2561
+ * This type extends JavaScript's `Iterator`, and so has the iterator helper
2562
+ * methods. It may extend the upcoming TypeScript `Iterator` class in the future.
2563
+ *
2564
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helper_methods
2565
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-6.html#iterator-helper-methods
2566
+ */
2567
+ export declare class ReflogIter extends Iterator<ReflogEntry, void, void> {
2568
+
2569
+ next(value?: void): IteratorResult<ReflogEntry, void>
2570
+ }
2571
+
2377
2572
  /**
2378
2573
  * A class representing a [remote][1] of a git repository.
2379
2574
  *
@@ -3785,6 +3980,56 @@ export declare class Repository {
3785
3980
  * ```
3786
3981
  */
3787
3982
  getReference(name: string): Reference
3983
+ /**
3984
+ * Lookup a reflog by its name.
3985
+ *
3986
+ * @category Repository/Methods
3987
+ *
3988
+ * @signature
3989
+ * ```ts
3990
+ * class Repository {
3991
+ * reflog(name: string): Reflog;
3992
+ * }
3993
+ * ```
3994
+ *
3995
+ * @param {string} name - Name of the reference whose reflog to lookup (e.g., "HEAD", "refs/heads/main").
3996
+ * @returns Reflog instance for the given reference name.
3997
+ * @throws Throws error if the reflog does not exist or cannot be opened.
3998
+ */
3999
+ reflog(name: string): Reflog
4000
+ /**
4001
+ * Rename a reflog.
4002
+ *
4003
+ * @category Repository/Methods
4004
+ *
4005
+ * @signature
4006
+ * ```ts
4007
+ * class Repository {
4008
+ * reflogRename(oldName: string, newName: string): void;
4009
+ * }
4010
+ * ```
4011
+ *
4012
+ * @param {string} oldName - Old name of the reference.
4013
+ * @param {string} newName - New name of the reference.
4014
+ * @throws Throws error if renaming fails.
4015
+ */
4016
+ reflogRename(oldName: string, newName: string): void
4017
+ /**
4018
+ * Delete a reflog.
4019
+ *
4020
+ * @category Repository/Methods
4021
+ *
4022
+ * @signature
4023
+ * ```ts
4024
+ * class Repository {
4025
+ * reflogDelete(name: string): void;
4026
+ * }
4027
+ * ```
4028
+ *
4029
+ * @param {string} name - Name of the reference whose reflog to delete.
4030
+ * @throws Throws error if deletion fails.
4031
+ */
4032
+ reflogDelete(name: string): void
3788
4033
  /**
3789
4034
  * List all remotes for a given repository
3790
4035
  *
@@ -4521,6 +4766,179 @@ export declare class Repository {
4521
4766
  * @returns A container for a list of status information about a repository.
4522
4767
  */
4523
4768
  statuses(): Statuses
4769
+ /**
4770
+ * Set up a new git submodule for checkout.
4771
+ *
4772
+ * This does "git submodule add" up to the fetch and checkout of the
4773
+ * submodule contents. It preps a new submodule, creates an entry in
4774
+ * `.gitmodules` and creates an empty initialized repository either at the
4775
+ * given path in the working directory or in `.git/modules` with a gitlink
4776
+ * from the working directory to the new repo.
4777
+ *
4778
+ * To fully emulate "git submodule add" call this function, then `open()`
4779
+ * the submodule repo and perform the clone step as needed. Lastly, call
4780
+ * `addFinalize()` to wrap up adding the new submodule and `.gitmodules`
4781
+ * to the index to be ready to commit.
4782
+ *
4783
+ * @category Repository/Methods
4784
+ * @signature
4785
+ * ```ts
4786
+ * class Repository {
4787
+ * submodule(
4788
+ * url: string,
4789
+ * path: string,
4790
+ * useGitlink?: boolean | null | undefined,
4791
+ * ): Submodule;
4792
+ * }
4793
+ * ```
4794
+ *
4795
+ * @param {string} url - URL for the submodule's remote.
4796
+ * @param {string} path - Path at which the submodule should be created.
4797
+ * @param {boolean} [useGitlink] - Should workdir contain a gitlink to the repo in
4798
+ * `.git/modules` vs. repo directly in workdir.
4799
+ *
4800
+ * @returns The submodule.
4801
+ */
4802
+ submodule(url: string, path: string, useGitlink?: boolean | undefined | null): Submodule
4803
+ submodules(): Array<Submodule>
4804
+ /**
4805
+ * Lookup submodule information by name or path.
4806
+ *
4807
+ * Given either the submodule name or path (they are usually the same),
4808
+ * this returns a structure describing the submodule.
4809
+ *
4810
+ * @category Repository/Methods
4811
+ * @signature
4812
+ * ```ts
4813
+ * class Repository {
4814
+ * getSubmodule(name: string): Submodule;
4815
+ * }
4816
+ * ```
4817
+ *
4818
+ * @param {string} name - The name of or path to the submodule; trailing slashes okay.
4819
+ * @returns The submodule.
4820
+ * @throws If the submodule not found.
4821
+ */
4822
+ getSubmodule(name: string): Submodule
4823
+ /**
4824
+ * Lookup submodule information by name or path.
4825
+ *
4826
+ * Given either the submodule name or path (they are usually the same),
4827
+ * this returns a structure describing the submodule.
4828
+ *
4829
+ * @category Repository/Methods
4830
+ * @signature
4831
+ * ```ts
4832
+ * class Repository {
4833
+ * findSubmodule(name: string): Submodule | null;
4834
+ * }
4835
+ * ```
4836
+ *
4837
+ * @param {string} name - The name of or path to the submodule; trailing slashes okay.
4838
+ * @returns The submodule. Returns `null` if the submodule is not found.
4839
+ */
4840
+ findSubmodule(name: string): Submodule | null
4841
+ /**
4842
+ * Get the status for a submodule.
4843
+ *
4844
+ * This looks at a submodule and tries to determine the status. It
4845
+ * will return a combination of the `SubmoduleStatus` values.
4846
+ *
4847
+ * @category Repository/Methods
4848
+ * @signature
4849
+ * ```ts
4850
+ * class Repository {
4851
+ * submoduleStatus(name: string, ignore: SubmoduleIgnore): number;
4852
+ * }
4853
+ * ```
4854
+ *
4855
+ * @param {string} name - The name of the submodule.
4856
+ * @param {SubmoduleIgnore} ignore - The ignore rules to follow.
4857
+ * @returns The combination of the `SubmoduleStatus` values.
4858
+ *
4859
+ * @example
4860
+ * ```ts
4861
+ * import { openRepository, submoduleStatusContains, SubmoduleStatus } from 'es-git';
4862
+ *
4863
+ * const repo = await openRepository('...');
4864
+ * const status = repo.submoduleStatus('mysubmodule', 'None');
4865
+ *
4866
+ * console.log(
4867
+ * submoduleStatusContains(status, SubmoduleStatus.InHead | SubmoduleStatus.InIndex)
4868
+ * ); // true
4869
+ * ```
4870
+ */
4871
+ submoduleStatus(name: string, ignore: SubmoduleIgnore): number
4872
+ /**
4873
+ * Set the ignore rule for the submodule in the configuration
4874
+ *
4875
+ * This does not affect any currently-loaded instances.
4876
+ *
4877
+ * @category Repository/Methods
4878
+ * @signature
4879
+ * ```ts
4880
+ * class Repository {
4881
+ * submoduleSetIgnore(name: string, ignore: SubmoduleIgnore): void;
4882
+ * }
4883
+ * ```
4884
+ *
4885
+ * @param {string} name - The name of the submodule.
4886
+ * @param {SubmoduleIgnore} ignore - The new value for the ignore rule.
4887
+ */
4888
+ submoduleSetIgnore(name: string, ignore: SubmoduleIgnore): void
4889
+ /**
4890
+ * Set the update rule for the submodule in the configuration
4891
+ *
4892
+ * This setting won't affect any existing instances.
4893
+ *
4894
+ * @category Repository/Methods
4895
+ * @signature
4896
+ * ```ts
4897
+ * class Repository {
4898
+ * submoduleSetUpdate(name: string, update: SubmoduleUpdate): void;
4899
+ * }
4900
+ * ```
4901
+ *
4902
+ * @param {string} name - The name of the submodule.
4903
+ * @param {SubmoduleUpdate} update - The new value to use.
4904
+ */
4905
+ submoduleSetUpdate(name: string, update: SubmoduleUpdate): void
4906
+ /**
4907
+ * Set the URL for the submodule in the configuration
4908
+ *
4909
+ * After calling this, you may wish to call `Submodule#sync()` to write
4910
+ * the changes to the checked out submodule repository.
4911
+ *
4912
+ * @category Repository/Methods
4913
+ * @signature
4914
+ * ```ts
4915
+ * class Repository {
4916
+ * submoduleSetUrl(name: string, url: string): void;
4917
+ * }
4918
+ * ```
4919
+ *
4920
+ * @param {string} name - The name of the submodule to configure.
4921
+ * @param {string} url - URL that should be used for the submodule.
4922
+ */
4923
+ submoduleSetUrl(name: string, url: string): void
4924
+ /**
4925
+ * Set the branch for the submodule in the configuration
4926
+ *
4927
+ * After calling this, you may wish to call `Submodule#sync()` to write
4928
+ * the changes to the checked out submodule repository.
4929
+ *
4930
+ * @category Repository/Methods
4931
+ * @signature
4932
+ * ```ts
4933
+ * class Repository {
4934
+ * submoduleSetBranch(name: string, branchName: string): void;
4935
+ * }
4936
+ * ```
4937
+ *
4938
+ * @param {string} name - The name of the submodule to configure.
4939
+ * @param {string} branchName - Branch that should be used for the submodule
4940
+ */
4941
+ submoduleSetBranch(name: string, branchName: string): void
4524
4942
  /**
4525
4943
  * Lookup a tag object by prefix hash from the repository.
4526
4944
  *
@@ -5321,6 +5739,325 @@ export declare class StatusesIter extends Iterator<StatusEntry, void, void> {
5321
5739
  next(value?: void): IteratorResult<StatusEntry, void>
5322
5740
  }
5323
5741
 
5742
+ export declare class Submodule {
5743
+ /**
5744
+ * Get the name for the submodule.
5745
+ *
5746
+ * @category Submodule/Methods
5747
+ * @signature
5748
+ * ```ts
5749
+ * class Submodule {
5750
+ * name(): string;
5751
+ * }
5752
+ * ```
5753
+ */
5754
+ name(): string
5755
+ /**
5756
+ * Get the submodule's branch.
5757
+ * ule/Methods
5758
+ * @signature
5759
+ * ```ts
5760
+ * class Submodule {
5761
+ * branch(): string | null;
5762
+ * }
5763
+ * ```
5764
+ * @returns The branch name of the submodule. Returns `null` if the branch if the branch is
5765
+ * not yet available.
5766
+ */
5767
+ branch(): string | null
5768
+ /**
5769
+ * Get the submodule's URL.
5770
+ *
5771
+ * @category Submodule/Methods
5772
+ * @signature
5773
+ * ```ts
5774
+ * class Submodule {
5775
+ * url(): string | null;
5776
+ * }
5777
+ * ```
5778
+ *
5779
+ * @returns The URL of the submodule. Returns `null` if the URL isn't present.
5780
+ */
5781
+ url(): string | null
5782
+ /**
5783
+ * Get the path for the submodule.
5784
+ *
5785
+ * @category Submodule/Methods
5786
+ * @signature
5787
+ * ```ts
5788
+ * class Submodule {
5789
+ * path(): string;
5790
+ * }
5791
+ * ```
5792
+ *
5793
+ * @returns The path for the submodule.
5794
+ */
5795
+ path(): string
5796
+ /**
5797
+ * Get the OID for the submodule in the current `HEAD` tree.
5798
+ *
5799
+ * @category Submodule/Methods
5800
+ * @signature
5801
+ * ```ts
5802
+ * class Submodule {
5803
+ * headId(): string | null;
5804
+ * }
5805
+ * ```
5806
+ *
5807
+ * @returns The OID for the submodule in the current `HEAD` tree.
5808
+ */
5809
+ headId(): string | null
5810
+ /**
5811
+ * Get the OID for the submodule in the index.
5812
+ *
5813
+ * @category Submodule/Methods
5814
+ * @signature
5815
+ * ```ts
5816
+ * class Submodule {
5817
+ * indexId(): string | null;
5818
+ * }
5819
+ * ```
5820
+ *
5821
+ * @returns The OID for the submodule in the index.
5822
+ */
5823
+ indexId(): string | null
5824
+ /**
5825
+ * Get the OID for the submodule in the current working directory.
5826
+ *
5827
+ * This returns the OID that corresponds to looking up `HEAD` in the
5828
+ * checked out submodule. If there are pending changes in the index or
5829
+ * anything else, this won't notice that.
5830
+ *
5831
+ * @category Submodule/Methods
5832
+ * @signature
5833
+ * ```ts
5834
+ * class Submodule {
5835
+ * workdirId(): string | null;
5836
+ * }
5837
+ * ```
5838
+ *
5839
+ * @returns The OID for the submodule in the current working directory.
5840
+ */
5841
+ workdirId(): string | null
5842
+ /**
5843
+ * Get the ignore rule that will be used for the submodule.
5844
+ *
5845
+ * @category Submodule/Methods
5846
+ * @signature
5847
+ * ```ts
5848
+ * class Submodule {
5849
+ * ignoreRule(): SubmoduleIgnore;
5850
+ * }
5851
+ * ```
5852
+ *
5853
+ * @returns The ignore rule that will be used for the submodule.
5854
+ */
5855
+ ignoreRule(): SubmoduleIgnore
5856
+ /**
5857
+ * Get the update rule that will be used for the submodule.
5858
+ *
5859
+ * @category Submodule/Methods
5860
+ * @signature
5861
+ * ```ts
5862
+ * class Submodule {
5863
+ * updateStrategy(): SubmoduleUpdate;
5864
+ * }
5865
+ * ```
5866
+ *
5867
+ * @returns The update rule that will be used for the submodule.
5868
+ */
5869
+ updateStrategy(): SubmoduleUpdate
5870
+ /**
5871
+ * Copy submodule info into ".git/config" file.
5872
+ *
5873
+ * Just like "git submodule init", this copies information about the
5874
+ * submodule into ".git/config". You can use the accessor functions above
5875
+ * to alter the in-memory git_submodule object and control what is written
5876
+ * to the config, overriding what is in .gitmodules.
5877
+ *
5878
+ * By default, existing entries will not be overwritten, but passing `true`
5879
+ * for `overwrite` forces them to be updated.
5880
+ *
5881
+ * @category Submodule/Methods
5882
+ * @signature
5883
+ * ```ts
5884
+ * class Submodule {
5885
+ * init(
5886
+ * overwrite?: boolean | null | undefined,
5887
+ * signal?: AbortSignal | null | undefined,
5888
+ * ): Promise<void>;
5889
+ * }
5890
+ * ```
5891
+ *
5892
+ * @param {boolean} [overwrite] - By default, existing entries will not be overwritten, but
5893
+ * setting this to true forces them to be updated.
5894
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5895
+ */
5896
+ init(overwrite?: boolean | undefined | null, signal?: AbortSignal | undefined | null): Promise<void>
5897
+ /**
5898
+ * Set up the subrepository for a submodule in preparation for clone.
5899
+ *
5900
+ * This function can be called to init and set up a submodule repository
5901
+ * from a submodule in preparation to clone it from its remote.
5902
+ *
5903
+ * @category Submodule/Methods
5904
+ * @signature
5905
+ * ```ts
5906
+ * class Submodule {
5907
+ * repoInit(
5908
+ * useGitlink?: boolean | null | undefined,
5909
+ * signal?: AbortSignal | null | undefined,
5910
+ * ): Promise<Repository>;
5911
+ * }
5912
+ * ```
5913
+ *
5914
+ * @param {boolean} [useGitlink] - Should the workdir contain a gitlink to the repo in
5915
+ * `.git/modules` vs. repo directly in workdir.
5916
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5917
+ *
5918
+ * @returns The repository.
5919
+ */
5920
+ repoInit(useGitlink?: boolean | undefined | null, signal?: AbortSignal | undefined | null): Promise<Repository>
5921
+ /**
5922
+ * Open the repository for a submodule.
5923
+ *
5924
+ * This will only work if the submodule is checked out into the working
5925
+ * directory.
5926
+ *
5927
+ * @category Submodule/Methods
5928
+ * @signature
5929
+ * ```ts
5930
+ * class Submodule {
5931
+ * open(signal?: AbortSignal | null | undefined): Promise<Repository>;
5932
+ * }
5933
+ * ```
5934
+ *
5935
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5936
+ * @returns The repository.
5937
+ */
5938
+ open(signal?: AbortSignal | undefined | null): Promise<Repository>
5939
+ /**
5940
+ * Reread submodule info from config, index, and `HEAD`.
5941
+ *
5942
+ * Call this to reread cached submodule information for this submodule if
5943
+ * you have reason to believe that it has changed.
5944
+ *
5945
+ * @category Submodule/Methods
5946
+ * @signature
5947
+ * ```ts
5948
+ * class Submodule {
5949
+ * reload(
5950
+ * force?: boolean | null | undefined,
5951
+ * signal?: AbortSignal | null | undefined,
5952
+ * ): Promise<void>;
5953
+ * }
5954
+ * ```
5955
+ *
5956
+ * @param {boolean} [force] - If this is `true`, then data will be reloaded even if it
5957
+ * doesn't seem out of date.
5958
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5959
+ */
5960
+ reload(force?: boolean | undefined | null, signal?: AbortSignal | undefined | null): Promise<void>
5961
+ /**
5962
+ * Copy submodule remote info into submodule repo.
5963
+ *
5964
+ * This copies the information about the submodules URL into the checked
5965
+ * out submodule config, acting like "git submodule sync". This is useful
5966
+ * if you have altered the URL for the submodule (or it has been altered
5967
+ * by a fetch of upstream changes) and you need to update your local repo.
5968
+ *
5969
+ * @category Submodule/Methods
5970
+ * @signature
5971
+ * ```ts
5972
+ * class Submodule {
5973
+ * sync(signal?: AbortSignal | null | undefined): Promise<void>;
5974
+ * }
5975
+ * ```
5976
+ *
5977
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5978
+ */
5979
+ sync(signal?: AbortSignal | undefined | null): Promise<void>
5980
+ /**
5981
+ * Add current submodule HEAD commit to index of superproject.
5982
+ *
5983
+ * @category Submodule/Methods
5984
+ * @signature
5985
+ * ```ts
5986
+ * class Submodule {
5987
+ * addToIndex(writeIndex?: boolean | null | undefined): void;
5988
+ * }
5989
+ * ```
5990
+ *
5991
+ * @param {boolean} [writeIndex] - If is true, then the index file will be immediately written.
5992
+ * Otherwise, you must explicitly call `write()` on an `Index` later on.
5993
+ */
5994
+ addToIndex(writeIndex?: boolean | undefined | null): void
5995
+ /**
5996
+ * Resolve the setup of a new git submodule.
5997
+ *
5998
+ * This should be called on a submodule once you have called add setup and
5999
+ * done the clone of the submodule. This adds the `.gitmodules` file and the
6000
+ * newly cloned submodule to the index to be ready to be committed (but
6001
+ * doesn't actually do the commit).
6002
+ *
6003
+ * @category Submodule/Methods
6004
+ * @signature
6005
+ * ```ts
6006
+ * class Submodule {
6007
+ * addFinalize(): void;
6008
+ * }
6009
+ * ```
6010
+ */
6011
+ addFinalize(): void
6012
+ /**
6013
+ * Update submodule.
6014
+ *
6015
+ * This will clone a missing submodule and check out the subrepository to
6016
+ * the commit specified in the index of the containing repository. If
6017
+ * the submodule repository doesn't contain the target commit, then the
6018
+ * submodule is fetched using the fetch options supplied in options.
6019
+ *
6020
+ * @category Submodule/Methods
6021
+ * @signature
6022
+ * ```ts
6023
+ * class Submodule {
6024
+ * update(
6025
+ * init?: boolean | null | undefined,
6026
+ * options?: SubmoduleUpdateOptions | null | undefined,
6027
+ * signal?: AbortSignal | null | undefined,
6028
+ * ): Promise<void>;
6029
+ * }
6030
+ * ```
6031
+ *
6032
+ * @param {boolean} [init] - Indicates if the submodule should be initialized first if it has
6033
+ * not been initialized yet.
6034
+ * @param {SubmoduleUpdateOptions} [options] - Configuration options for the update.
6035
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
6036
+ */
6037
+ update(init?: boolean | undefined | null, options?: SubmoduleUpdateOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<void>
6038
+ /**
6039
+ * Perform the clone step for a newly created submodule.
6040
+ *
6041
+ * This performs the necessary `git clone` to setup a newly-created submodule.
6042
+ *
6043
+ * @category Submodule/Methods
6044
+ * @signature
6045
+ * ```ts
6046
+ * class Submodule {
6047
+ * clone(
6048
+ * options?: SubmoduleUpdateOptions | null | undefined,
6049
+ * signal?: AbortSignal | null | undefined,
6050
+ * ): Promise<Repository>;
6051
+ * }
6052
+ * ```
6053
+ *
6054
+ * @param {SubmoduleUpdateOptions} [options] - The options to use.
6055
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
6056
+ * @returns The newly created repository object.
6057
+ */
6058
+ clone(options?: SubmoduleUpdateOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Repository>
6059
+ }
6060
+
5324
6061
  /**
5325
6062
  * A class to represent a git [tag][1].
5326
6063
  *
@@ -8060,6 +8797,145 @@ export type StatusShow = 'Index'|
8060
8797
  'Workdir'|
8061
8798
  'IndexAndWorkdir';
8062
8799
 
8800
+ /**
8801
+ * Submodule ignore values
8802
+ *
8803
+ * These values represent settings for the `submodule.$name.ignore`
8804
+ * configuration value which says how deeply to look at the working
8805
+ * directory when getting the submodule status.
8806
+ */
8807
+ export type SubmoduleIgnore = /** Use the submodule's configuration */
8808
+ 'Unspecified'|
8809
+ /** Any change or untracked file is considered dirty */
8810
+ 'None'|
8811
+ /** Only dirty if tracked files have changed */
8812
+ 'Untracked'|
8813
+ /** Only dirty if HEAD has moved */
8814
+ 'Dirty'|
8815
+ /** Never dirty */
8816
+ 'All';
8817
+
8818
+ /**
8819
+ * Return codes for submodule status.
8820
+ *
8821
+ * A combination of these flags will be returned to describe the status of a
8822
+ * submodule. Depending on the "ignore" property of the submodule, some of
8823
+ * the flags may never be returned because they indicate changes that are
8824
+ * supposed to be ignored.
8825
+ *
8826
+ * Submodule info is contained in 4 places: the HEAD tree, the index, config
8827
+ * files (both .git/config and .gitmodules), and the working directory. Any
8828
+ * or all of those places might be missing information about the submodule
8829
+ * depending on what state the repo is in. We consider all four places to
8830
+ * build the combination of status flags.
8831
+ *
8832
+ * There are four values that are not really status, but give basic info
8833
+ * about what sources of submodule data are available. These will be
8834
+ * returned even if ignore is set to "ALL".
8835
+ *
8836
+ * * IN_HEAD - superproject head contains submodule
8837
+ * * IN_INDEX - superproject index contains submodule
8838
+ * * IN_CONFIG - superproject gitmodules has submodule
8839
+ * * IN_WD - superproject workdir has submodule
8840
+ *
8841
+ * The following values will be returned so long as ignore is not "ALL".
8842
+ *
8843
+ * * INDEX_ADDED - in index, not in head
8844
+ * * INDEX_DELETED - in head, not in index
8845
+ * * INDEX_MODIFIED - index and head don't match
8846
+ * * WD_UNINITIALIZED - workdir contains empty directory
8847
+ * * WD_ADDED - in workdir, not index
8848
+ * * WD_DELETED - in index, not workdir
8849
+ * * WD_MODIFIED - index and workdir head don't match
8850
+ *
8851
+ * The following can only be returned if ignore is "NONE" or "UNTRACKED".
8852
+ *
8853
+ * * WD_INDEX_MODIFIED - submodule workdir index is dirty
8854
+ * * WD_WD_MODIFIED - submodule workdir has modified files
8855
+ *
8856
+ * Lastly, the following will only be returned for ignore "NONE".
8857
+ *
8858
+ * * WD_UNTRACKED - workdir contains untracked files
8859
+ */
8860
+ export declare enum SubmoduleStatus {
8861
+ InHead = 1,
8862
+ InIndex = 2,
8863
+ InConfig = 4,
8864
+ InWD = 8,
8865
+ IndexAdded = 16,
8866
+ IndexDeleted = 32,
8867
+ IndexModified = 64,
8868
+ WDUninitialized = 128,
8869
+ WDAdded = 256,
8870
+ WDDeleted = 512,
8871
+ WDModified = 1024,
8872
+ WDIndexModified = 2048,
8873
+ WDWDModified = 4096,
8874
+ WDUntracked = 8192
8875
+ }
8876
+
8877
+ /**
8878
+ * Check submodule status contains given value.
8879
+ *
8880
+ * @category Submodule
8881
+ * @signature
8882
+ * ```ts
8883
+ * function submoduleStatusContains(source: number, target: number): boolean;
8884
+ * ```
8885
+ *
8886
+ * @param {number} source - Source status.
8887
+ * @param {number} target - Target status.
8888
+ * @returns Returns `true` is source status contains target status.
8889
+ */
8890
+ export declare function submoduleStatusContains(source: number, target: number): boolean
8891
+
8892
+ /**
8893
+ * Submodule update values
8894
+ *
8895
+ * These values represent settings for the `submodule.$name.update`
8896
+ * configuration value which says how to handle `git submodule update`
8897
+ * for this submodule. The value is usually set in the ".gitmodules"
8898
+ * file and copied to ".git/config" when the submodule is initialized.
8899
+ */
8900
+ export type SubmoduleUpdate = /**
8901
+ * The default; when a submodule is updated| checkout the new detached
8902
+ * HEAD to the submodule directory.
8903
+ */
8904
+ 'Checkout'|
8905
+ /**
8906
+ * Update by rebasing the current checked out branch onto the commit from
8907
+ * the superproject.
8908
+ */
8909
+ 'Rebase'|
8910
+ /**
8911
+ * Update by merging the commit in the superproject into the current
8912
+ * checkout out branch of the submodule.
8913
+ */
8914
+ 'Merge'|
8915
+ /**
8916
+ * Do not update this submodule even when the commit in the superproject
8917
+ * is updated.
8918
+ */
8919
+ 'None'|
8920
+ /**
8921
+ * Not used except as static initializer when we don't want any particular
8922
+ * update rule to be specified.
8923
+ */
8924
+ 'Default';
8925
+
8926
+ /** Options to update a submodule. */
8927
+ export interface SubmoduleUpdateOptions {
8928
+ /** These options are passed to the checkout step. */
8929
+ checkout?: CheckoutOptions
8930
+ /** Options which control the fetch, including callbacks. */
8931
+ fetch?: FetchOptions
8932
+ /**
8933
+ * Allow fetching from the submodule's default remote if the target commit isn't found.
8934
+ * Default: `true`.
8935
+ */
8936
+ allowFetch?: boolean
8937
+ }
8938
+
8063
8939
  /**
8064
8940
  * Clear the global subscriber
8065
8941
  *
package/index.js CHANGED
@@ -596,6 +596,9 @@ module.exports.Note = nativeBinding.Note
596
596
  module.exports.Notes = nativeBinding.Notes
597
597
  module.exports.Rebase = nativeBinding.Rebase
598
598
  module.exports.Reference = nativeBinding.Reference
599
+ module.exports.Reflog = nativeBinding.Reflog
600
+ module.exports.ReflogEntry = nativeBinding.ReflogEntry
601
+ module.exports.ReflogIter = nativeBinding.ReflogIter
599
602
  module.exports.Remote = nativeBinding.Remote
600
603
  module.exports.Repository = nativeBinding.Repository
601
604
  module.exports.Revwalk = nativeBinding.Revwalk
@@ -605,6 +608,7 @@ module.exports.StashListIter = nativeBinding.StashListIter
605
608
  module.exports.StatusEntry = nativeBinding.StatusEntry
606
609
  module.exports.Statuses = nativeBinding.Statuses
607
610
  module.exports.StatusesIter = nativeBinding.StatusesIter
611
+ module.exports.Submodule = nativeBinding.Submodule
608
612
  module.exports.Tag = nativeBinding.Tag
609
613
  module.exports.Tree = nativeBinding.Tree
610
614
  module.exports.TreeEntry = nativeBinding.TreeEntry
@@ -656,6 +660,10 @@ module.exports.RevparseMode = nativeBinding.RevparseMode
656
660
  module.exports.revparseModeContains = nativeBinding.revparseModeContains
657
661
  module.exports.RevwalkSort = nativeBinding.RevwalkSort
658
662
  module.exports.StatusShow = nativeBinding.StatusShow
663
+ module.exports.SubmoduleIgnore = nativeBinding.SubmoduleIgnore
664
+ module.exports.SubmoduleStatus = nativeBinding.SubmoduleStatus
665
+ module.exports.submoduleStatusContains = nativeBinding.submoduleStatusContains
666
+ module.exports.SubmoduleUpdate = nativeBinding.SubmoduleUpdate
659
667
  module.exports.traceClear = nativeBinding.traceClear
660
668
  module.exports.TraceLevel = nativeBinding.TraceLevel
661
669
  module.exports.traceSet = nativeBinding.traceSet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-git",
3
- "version": "0.5.0-next.170+131625d",
3
+ "version": "0.5.0-next.172+1b12e25",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -54,15 +54,15 @@
54
54
  "vitest": "^3.0.5"
55
55
  },
56
56
  "optionalDependencies": {
57
- "es-git-darwin-x64": "0.5.0-next.170+131625d",
58
- "es-git-darwin-arm64": "0.5.0-next.170+131625d",
59
- "es-git-win32-x64-msvc": "0.5.0-next.170+131625d",
60
- "es-git-win32-arm64-msvc": "0.5.0-next.170+131625d",
61
- "es-git-linux-x64-gnu": "0.5.0-next.170+131625d",
62
- "es-git-linux-x64-musl": "0.5.0-next.170+131625d",
63
- "es-git-android-arm64": "0.5.0-next.170+131625d",
64
- "es-git-linux-arm64-gnu": "0.5.0-next.170+131625d",
65
- "es-git-linux-arm64-musl": "0.5.0-next.170+131625d",
66
- "es-git-android-arm-eabi": "0.5.0-next.170+131625d"
57
+ "es-git-darwin-x64": "0.5.0-next.172+1b12e25",
58
+ "es-git-darwin-arm64": "0.5.0-next.172+1b12e25",
59
+ "es-git-win32-x64-msvc": "0.5.0-next.172+1b12e25",
60
+ "es-git-win32-arm64-msvc": "0.5.0-next.172+1b12e25",
61
+ "es-git-linux-x64-gnu": "0.5.0-next.172+1b12e25",
62
+ "es-git-linux-x64-musl": "0.5.0-next.172+1b12e25",
63
+ "es-git-android-arm64": "0.5.0-next.172+1b12e25",
64
+ "es-git-linux-arm64-gnu": "0.5.0-next.172+1b12e25",
65
+ "es-git-linux-arm64-musl": "0.5.0-next.172+1b12e25",
66
+ "es-git-android-arm-eabi": "0.5.0-next.172+1b12e25"
67
67
  }
68
68
  }