es-git 0.5.0-next.171 → 0.5.0-next.173

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 +651 -5
  2. package/index.js +5 -0
  3. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -2407,7 +2407,7 @@ export declare class Reflog {
2407
2407
  * ```
2408
2408
  *
2409
2409
  * @param {number} i - Index of the entry to remove.
2410
- * @param {boolean} [rewritePreviousEntry] - Whether to rewrite the previous entry. Defaults to 'false'.
2410
+ * @param {boolean} [rewritePreviousEntry] - Whether to rewrite the previous entry. Defaults to `false`.
2411
2411
  * @throws Throws error if the index is invalid or if removal fails.
2412
2412
  */
2413
2413
  remove(i: number, rewritePreviousEntry?: boolean | undefined | null): void
@@ -2470,6 +2470,7 @@ export declare class Reflog {
2470
2470
  * ```
2471
2471
  *
2472
2472
  * @returns Iterator over the reflog entries.
2473
+ * @throws Throws error if the reflog cannot be accessed.
2473
2474
  */
2474
2475
  iter(): ReflogIter
2475
2476
  /**
@@ -2544,7 +2545,7 @@ export declare class ReflogEntry {
2544
2545
  * @signature
2545
2546
  * ```ts
2546
2547
  * class ReflogEntry {
2547
- * message(): string | null;
2548
+ * message(): string;
2548
2549
  * }
2549
2550
  * ```
2550
2551
  *
@@ -2838,6 +2839,7 @@ export declare class Repository {
2838
2839
  * Apply a Diff to the given repo, making changes directly in the working directory, the index, or both.
2839
2840
  *
2840
2841
  * @category Repository/Methods
2842
+ * @signature
2841
2843
  * ```ts
2842
2844
  * class Repository {
2843
2845
  * apply(diff: Diff, location: ApplyLocation, options?: ApplyOptions | null | undefined): void;
@@ -2874,7 +2876,7 @@ export declare class Repository {
2874
2876
  /**
2875
2877
  * Get the value of a git attribute for a path.
2876
2878
  *
2877
- * @ository/Methods
2879
+ * @category Repository/Methods
2878
2880
  * @signature
2879
2881
  * ```ts
2880
2882
  * class Repository {
@@ -3098,7 +3100,7 @@ export declare class Repository {
3098
3100
  */
3099
3101
  cherrypick(commit: Commit, options?: CherrypickOptions | undefined | null): void
3100
3102
  /**
3101
- * Applies a cherrypick of `cherrypick_commit` against `our_commit` and returns the resulting Index,
3103
+ * Applies a cherrypick of `cherrypickCommit` against `ourCommit` and returns the resulting Index,
3102
3104
  * without modifying the working directory or repository state.
3103
3105
  * This method does not write any changes to disk or update HEAD.
3104
3106
  * it is useful for computing what the cherrypick result would look like without actually applying it.
@@ -4765,6 +4767,192 @@ export declare class Repository {
4765
4767
  * @returns A container for a list of status information about a repository.
4766
4768
  */
4767
4769
  statuses(): Statuses
4770
+ /**
4771
+ * Set up a new git submodule for checkout.
4772
+ *
4773
+ * This does "git submodule add" up to the fetch and checkout of the
4774
+ * submodule contents. It preps a new submodule, creates an entry in
4775
+ * `.gitmodules` and creates an empty initialized repository either at the
4776
+ * given path in the working directory or in `.git/modules` with a gitlink
4777
+ * from the working directory to the new repo.
4778
+ *
4779
+ * To fully emulate "git submodule add" call this function, then `open()`
4780
+ * the submodule repo and perform the clone step as needed. Lastly, call
4781
+ * `addFinalize()` to wrap up adding the new submodule and `.gitmodules`
4782
+ * to the index to be ready to commit.
4783
+ *
4784
+ * @category Repository/Methods
4785
+ * @signature
4786
+ * ```ts
4787
+ * class Repository {
4788
+ * submodule(
4789
+ * url: string,
4790
+ * path: string,
4791
+ * useGitlink?: boolean | null | undefined,
4792
+ * ): Submodule;
4793
+ * }
4794
+ * ```
4795
+ *
4796
+ * @param {string} url - URL for the submodule's remote.
4797
+ * @param {string} path - Path at which the submodule should be created.
4798
+ * @param {boolean} [useGitlink] - Should workdir contain a gitlink to the repo in
4799
+ * `.git/modules` vs. repo directly in workdir.
4800
+ *
4801
+ * @returns The submodule.
4802
+ */
4803
+ submodule(url: string, path: string, useGitlink?: boolean | undefined | null): Submodule
4804
+ /**
4805
+ * Load all submodules for this repository and return them.
4806
+ *
4807
+ * @category Repository/Methods
4808
+ * @signature
4809
+ * ```ts
4810
+ * class Submodule {
4811
+ * submodules(): Submodule[];
4812
+ * }
4813
+ * ```
4814
+ *
4815
+ * @returns for this repository.
4816
+ */
4817
+ submodules(): Array<Submodule>
4818
+ /**
4819
+ * Lookup submodule information by name or path.
4820
+ *
4821
+ * Given either the submodule name or path (they are usually the same),
4822
+ * this returns a structure describing the submodule.
4823
+ *
4824
+ * @category Repository/Methods
4825
+ * @signature
4826
+ * ```ts
4827
+ * class Repository {
4828
+ * getSubmodule(name: string): Submodule;
4829
+ * }
4830
+ * ```
4831
+ *
4832
+ * @param {string} name - The name of or path to the submodule; trailing slashes okay.
4833
+ * @returns The submodule.
4834
+ * @throws If the submodule not found.
4835
+ */
4836
+ getSubmodule(name: string): Submodule
4837
+ /**
4838
+ * Lookup submodule information by name or path.
4839
+ *
4840
+ * Given either the submodule name or path (they are usually the same),
4841
+ * this returns a structure describing the submodule.
4842
+ *
4843
+ * @category Repository/Methods
4844
+ * @signature
4845
+ * ```ts
4846
+ * class Repository {
4847
+ * findSubmodule(name: string): Submodule | null;
4848
+ * }
4849
+ * ```
4850
+ *
4851
+ * @param {string} name - The name of or path to the submodule; trailing slashes okay.
4852
+ * @returns The submodule. Returns `null` if the submodule is not found.
4853
+ */
4854
+ findSubmodule(name: string): Submodule | null
4855
+ /**
4856
+ * Get the status for a submodule.
4857
+ *
4858
+ * This looks at a submodule and tries to determine the status. It
4859
+ * will return a combination of the `SubmoduleStatus` values.
4860
+ *
4861
+ * @category Repository/Methods
4862
+ * @signature
4863
+ * ```ts
4864
+ * class Repository {
4865
+ * submoduleStatus(name: string, ignore: SubmoduleIgnore): number;
4866
+ * }
4867
+ * ```
4868
+ *
4869
+ * @param {string} name - The name of the submodule.
4870
+ * @param {SubmoduleIgnore} ignore - The ignore rules to follow.
4871
+ * @returns The combination of the `SubmoduleStatus` values.
4872
+ *
4873
+ * @example
4874
+ * ```ts
4875
+ * import { openRepository, submoduleStatusContains, SubmoduleStatus } from 'es-git';
4876
+ *
4877
+ * const repo = await openRepository('...');
4878
+ * const status = repo.submoduleStatus('mysubmodule', 'None');
4879
+ *
4880
+ * console.log(
4881
+ * submoduleStatusContains(status, SubmoduleStatus.InHead | SubmoduleStatus.InIndex)
4882
+ * ); // true
4883
+ * ```
4884
+ */
4885
+ submoduleStatus(name: string, ignore: SubmoduleIgnore): number
4886
+ /**
4887
+ * Set the ignore rule for the submodule in the configuration
4888
+ *
4889
+ * This does not affect any currently-loaded instances.
4890
+ *
4891
+ * @category Repository/Methods
4892
+ * @signature
4893
+ * ```ts
4894
+ * class Repository {
4895
+ * submoduleSetIgnore(name: string, ignore: SubmoduleIgnore): void;
4896
+ * }
4897
+ * ```
4898
+ *
4899
+ * @param {string} name - The name of the submodule.
4900
+ * @param {SubmoduleIgnore} ignore - The new value for the ignore rule.
4901
+ */
4902
+ submoduleSetIgnore(name: string, ignore: SubmoduleIgnore): void
4903
+ /**
4904
+ * Set the update rule for the submodule in the configuration
4905
+ *
4906
+ * This setting won't affect any existing instances.
4907
+ *
4908
+ * @category Repository/Methods
4909
+ * @signature
4910
+ * ```ts
4911
+ * class Repository {
4912
+ * submoduleSetUpdate(name: string, update: SubmoduleUpdate): void;
4913
+ * }
4914
+ * ```
4915
+ *
4916
+ * @param {string} name - The name of the submodule.
4917
+ * @param {SubmoduleUpdate} update - The new value to use.
4918
+ */
4919
+ submoduleSetUpdate(name: string, update: SubmoduleUpdate): void
4920
+ /**
4921
+ * Set the URL for the submodule in the configuration
4922
+ *
4923
+ * After calling this, you may wish to call `Submodule#sync()` to write
4924
+ * the changes to the checked out submodule repository.
4925
+ *
4926
+ * @category Repository/Methods
4927
+ * @signature
4928
+ * ```ts
4929
+ * class Repository {
4930
+ * submoduleSetUrl(name: string, url: string): void;
4931
+ * }
4932
+ * ```
4933
+ *
4934
+ * @param {string} name - The name of the submodule to configure.
4935
+ * @param {string} url - URL that should be used for the submodule.
4936
+ */
4937
+ submoduleSetUrl(name: string, url: string): void
4938
+ /**
4939
+ * Set the branch for the submodule in the configuration
4940
+ *
4941
+ * After calling this, you may wish to call `Submodule#sync()` to write
4942
+ * the changes to the checked out submodule repository.
4943
+ *
4944
+ * @category Repository/Methods
4945
+ * @signature
4946
+ * ```ts
4947
+ * class Repository {
4948
+ * submoduleSetBranch(name: string, branchName: string): void;
4949
+ * }
4950
+ * ```
4951
+ *
4952
+ * @param {string} name - The name of the submodule to configure.
4953
+ * @param {string} branchName - Branch that should be used for the submodule
4954
+ */
4955
+ submoduleSetBranch(name: string, branchName: string): void
4768
4956
  /**
4769
4957
  * Lookup a tag object by prefix hash from the repository.
4770
4958
  *
@@ -5565,6 +5753,325 @@ export declare class StatusesIter extends Iterator<StatusEntry, void, void> {
5565
5753
  next(value?: void): IteratorResult<StatusEntry, void>
5566
5754
  }
5567
5755
 
5756
+ export declare class Submodule {
5757
+ /**
5758
+ * Get the name for the submodule.
5759
+ *
5760
+ * @category Submodule/Methods
5761
+ * @signature
5762
+ * ```ts
5763
+ * class Submodule {
5764
+ * name(): string;
5765
+ * }
5766
+ * ```
5767
+ */
5768
+ name(): string
5769
+ /**
5770
+ * Get the submodule's branch.
5771
+ * ule/Methods
5772
+ * @signature
5773
+ * ```ts
5774
+ * class Submodule {
5775
+ * branch(): string | null;
5776
+ * }
5777
+ * ```
5778
+ * @returns The branch name of the submodule. Returns `null` if the branch if the branch is
5779
+ * not yet available.
5780
+ */
5781
+ branch(): string | null
5782
+ /**
5783
+ * Get the submodule's URL.
5784
+ *
5785
+ * @category Submodule/Methods
5786
+ * @signature
5787
+ * ```ts
5788
+ * class Submodule {
5789
+ * url(): string | null;
5790
+ * }
5791
+ * ```
5792
+ *
5793
+ * @returns The URL of the submodule. Returns `null` if the URL isn't present.
5794
+ */
5795
+ url(): string | null
5796
+ /**
5797
+ * Get the path for the submodule.
5798
+ *
5799
+ * @category Submodule/Methods
5800
+ * @signature
5801
+ * ```ts
5802
+ * class Submodule {
5803
+ * path(): string;
5804
+ * }
5805
+ * ```
5806
+ *
5807
+ * @returns The path for the submodule.
5808
+ */
5809
+ path(): string
5810
+ /**
5811
+ * Get the OID for the submodule in the current `HEAD` tree.
5812
+ *
5813
+ * @category Submodule/Methods
5814
+ * @signature
5815
+ * ```ts
5816
+ * class Submodule {
5817
+ * headId(): string | null;
5818
+ * }
5819
+ * ```
5820
+ *
5821
+ * @returns The OID for the submodule in the current `HEAD` tree.
5822
+ */
5823
+ headId(): string | null
5824
+ /**
5825
+ * Get the OID for the submodule in the index.
5826
+ *
5827
+ * @category Submodule/Methods
5828
+ * @signature
5829
+ * ```ts
5830
+ * class Submodule {
5831
+ * indexId(): string | null;
5832
+ * }
5833
+ * ```
5834
+ *
5835
+ * @returns The OID for the submodule in the index.
5836
+ */
5837
+ indexId(): string | null
5838
+ /**
5839
+ * Get the OID for the submodule in the current working directory.
5840
+ *
5841
+ * This returns the OID that corresponds to looking up `HEAD` in the
5842
+ * checked out submodule. If there are pending changes in the index or
5843
+ * anything else, this won't notice that.
5844
+ *
5845
+ * @category Submodule/Methods
5846
+ * @signature
5847
+ * ```ts
5848
+ * class Submodule {
5849
+ * workdirId(): string | null;
5850
+ * }
5851
+ * ```
5852
+ *
5853
+ * @returns The OID for the submodule in the current working directory.
5854
+ */
5855
+ workdirId(): string | null
5856
+ /**
5857
+ * Get the ignore rule that will be used for the submodule.
5858
+ *
5859
+ * @category Submodule/Methods
5860
+ * @signature
5861
+ * ```ts
5862
+ * class Submodule {
5863
+ * ignoreRule(): SubmoduleIgnore;
5864
+ * }
5865
+ * ```
5866
+ *
5867
+ * @returns The ignore rule that will be used for the submodule.
5868
+ */
5869
+ ignoreRule(): SubmoduleIgnore
5870
+ /**
5871
+ * Get the update rule that will be used for the submodule.
5872
+ *
5873
+ * @category Submodule/Methods
5874
+ * @signature
5875
+ * ```ts
5876
+ * class Submodule {
5877
+ * updateStrategy(): SubmoduleUpdate;
5878
+ * }
5879
+ * ```
5880
+ *
5881
+ * @returns The update rule that will be used for the submodule.
5882
+ */
5883
+ updateStrategy(): SubmoduleUpdate
5884
+ /**
5885
+ * Copy submodule info into ".git/config" file.
5886
+ *
5887
+ * Just like "git submodule init", this copies information about the
5888
+ * submodule into ".git/config". You can use the accessor functions above
5889
+ * to alter the in-memory git_submodule object and control what is written
5890
+ * to the config, overriding what is in .gitmodules.
5891
+ *
5892
+ * By default, existing entries will not be overwritten, but passing `true`
5893
+ * for `overwrite` forces them to be updated.
5894
+ *
5895
+ * @category Submodule/Methods
5896
+ * @signature
5897
+ * ```ts
5898
+ * class Submodule {
5899
+ * init(
5900
+ * overwrite?: boolean | null | undefined,
5901
+ * signal?: AbortSignal | null | undefined,
5902
+ * ): Promise<void>;
5903
+ * }
5904
+ * ```
5905
+ *
5906
+ * @param {boolean} [overwrite] - By default, existing entries will not be overwritten, but
5907
+ * setting this to true forces them to be updated.
5908
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5909
+ */
5910
+ init(overwrite?: boolean | undefined | null, signal?: AbortSignal | undefined | null): Promise<void>
5911
+ /**
5912
+ * Set up the subrepository for a submodule in preparation for clone.
5913
+ *
5914
+ * This function can be called to init and set up a submodule repository
5915
+ * from a submodule in preparation to clone it from its remote.
5916
+ *
5917
+ * @category Submodule/Methods
5918
+ * @signature
5919
+ * ```ts
5920
+ * class Submodule {
5921
+ * repoInit(
5922
+ * useGitlink?: boolean | null | undefined,
5923
+ * signal?: AbortSignal | null | undefined,
5924
+ * ): Promise<Repository>;
5925
+ * }
5926
+ * ```
5927
+ *
5928
+ * @param {boolean} [useGitlink] - Should the workdir contain a gitlink to the repo in
5929
+ * `.git/modules` vs. repo directly in workdir.
5930
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5931
+ *
5932
+ * @returns The repository.
5933
+ */
5934
+ repoInit(useGitlink?: boolean | undefined | null, signal?: AbortSignal | undefined | null): Promise<Repository>
5935
+ /**
5936
+ * Open the repository for a submodule.
5937
+ *
5938
+ * This will only work if the submodule is checked out into the working
5939
+ * directory.
5940
+ *
5941
+ * @category Submodule/Methods
5942
+ * @signature
5943
+ * ```ts
5944
+ * class Submodule {
5945
+ * open(signal?: AbortSignal | null | undefined): Promise<Repository>;
5946
+ * }
5947
+ * ```
5948
+ *
5949
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5950
+ * @returns The repository.
5951
+ */
5952
+ open(signal?: AbortSignal | undefined | null): Promise<Repository>
5953
+ /**
5954
+ * Reread submodule info from config, index, and `HEAD`.
5955
+ *
5956
+ * Call this to reread cached submodule information for this submodule if
5957
+ * you have reason to believe that it has changed.
5958
+ *
5959
+ * @category Submodule/Methods
5960
+ * @signature
5961
+ * ```ts
5962
+ * class Submodule {
5963
+ * reload(
5964
+ * force?: boolean | null | undefined,
5965
+ * signal?: AbortSignal | null | undefined,
5966
+ * ): Promise<void>;
5967
+ * }
5968
+ * ```
5969
+ *
5970
+ * @param {boolean} [force] - If this is `true`, then data will be reloaded even if it
5971
+ * doesn't seem out of date.
5972
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5973
+ */
5974
+ reload(force?: boolean | undefined | null, signal?: AbortSignal | undefined | null): Promise<void>
5975
+ /**
5976
+ * Copy submodule remote info into submodule repo.
5977
+ *
5978
+ * This copies the information about the submodules URL into the checked
5979
+ * out submodule config, acting like "git submodule sync". This is useful
5980
+ * if you have altered the URL for the submodule (or it has been altered
5981
+ * by a fetch of upstream changes) and you need to update your local repo.
5982
+ *
5983
+ * @category Submodule/Methods
5984
+ * @signature
5985
+ * ```ts
5986
+ * class Submodule {
5987
+ * sync(signal?: AbortSignal | null | undefined): Promise<void>;
5988
+ * }
5989
+ * ```
5990
+ *
5991
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
5992
+ */
5993
+ sync(signal?: AbortSignal | undefined | null): Promise<void>
5994
+ /**
5995
+ * Add current submodule HEAD commit to index of superproject.
5996
+ *
5997
+ * @category Submodule/Methods
5998
+ * @signature
5999
+ * ```ts
6000
+ * class Submodule {
6001
+ * addToIndex(writeIndex?: boolean | null | undefined): void;
6002
+ * }
6003
+ * ```
6004
+ *
6005
+ * @param {boolean} [writeIndex] - If is true, then the index file will be immediately written.
6006
+ * Otherwise, you must explicitly call `write()` on an `Index` later on.
6007
+ */
6008
+ addToIndex(writeIndex?: boolean | undefined | null): void
6009
+ /**
6010
+ * Resolve the setup of a new git submodule.
6011
+ *
6012
+ * This should be called on a submodule once you have called add setup and
6013
+ * done the clone of the submodule. This adds the `.gitmodules` file and the
6014
+ * newly cloned submodule to the index to be ready to be committed (but
6015
+ * doesn't actually do the commit).
6016
+ *
6017
+ * @category Submodule/Methods
6018
+ * @signature
6019
+ * ```ts
6020
+ * class Submodule {
6021
+ * addFinalize(): void;
6022
+ * }
6023
+ * ```
6024
+ */
6025
+ addFinalize(): void
6026
+ /**
6027
+ * Update submodule.
6028
+ *
6029
+ * This will clone a missing submodule and check out the subrepository to
6030
+ * the commit specified in the index of the containing repository. If
6031
+ * the submodule repository doesn't contain the target commit, then the
6032
+ * submodule is fetched using the fetch options supplied in options.
6033
+ *
6034
+ * @category Submodule/Methods
6035
+ * @signature
6036
+ * ```ts
6037
+ * class Submodule {
6038
+ * update(
6039
+ * init?: boolean | null | undefined,
6040
+ * options?: SubmoduleUpdateOptions | null | undefined,
6041
+ * signal?: AbortSignal | null | undefined,
6042
+ * ): Promise<void>;
6043
+ * }
6044
+ * ```
6045
+ *
6046
+ * @param {boolean} [init] - Indicates if the submodule should be initialized first if it has
6047
+ * not been initialized yet.
6048
+ * @param {SubmoduleUpdateOptions} [options] - Configuration options for the update.
6049
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
6050
+ */
6051
+ update(init?: boolean | undefined | null, options?: SubmoduleUpdateOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<void>
6052
+ /**
6053
+ * Perform the clone step for a newly created submodule.
6054
+ *
6055
+ * This performs the necessary `git clone` to setup a newly-created submodule.
6056
+ *
6057
+ * @category Submodule/Methods
6058
+ * @signature
6059
+ * ```ts
6060
+ * class Submodule {
6061
+ * clone(
6062
+ * options?: SubmoduleUpdateOptions | null | undefined,
6063
+ * signal?: AbortSignal | null | undefined,
6064
+ * ): Promise<Repository>;
6065
+ * }
6066
+ * ```
6067
+ *
6068
+ * @param {SubmoduleUpdateOptions} [options] - The options to use.
6069
+ * @param {AbortSignal} [signal] - Optional AbortSignal to cancel the operation.
6070
+ * @returns The newly created repository object.
6071
+ */
6072
+ clone(options?: SubmoduleUpdateOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Repository>
6073
+ }
6074
+
5568
6075
  /**
5569
6076
  * A class to represent a git [tag][1].
5570
6077
  *
@@ -8304,6 +8811,145 @@ export type StatusShow = 'Index'|
8304
8811
  'Workdir'|
8305
8812
  'IndexAndWorkdir';
8306
8813
 
8814
+ /**
8815
+ * Submodule ignore values
8816
+ *
8817
+ * These values represent settings for the `submodule.$name.ignore`
8818
+ * configuration value which says how deeply to look at the working
8819
+ * directory when getting the submodule status.
8820
+ */
8821
+ export type SubmoduleIgnore = /** Use the submodule's configuration */
8822
+ 'Unspecified'|
8823
+ /** Any change or untracked file is considered dirty */
8824
+ 'None'|
8825
+ /** Only dirty if tracked files have changed */
8826
+ 'Untracked'|
8827
+ /** Only dirty if HEAD has moved */
8828
+ 'Dirty'|
8829
+ /** Never dirty */
8830
+ 'All';
8831
+
8832
+ /**
8833
+ * Return codes for submodule status.
8834
+ *
8835
+ * A combination of these flags will be returned to describe the status of a
8836
+ * submodule. Depending on the "ignore" property of the submodule, some of
8837
+ * the flags may never be returned because they indicate changes that are
8838
+ * supposed to be ignored.
8839
+ *
8840
+ * Submodule info is contained in 4 places: the HEAD tree, the index, config
8841
+ * files (both .git/config and .gitmodules), and the working directory. Any
8842
+ * or all of those places might be missing information about the submodule
8843
+ * depending on what state the repo is in. We consider all four places to
8844
+ * build the combination of status flags.
8845
+ *
8846
+ * There are four values that are not really status, but give basic info
8847
+ * about what sources of submodule data are available. These will be
8848
+ * returned even if ignore is set to "ALL".
8849
+ *
8850
+ * * IN_HEAD - superproject head contains submodule
8851
+ * * IN_INDEX - superproject index contains submodule
8852
+ * * IN_CONFIG - superproject gitmodules has submodule
8853
+ * * IN_WD - superproject workdir has submodule
8854
+ *
8855
+ * The following values will be returned so long as ignore is not "ALL".
8856
+ *
8857
+ * * INDEX_ADDED - in index, not in head
8858
+ * * INDEX_DELETED - in head, not in index
8859
+ * * INDEX_MODIFIED - index and head don't match
8860
+ * * WD_UNINITIALIZED - workdir contains empty directory
8861
+ * * WD_ADDED - in workdir, not index
8862
+ * * WD_DELETED - in index, not workdir
8863
+ * * WD_MODIFIED - index and workdir head don't match
8864
+ *
8865
+ * The following can only be returned if ignore is "NONE" or "UNTRACKED".
8866
+ *
8867
+ * * WD_INDEX_MODIFIED - submodule workdir index is dirty
8868
+ * * WD_WD_MODIFIED - submodule workdir has modified files
8869
+ *
8870
+ * Lastly, the following will only be returned for ignore "NONE".
8871
+ *
8872
+ * * WD_UNTRACKED - workdir contains untracked files
8873
+ */
8874
+ export declare enum SubmoduleStatus {
8875
+ InHead = 1,
8876
+ InIndex = 2,
8877
+ InConfig = 4,
8878
+ InWD = 8,
8879
+ IndexAdded = 16,
8880
+ IndexDeleted = 32,
8881
+ IndexModified = 64,
8882
+ WDUninitialized = 128,
8883
+ WDAdded = 256,
8884
+ WDDeleted = 512,
8885
+ WDModified = 1024,
8886
+ WDIndexModified = 2048,
8887
+ WDWDModified = 4096,
8888
+ WDUntracked = 8192
8889
+ }
8890
+
8891
+ /**
8892
+ * Check submodule status contains given value.
8893
+ *
8894
+ * @category Submodule
8895
+ * @signature
8896
+ * ```ts
8897
+ * function submoduleStatusContains(source: number, target: number): boolean;
8898
+ * ```
8899
+ *
8900
+ * @param {number} source - Source status.
8901
+ * @param {number} target - Target status.
8902
+ * @returns Returns `true` is source status contains target status.
8903
+ */
8904
+ export declare function submoduleStatusContains(source: number, target: number): boolean
8905
+
8906
+ /**
8907
+ * Submodule update values
8908
+ *
8909
+ * These values represent settings for the `submodule.$name.update`
8910
+ * configuration value which says how to handle `git submodule update`
8911
+ * for this submodule. The value is usually set in the ".gitmodules"
8912
+ * file and copied to ".git/config" when the submodule is initialized.
8913
+ */
8914
+ export type SubmoduleUpdate = /**
8915
+ * The default; when a submodule is updated| checkout the new detached
8916
+ * HEAD to the submodule directory.
8917
+ */
8918
+ 'Checkout'|
8919
+ /**
8920
+ * Update by rebasing the current checked out branch onto the commit from
8921
+ * the superproject.
8922
+ */
8923
+ 'Rebase'|
8924
+ /**
8925
+ * Update by merging the commit in the superproject into the current
8926
+ * checkout out branch of the submodule.
8927
+ */
8928
+ 'Merge'|
8929
+ /**
8930
+ * Do not update this submodule even when the commit in the superproject
8931
+ * is updated.
8932
+ */
8933
+ 'None'|
8934
+ /**
8935
+ * Not used except as static initializer when we don't want any particular
8936
+ * update rule to be specified.
8937
+ */
8938
+ 'Default';
8939
+
8940
+ /** Options to update a submodule. */
8941
+ export interface SubmoduleUpdateOptions {
8942
+ /** These options are passed to the checkout step. */
8943
+ checkout?: CheckoutOptions
8944
+ /** Options which control the fetch, including callbacks. */
8945
+ fetch?: FetchOptions
8946
+ /**
8947
+ * Allow fetching from the submodule's default remote if the target commit isn't found.
8948
+ * Default: `true`.
8949
+ */
8950
+ allowFetch?: boolean
8951
+ }
8952
+
8307
8953
  /**
8308
8954
  * Clear the global subscriber
8309
8955
  *
@@ -8316,7 +8962,7 @@ export type StatusShow = 'Index'|
8316
8962
  export declare function traceClear(): void
8317
8963
 
8318
8964
  /**
8319
- * Available tracing levels. When tracing is set to a particular level,
8965
+ * Available tracing levels. When tracing is set to a particular level,
8320
8966
  * callers will be provided tracing at the given level and all lower levels.
8321
8967
  */
8322
8968
  export type TraceLevel = 'None'|
package/index.js CHANGED
@@ -608,6 +608,7 @@ module.exports.StashListIter = nativeBinding.StashListIter
608
608
  module.exports.StatusEntry = nativeBinding.StatusEntry
609
609
  module.exports.Statuses = nativeBinding.Statuses
610
610
  module.exports.StatusesIter = nativeBinding.StatusesIter
611
+ module.exports.Submodule = nativeBinding.Submodule
611
612
  module.exports.Tag = nativeBinding.Tag
612
613
  module.exports.Tree = nativeBinding.Tree
613
614
  module.exports.TreeEntry = nativeBinding.TreeEntry
@@ -659,6 +660,10 @@ module.exports.RevparseMode = nativeBinding.RevparseMode
659
660
  module.exports.revparseModeContains = nativeBinding.revparseModeContains
660
661
  module.exports.RevwalkSort = nativeBinding.RevwalkSort
661
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
662
667
  module.exports.traceClear = nativeBinding.traceClear
663
668
  module.exports.TraceLevel = nativeBinding.TraceLevel
664
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.171+f871f1e",
3
+ "version": "0.5.0-next.173+b2dfe8d",
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.171+f871f1e",
58
- "es-git-darwin-arm64": "0.5.0-next.171+f871f1e",
59
- "es-git-win32-x64-msvc": "0.5.0-next.171+f871f1e",
60
- "es-git-win32-arm64-msvc": "0.5.0-next.171+f871f1e",
61
- "es-git-linux-x64-gnu": "0.5.0-next.171+f871f1e",
62
- "es-git-linux-x64-musl": "0.5.0-next.171+f871f1e",
63
- "es-git-android-arm64": "0.5.0-next.171+f871f1e",
64
- "es-git-linux-arm64-gnu": "0.5.0-next.171+f871f1e",
65
- "es-git-linux-arm64-musl": "0.5.0-next.171+f871f1e",
66
- "es-git-android-arm-eabi": "0.5.0-next.171+f871f1e"
57
+ "es-git-darwin-x64": "0.5.0-next.173+b2dfe8d",
58
+ "es-git-darwin-arm64": "0.5.0-next.173+b2dfe8d",
59
+ "es-git-win32-x64-msvc": "0.5.0-next.173+b2dfe8d",
60
+ "es-git-win32-arm64-msvc": "0.5.0-next.173+b2dfe8d",
61
+ "es-git-linux-x64-gnu": "0.5.0-next.173+b2dfe8d",
62
+ "es-git-linux-x64-musl": "0.5.0-next.173+b2dfe8d",
63
+ "es-git-android-arm64": "0.5.0-next.173+b2dfe8d",
64
+ "es-git-linux-arm64-gnu": "0.5.0-next.173+b2dfe8d",
65
+ "es-git-linux-arm64-musl": "0.5.0-next.173+b2dfe8d",
66
+ "es-git-android-arm-eabi": "0.5.0-next.173+b2dfe8d"
67
67
  }
68
68
  }