es-git 0.4.0 → 0.5.0-next.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +885 -3
- package/index.js +6 -1
- package/package.json +12 -12
package/index.d.ts
CHANGED
|
@@ -1029,6 +1029,93 @@ export declare function hashObjectOid(objType: ObjectType, bytes: Buffer): strin
|
|
|
1029
1029
|
* @returns Hashed string.
|
|
1030
1030
|
*/
|
|
1031
1031
|
export declare function hashFileOid(objType: ObjectType, path: string): string
|
|
1032
|
+
export interface RebaseCommitOptions {
|
|
1033
|
+
/**
|
|
1034
|
+
* Signature for author.
|
|
1035
|
+
* To keep the author from the original commit leave this as empty.
|
|
1036
|
+
*/
|
|
1037
|
+
author?: SignaturePayload
|
|
1038
|
+
/** Signature for commiter. */
|
|
1039
|
+
committer: SignaturePayload
|
|
1040
|
+
/** To keep the message from the original commit leave this as empty. */
|
|
1041
|
+
message?: string
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* A rebase operation
|
|
1045
|
+
*
|
|
1046
|
+
* Describes a single instruction/operation to be performed during the
|
|
1047
|
+
* rebase.
|
|
1048
|
+
*/
|
|
1049
|
+
export interface RebaseOperation {
|
|
1050
|
+
/** The type of rebase operation */
|
|
1051
|
+
type?: RebaseOperationType
|
|
1052
|
+
/**
|
|
1053
|
+
* The commit ID being cherry-picked. This will be populated for all
|
|
1054
|
+
* operations except those of type `GIT_REBASE_OPERATION_EXEC`.
|
|
1055
|
+
*/
|
|
1056
|
+
id: string
|
|
1057
|
+
/**
|
|
1058
|
+
*The executable the user has requested be run. This will only
|
|
1059
|
+
* be populated for operations of type `Exec`.
|
|
1060
|
+
*/
|
|
1061
|
+
exec?: string
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* A rebase operation.
|
|
1065
|
+
* Describes a single instruction/operation to be performed during the
|
|
1066
|
+
* rebase.
|
|
1067
|
+
*
|
|
1068
|
+
* - `Pick` : The given commit is to be cherry-picked. The client should commit the
|
|
1069
|
+
* changes and continue if there are no conflicts.
|
|
1070
|
+
* - `Reword` : The given commit is to be cherry-picked, but the client should prompt
|
|
1071
|
+
* the user to provide an updated commit message.
|
|
1072
|
+
* - `Edit` : The given commit is to be cherry-picked, but the client should stop to
|
|
1073
|
+
* allow the user to edit the changes before committing them.
|
|
1074
|
+
* - `Squash` : The given commit is to be squashed into the previous commit. The commit
|
|
1075
|
+
* message will be merged with the previous message.
|
|
1076
|
+
* - `Fixup` : The given commit is to be squashed into the previous commit. The commit
|
|
1077
|
+
* message from this commit will be discarded.
|
|
1078
|
+
* - `Exec` : No commit will be cherry-picked. The client should run the given command
|
|
1079
|
+
* and (if successful) continue.
|
|
1080
|
+
*/
|
|
1081
|
+
export type RebaseOperationType = 'Pick' | 'Reword' | 'Edit' | 'Squash' | 'Fixup' | 'Exec';
|
|
1082
|
+
export interface RebaseOptions {
|
|
1083
|
+
/**
|
|
1084
|
+
* This will instruct other clients working on this
|
|
1085
|
+
* rebase that you want a quiet rebase experience, which they may choose to
|
|
1086
|
+
* provide in an application-specific manner. This has no effect upon
|
|
1087
|
+
* libgit2 directly, but is provided for interoperability between Git
|
|
1088
|
+
* tools.
|
|
1089
|
+
*/
|
|
1090
|
+
quiet?: boolean
|
|
1091
|
+
/**
|
|
1092
|
+
* This will begin an in-memory rebase,
|
|
1093
|
+
* which will allow callers to step through the rebase operations and
|
|
1094
|
+
* commit the rebased changes, but will not rewind HEAD or update the
|
|
1095
|
+
* repository to be in a rebasing state. This will not interfere with
|
|
1096
|
+
* the working directory (if there is one).
|
|
1097
|
+
*/
|
|
1098
|
+
inmemory?: boolean
|
|
1099
|
+
/**
|
|
1100
|
+
* Used by `finish()`, this is the name of the notes reference
|
|
1101
|
+
* used to rewrite notes for rebased commits when finishing the rebase;
|
|
1102
|
+
* if NULL, the contents of the configuration option `notes.rewriteRef`
|
|
1103
|
+
* is examined, unless the configuration option `notes.rewrite.rebase`
|
|
1104
|
+
* is set to false.
|
|
1105
|
+
* If `notes.rewriteRef` is also NULL, notes will not be rewritten.
|
|
1106
|
+
*/
|
|
1107
|
+
rewriteNotesRef?: string
|
|
1108
|
+
/** Options to control how trees are merged during `next()`. */
|
|
1109
|
+
mergeOptions?: MergeOptions
|
|
1110
|
+
/**
|
|
1111
|
+
* Options to control how files are written during `Repository::rebase`,
|
|
1112
|
+
* `next()` and `abort()`. Note that a minimum strategy of
|
|
1113
|
+
* `GIT_CHECKOUT_SAFE` is defaulted in `init` and `next`, and a minimum
|
|
1114
|
+
* strategy of `GIT_CHECKOUT_FORCE` is defaulted in `abort` to match git
|
|
1115
|
+
* semantics.
|
|
1116
|
+
*/
|
|
1117
|
+
checkoutOptions?: CheckoutOptions
|
|
1118
|
+
}
|
|
1032
1119
|
/**
|
|
1033
1120
|
* - `Direct` : A reference which points at an object id.
|
|
1034
1121
|
* - `Symbolic` : A reference which points at another reference.
|
|
@@ -1624,6 +1711,45 @@ export declare function discoverRepository(path: string, signal?: AbortSignal |
|
|
|
1624
1711
|
* ```
|
|
1625
1712
|
*/
|
|
1626
1713
|
export declare function cloneRepository(url: string, path: string, options?: RepositoryCloneOptions | undefined | null, signal?: AbortSignal | undefined | null): Promise<Repository>
|
|
1714
|
+
/**
|
|
1715
|
+
* Options for revert behavior.
|
|
1716
|
+
*
|
|
1717
|
+
* Controls how a revert is performed when applying the inverse of a commit.
|
|
1718
|
+
*
|
|
1719
|
+
* @example
|
|
1720
|
+
* ```ts
|
|
1721
|
+
* import { openRepository } from 'es-git';
|
|
1722
|
+
*
|
|
1723
|
+
* const repo = await openRepository('./path/to/repo');
|
|
1724
|
+
* const head = repo.head().target()!;
|
|
1725
|
+
* const commit = repo.getCommit(head);
|
|
1726
|
+
*
|
|
1727
|
+
* // Simple revert
|
|
1728
|
+
* repo.revert(commit);
|
|
1729
|
+
* repo.cleanupState();
|
|
1730
|
+
*
|
|
1731
|
+
* // Revert a merge commit selecting the first parent as mainline
|
|
1732
|
+
* repo.revert(commit, { mainline: 1 });
|
|
1733
|
+
* repo.cleanupState();
|
|
1734
|
+
*
|
|
1735
|
+
* // Prevent working tree changes (dry run) but compute conflicts
|
|
1736
|
+
* repo.revert(commit, { checkoutOptions: { dryRun: true } });
|
|
1737
|
+
* repo.cleanupState();
|
|
1738
|
+
* ```
|
|
1739
|
+
*/
|
|
1740
|
+
export interface RevertOptions {
|
|
1741
|
+
/**
|
|
1742
|
+
* Parent number for merge commits (1-based).
|
|
1743
|
+
*
|
|
1744
|
+
* When reverting a merge commit, the mainline parent is the one you want to
|
|
1745
|
+
* revert to. The mainline is the branch into which the merge was made.
|
|
1746
|
+
*/
|
|
1747
|
+
mainline?: number
|
|
1748
|
+
/** Options for merge conflict resolution. */
|
|
1749
|
+
mergeOptions?: MergeOptions
|
|
1750
|
+
/** Options for checkout behavior when updating working directory. */
|
|
1751
|
+
checkoutOptions?: CheckoutOptions
|
|
1752
|
+
}
|
|
1627
1753
|
/**
|
|
1628
1754
|
* Flags for the revparse.
|
|
1629
1755
|
* - `Single` : The spec targeted a single object.
|
|
@@ -1730,6 +1856,84 @@ export interface SignaturePayload {
|
|
|
1730
1856
|
email: string
|
|
1731
1857
|
timeOptions?: SignatureTimeOptions
|
|
1732
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Options for saving a stash.
|
|
1861
|
+
*
|
|
1862
|
+
* All fields are optional. If not provided, sensible defaults will be used.
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```ts
|
|
1866
|
+
* import { openRepository } from 'es-git';
|
|
1867
|
+
*
|
|
1868
|
+
* const repo = await openRepository('./path/to/repo');
|
|
1869
|
+
*
|
|
1870
|
+
* // Basic usage
|
|
1871
|
+
* repo.stashSave({
|
|
1872
|
+
* stasher: { name: 'Seokju Na', email: 'seokju.me@toss.im' }
|
|
1873
|
+
* });
|
|
1874
|
+
*
|
|
1875
|
+
* // With options
|
|
1876
|
+
* repo.stashSave({
|
|
1877
|
+
* stasher: { name: 'Seokju Na', email: 'seokju.me@toss.im' },
|
|
1878
|
+
* message: 'WIP: feature implementation',
|
|
1879
|
+
* includeUntracked: true
|
|
1880
|
+
* });
|
|
1881
|
+
* ```
|
|
1882
|
+
*/
|
|
1883
|
+
export interface StashSaveOptions {
|
|
1884
|
+
/**
|
|
1885
|
+
* The identity of the person performing the stashing.
|
|
1886
|
+
* If not provided, uses the repository's default signature.
|
|
1887
|
+
*/
|
|
1888
|
+
stasher?: SignaturePayload
|
|
1889
|
+
/**
|
|
1890
|
+
* Description along with the stashed state.
|
|
1891
|
+
* If not provided, a default message will be generated.
|
|
1892
|
+
*/
|
|
1893
|
+
message?: string
|
|
1894
|
+
/**
|
|
1895
|
+
* Whether to stash untracked files.
|
|
1896
|
+
* Default: false
|
|
1897
|
+
*/
|
|
1898
|
+
includeUntracked?: boolean
|
|
1899
|
+
/**
|
|
1900
|
+
* Whether to stash ignored files.
|
|
1901
|
+
* Default: false
|
|
1902
|
+
*/
|
|
1903
|
+
includeIgnored?: boolean
|
|
1904
|
+
/**
|
|
1905
|
+
* Whether to retain the index after stashing.
|
|
1906
|
+
* If true, staged changes remain in the index after stashing.
|
|
1907
|
+
* Default: false
|
|
1908
|
+
*/
|
|
1909
|
+
keepIndex?: boolean
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Options for applying a stash.
|
|
1913
|
+
*
|
|
1914
|
+
* Controls how a stash is applied to the working directory.
|
|
1915
|
+
*
|
|
1916
|
+
* @example
|
|
1917
|
+
* ```ts
|
|
1918
|
+
* import { openRepository } from 'es-git';
|
|
1919
|
+
*
|
|
1920
|
+
* const repo = await openRepository('./path/to/repo');
|
|
1921
|
+
*
|
|
1922
|
+
* // Default apply
|
|
1923
|
+
* repo.stashApply(0);
|
|
1924
|
+
*
|
|
1925
|
+
* // With options
|
|
1926
|
+
* repo.stashApply(0, { reinstantiateIndex: true });
|
|
1927
|
+
* ```
|
|
1928
|
+
*/
|
|
1929
|
+
export interface StashApplyOptions {
|
|
1930
|
+
/**
|
|
1931
|
+
* Whether to reinstall the index from the stash.
|
|
1932
|
+
* If true, the index state recorded in the stash is also restored.
|
|
1933
|
+
* Default: false
|
|
1934
|
+
*/
|
|
1935
|
+
reinstantiateIndex?: boolean
|
|
1936
|
+
}
|
|
1733
1937
|
export interface Status {
|
|
1734
1938
|
current: boolean
|
|
1735
1939
|
indexNew: boolean
|
|
@@ -1742,6 +1946,7 @@ export interface Status {
|
|
|
1742
1946
|
wtDeleted: boolean
|
|
1743
1947
|
wtTypechange: boolean
|
|
1744
1948
|
wtRenamed: boolean
|
|
1949
|
+
wtUnreadable: boolean
|
|
1745
1950
|
ignored: boolean
|
|
1746
1951
|
conflicted: boolean
|
|
1747
1952
|
}
|
|
@@ -3643,6 +3848,133 @@ export declare class GitObject {
|
|
|
3643
3848
|
*/
|
|
3644
3849
|
asCommit(): Commit | null
|
|
3645
3850
|
}
|
|
3851
|
+
/**
|
|
3852
|
+
* Representation of a rebase
|
|
3853
|
+
* Begin the rebase by iterating the returned `Rebase`
|
|
3854
|
+
* (e.g., `for (const op of rebase) { ... }` or calling `next()`).
|
|
3855
|
+
*/
|
|
3856
|
+
export declare class Rebase {
|
|
3857
|
+
/**
|
|
3858
|
+
* Gets the count of rebase operations that are to be applied.
|
|
3859
|
+
*
|
|
3860
|
+
* @category Rebase/Methods
|
|
3861
|
+
* @signature
|
|
3862
|
+
* ```ts
|
|
3863
|
+
* class Rebase {
|
|
3864
|
+
* len(): number;
|
|
3865
|
+
* }
|
|
3866
|
+
* ```
|
|
3867
|
+
*
|
|
3868
|
+
* @returns The count of rebase operations.
|
|
3869
|
+
*/
|
|
3870
|
+
len(): bigint
|
|
3871
|
+
/**
|
|
3872
|
+
* Gets the original `HEAD` ref name for merge rebases.
|
|
3873
|
+
*
|
|
3874
|
+
* @category Rebase/Methods
|
|
3875
|
+
* @signature
|
|
3876
|
+
* ```ts
|
|
3877
|
+
* class Rebase {
|
|
3878
|
+
* originHeadName(): string | null;
|
|
3879
|
+
* }
|
|
3880
|
+
* ```
|
|
3881
|
+
*
|
|
3882
|
+
* @returns The original `HEAD` ref name for merge rebases.
|
|
3883
|
+
*/
|
|
3884
|
+
originHeadName(): string | null
|
|
3885
|
+
/**
|
|
3886
|
+
* Gets the original `HEAD` id for merge rebases.
|
|
3887
|
+
*
|
|
3888
|
+
* @category Rebase/Methods
|
|
3889
|
+
* @signature
|
|
3890
|
+
* ```ts
|
|
3891
|
+
* class Rebase {
|
|
3892
|
+
* originHeadId(): string | null;
|
|
3893
|
+
* }
|
|
3894
|
+
* ```
|
|
3895
|
+
*
|
|
3896
|
+
* @returns The original `HEAD` id for merge rebases.
|
|
3897
|
+
*/
|
|
3898
|
+
originHeadId(): string | null
|
|
3899
|
+
/**
|
|
3900
|
+
* Gets the index produced by the last operation, which is the result of
|
|
3901
|
+
* `next()` and which will be committed by the next invocation of
|
|
3902
|
+
* `commit()`. This is useful for resolving conflicts in an in-memory
|
|
3903
|
+
* rebase before committing them.
|
|
3904
|
+
*
|
|
3905
|
+
* This is only applicable for in-memory rebases; for rebases within a
|
|
3906
|
+
* working directory, the changes were applied to the repository's index.
|
|
3907
|
+
*
|
|
3908
|
+
* @category Rebase/Methods
|
|
3909
|
+
* @signature
|
|
3910
|
+
* ```ts
|
|
3911
|
+
* class Rebase {
|
|
3912
|
+
* inmemoryIndex(): Index;
|
|
3913
|
+
* }
|
|
3914
|
+
* ```
|
|
3915
|
+
*
|
|
3916
|
+
* @returns The index produced by the last operation.
|
|
3917
|
+
*/
|
|
3918
|
+
inmemoryIndex(): Index
|
|
3919
|
+
/**
|
|
3920
|
+
* Commits the current patch. You must have resolved any conflicts that
|
|
3921
|
+
* were introduced during the patch application from the rebase next
|
|
3922
|
+
* invocation.
|
|
3923
|
+
*
|
|
3924
|
+
* @category Rebase/Methods
|
|
3925
|
+
* @signature
|
|
3926
|
+
* ```ts
|
|
3927
|
+
* class Rebase {
|
|
3928
|
+
* commit(options: RebaseCommitOptions): string;
|
|
3929
|
+
* }
|
|
3930
|
+
* ```
|
|
3931
|
+
*
|
|
3932
|
+
* @param {RebaseCommitOptions} options - Options for committing the patch.
|
|
3933
|
+
* @returns The commit ID of the commit that was created.
|
|
3934
|
+
*
|
|
3935
|
+
* @example
|
|
3936
|
+
* ```ts
|
|
3937
|
+
* import { openRepository } from 'es-git';
|
|
3938
|
+
*
|
|
3939
|
+
* const repo = await openRepository('.');
|
|
3940
|
+
* const rebase = repo.rebase(...);
|
|
3941
|
+
* const sig = { name: 'Seokju Na', email: 'seokju.me@toss.im' };
|
|
3942
|
+
* for (const op of rebase) {
|
|
3943
|
+
* rebase.commit({ committer: sig });
|
|
3944
|
+
* }
|
|
3945
|
+
* ```
|
|
3946
|
+
*/
|
|
3947
|
+
commit(options: RebaseCommitOptions): string
|
|
3948
|
+
/**
|
|
3949
|
+
* Aborts a rebase that is currently in progress, resetting the repository
|
|
3950
|
+
* and working directory to their state before rebase began.
|
|
3951
|
+
*
|
|
3952
|
+
* @category Rebase/Methods
|
|
3953
|
+
* @signature
|
|
3954
|
+
* ```ts
|
|
3955
|
+
* class Rebase {
|
|
3956
|
+
* abort(): void;
|
|
3957
|
+
* }
|
|
3958
|
+
* ```
|
|
3959
|
+
*/
|
|
3960
|
+
abort(): void
|
|
3961
|
+
/**
|
|
3962
|
+
* Finishes a rebase that is currently in progress once all patches have
|
|
3963
|
+
* been applied.
|
|
3964
|
+
*
|
|
3965
|
+
* @category Rebase/Methods
|
|
3966
|
+
* @signature
|
|
3967
|
+
* ```ts
|
|
3968
|
+
* class Rebase {
|
|
3969
|
+
* finish(signature?: SignaturePayload | undefined | null): void;
|
|
3970
|
+
* }
|
|
3971
|
+
* ```
|
|
3972
|
+
*
|
|
3973
|
+
* @params {SignaturePayload | undefined | null} [signature] - The identity that is finishing the rebase
|
|
3974
|
+
*/
|
|
3975
|
+
finish(signature?: SignaturePayload | undefined | null): void
|
|
3976
|
+
[Symbol.iterator](): Iterator<RebaseOperation, void, void>
|
|
3977
|
+
}
|
|
3646
3978
|
/**
|
|
3647
3979
|
* A class to represent a git [reference][1].
|
|
3648
3980
|
*
|
|
@@ -4771,7 +5103,7 @@ export declare class Repository {
|
|
|
4771
5103
|
* }
|
|
4772
5104
|
* ```
|
|
4773
5105
|
*
|
|
4774
|
-
* @param {Commit}
|
|
5106
|
+
* @param {Commit} ourCommit - The commit that reflects the destination tree.
|
|
4775
5107
|
* @param {Commit} theirCommit - The commit to merge in to `ourCommit`.
|
|
4776
5108
|
* @param {MergeOptions} [options] - Merge options.
|
|
4777
5109
|
* @returns The index result.
|
|
@@ -4797,7 +5129,7 @@ export declare class Repository {
|
|
|
4797
5129
|
* ```
|
|
4798
5130
|
*
|
|
4799
5131
|
* @param {Tree} ancestorTree - The common ancestor between.
|
|
4800
|
-
* @param {Tree}
|
|
5132
|
+
* @param {Tree} ourTree - The tree that reflects the destination tree.
|
|
4801
5133
|
* @param {Tree} theirTree - The tree to merge in to `ourTree`.
|
|
4802
5134
|
* @param {MergeOptions} [options] - Merge options.
|
|
4803
5135
|
* @returns The index result.
|
|
@@ -4867,6 +5199,74 @@ export declare class Repository {
|
|
|
4867
5199
|
* @throws Throws error if the object does not exist.
|
|
4868
5200
|
*/
|
|
4869
5201
|
getObject(oid: string): GitObject
|
|
5202
|
+
/**
|
|
5203
|
+
* Initializes a rebase operation to rebase the changes in `branch`
|
|
5204
|
+
* relative to `upstream` onto another branch. To begin the rebase process,
|
|
5205
|
+
* call iterator.
|
|
5206
|
+
*
|
|
5207
|
+
* @category Repository/Methods
|
|
5208
|
+
* @signature
|
|
5209
|
+
* ```ts
|
|
5210
|
+
* class Repository {
|
|
5211
|
+
* rebase(
|
|
5212
|
+
* branch?: AnnotatedCommit | undefined | null,
|
|
5213
|
+
* upstream?: AnnotatedCommit | undefined | null,
|
|
5214
|
+
* onto?: AnnotatedCommit | undefined | null,
|
|
5215
|
+
* options?: RebaseOptions | undefined | null,
|
|
5216
|
+
* ): Rebase;
|
|
5217
|
+
* }
|
|
5218
|
+
* ```
|
|
5219
|
+
*
|
|
5220
|
+
* @param {AnnotatedCommit | undefined | null} [branch] - Annotated commit representing the
|
|
5221
|
+
* branch to rebase. Typically, the branch's head commit. If omitted, the currently checked-out
|
|
5222
|
+
* branch is used.
|
|
5223
|
+
* @param {AnnotatedCommit | undefined | null} [upstream] - Annotated commit that defines the
|
|
5224
|
+
* "original base" of the commits to be rebased. If omitted, the repository will typically try
|
|
5225
|
+
* to use the branch's configured upstream.
|
|
5226
|
+
* @param {AnnotatedCommit | undefined | null} [onto] - Specified the "new base" onto which the
|
|
5227
|
+
* selected commits will be reapplied.
|
|
5228
|
+
* @param {RebaseOptions | undefined | null} [options] - Fine-grained control of the rebase
|
|
5229
|
+
* behavior, such as checkout options, merge options, and in-memory rebase.
|
|
5230
|
+
* @returns The initialized rebase handle to iterate and apply steps.
|
|
5231
|
+
*
|
|
5232
|
+
* @example
|
|
5233
|
+
* ```ts
|
|
5234
|
+
* import { openRepository } from 'es-git';
|
|
5235
|
+
*
|
|
5236
|
+
* const repo = await openRepository('.');
|
|
5237
|
+
* const branchRef = repo.getReference('refs/heads/other');
|
|
5238
|
+
* const upstreamRef = repo.getReference('refs/heads/main');
|
|
5239
|
+
* const branch = repo.getAnnotatedCommitFromReference(branchRef);
|
|
5240
|
+
* const upstream = repo.getAnnotatedCommitFromReference(upstreamRef);
|
|
5241
|
+
*
|
|
5242
|
+
* const sig = { name: 'Seokju Na', email: 'seokju.me@toss.im' };
|
|
5243
|
+
*
|
|
5244
|
+
* const rebase = repo.rebase(branch, upstream);
|
|
5245
|
+
* for (const op of rebase) {
|
|
5246
|
+
* rebase.commit({ committer: sig });
|
|
5247
|
+
* }
|
|
5248
|
+
* rebase.finish(sig);
|
|
5249
|
+
* ```
|
|
5250
|
+
*/
|
|
5251
|
+
rebase(branch?: AnnotatedCommit | undefined | null, upstream?: AnnotatedCommit | undefined | null, onto?: AnnotatedCommit | undefined | null, options?: RebaseOptions | undefined | null): Rebase
|
|
5252
|
+
/**
|
|
5253
|
+
* Opens an existing rebase that was previously started by either an
|
|
5254
|
+
* invocation of `rebase()` or by another client.
|
|
5255
|
+
*
|
|
5256
|
+
* @category Repository/Methods
|
|
5257
|
+
* @signature
|
|
5258
|
+
* ```ts
|
|
5259
|
+
* class Repository {
|
|
5260
|
+
* openRebase(options?: RebaseOptions | undefined | null): Rebase;
|
|
5261
|
+
* }
|
|
5262
|
+
* ```
|
|
5263
|
+
*
|
|
5264
|
+
* @param {RebaseOptions | undefined | null} [options] - Fine-grained control of the rebase
|
|
5265
|
+
* behavior, such as checkout options, merge options, and in-memory rebase.
|
|
5266
|
+
* @returns The initialized rebase handle to iterate and apply steps.
|
|
5267
|
+
* @throws Throws if the existing rebase was not found.
|
|
5268
|
+
*/
|
|
5269
|
+
openRebase(options?: RebaseOptions | undefined | null): Rebase
|
|
4870
5270
|
/**
|
|
4871
5271
|
* Lookup a reference to one of the objects in a repository.
|
|
4872
5272
|
*
|
|
@@ -5072,6 +5472,16 @@ export declare class Repository {
|
|
|
5072
5472
|
* ```
|
|
5073
5473
|
*
|
|
5074
5474
|
* @returns The current state of this repository.
|
|
5475
|
+
*
|
|
5476
|
+
* @example
|
|
5477
|
+
* ```ts
|
|
5478
|
+
* import { openRepository } from 'es-git';
|
|
5479
|
+
*
|
|
5480
|
+
* const repo = await openRepository('./repo');
|
|
5481
|
+
* console.log(repo.state()); // e.g., 'Clean'
|
|
5482
|
+
* // After a revert/merge/cherry-pick, state can be 'Revert'/'Merge' etc.
|
|
5483
|
+
* // Use repo.cleanupState() to return to 'Clean' when done handling.
|
|
5484
|
+
* ```
|
|
5075
5485
|
*/
|
|
5076
5486
|
state(): RepositoryState
|
|
5077
5487
|
/**
|
|
@@ -5163,7 +5573,7 @@ export declare class Repository {
|
|
|
5163
5573
|
* }
|
|
5164
5574
|
* ```
|
|
5165
5575
|
*
|
|
5166
|
-
* @param {Commit}
|
|
5576
|
+
* @param {Commit} commit - A Commit which the HEAD should point to.
|
|
5167
5577
|
*/
|
|
5168
5578
|
setHeadDetached(commit: Commit): void
|
|
5169
5579
|
/**
|
|
@@ -5236,8 +5646,97 @@ export declare class Repository {
|
|
|
5236
5646
|
* cleanupState(): void;
|
|
5237
5647
|
* }
|
|
5238
5648
|
* ```
|
|
5649
|
+
*
|
|
5650
|
+
* @example
|
|
5651
|
+
* ```ts
|
|
5652
|
+
* import { openRepository } from 'es-git';
|
|
5653
|
+
*
|
|
5654
|
+
* const repo = await openRepository('./repo');
|
|
5655
|
+
* // After revert or merge operations:
|
|
5656
|
+
* if (repo.state() !== 'Clean') {
|
|
5657
|
+
* repo.cleanupState();
|
|
5658
|
+
* }
|
|
5659
|
+
* ```
|
|
5239
5660
|
*/
|
|
5240
5661
|
cleanupState(): void
|
|
5662
|
+
/**
|
|
5663
|
+
* Reverts the given commit, applying the inverse of its changes to the
|
|
5664
|
+
* HEAD commit and the working directory.
|
|
5665
|
+
*
|
|
5666
|
+
* @category Repository/Methods
|
|
5667
|
+
* @signature
|
|
5668
|
+
* ```ts
|
|
5669
|
+
* class Repository {
|
|
5670
|
+
* revert(
|
|
5671
|
+
* commit: Commit,
|
|
5672
|
+
* options?: RevertOptions | undefined | null,
|
|
5673
|
+
* ): void;
|
|
5674
|
+
* }
|
|
5675
|
+
* ```
|
|
5676
|
+
*
|
|
5677
|
+
* @param {Commit} commit - The commit to revert.
|
|
5678
|
+
* @param {RevertOptions} [options] - Options for the revert operation.
|
|
5679
|
+
* @throws {Error} If the commit is a merge commit and no mainline is specified.
|
|
5680
|
+
* @throws {Error} If there are conflicts during the revert operation.
|
|
5681
|
+
*
|
|
5682
|
+
* @example
|
|
5683
|
+
* ```ts
|
|
5684
|
+
* import { openRepository } from 'es-git';
|
|
5685
|
+
*
|
|
5686
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5687
|
+
* const last = repo.head().target()!;
|
|
5688
|
+
* const commit = repo.getCommit(last);
|
|
5689
|
+
*
|
|
5690
|
+
* // Revert and update working tree
|
|
5691
|
+
* repo.revert(commit);
|
|
5692
|
+
* repo.cleanupState();
|
|
5693
|
+
*
|
|
5694
|
+
* // Revert a merge commit: specify the mainline parent
|
|
5695
|
+
* // repo.revert(mergeCommit, { mainline: 1 });
|
|
5696
|
+
* // repo.cleanupState();
|
|
5697
|
+
* ```
|
|
5698
|
+
*/
|
|
5699
|
+
revert(commit: Commit, options?: RevertOptions | undefined | null): void
|
|
5700
|
+
/**
|
|
5701
|
+
* Reverts the given commit against the given "our" commit, producing an
|
|
5702
|
+
* index that reflects the result of the revert.
|
|
5703
|
+
*
|
|
5704
|
+
* The returned index must be written to disk for the changes to take effect.
|
|
5705
|
+
*
|
|
5706
|
+
* @category Repository/Methods
|
|
5707
|
+
* @signature
|
|
5708
|
+
* ```ts
|
|
5709
|
+
* class Repository {
|
|
5710
|
+
* revertCommit(
|
|
5711
|
+
* revertCommit: Commit,
|
|
5712
|
+
* ourCommit: Commit,
|
|
5713
|
+
* mainline: number,
|
|
5714
|
+
* mergeOptions?: MergeOptions | undefined | null,
|
|
5715
|
+
* ): Index;
|
|
5716
|
+
* }
|
|
5717
|
+
* ```
|
|
5718
|
+
*
|
|
5719
|
+
* @param {Commit} revertCommit - The commit to revert.
|
|
5720
|
+
* @param {Commit} ourCommit - The commit to revert against (usually HEAD).
|
|
5721
|
+
* @param {number} mainline - The parent of the revert commit, if it is a merge (1-based).
|
|
5722
|
+
* @param {MergeOptions} [mergeOptions] - Options for merge conflict resolution.
|
|
5723
|
+
* @returns The index result.
|
|
5724
|
+
*
|
|
5725
|
+
* @example
|
|
5726
|
+
* ```ts
|
|
5727
|
+
* import { openRepository } from 'es-git';
|
|
5728
|
+
*
|
|
5729
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5730
|
+
* const head = repo.head().target()!;
|
|
5731
|
+
* const our = repo.getCommit(head);
|
|
5732
|
+
* const target = repo.getCommit(head);
|
|
5733
|
+
*
|
|
5734
|
+
* // Compute a revert index and apply to working tree
|
|
5735
|
+
* const idx = repo.revertCommit(target, our, 0);
|
|
5736
|
+
* repo.checkoutIndex(idx);
|
|
5737
|
+
* ```
|
|
5738
|
+
*/
|
|
5739
|
+
revertCommit(revertCommit: Commit, ourCommit: Commit, mainline: number, mergeOptions?: MergeOptions | undefined | null): Index
|
|
5241
5740
|
/**
|
|
5242
5741
|
* Execute a rev-parse operation against the `spec` listed.
|
|
5243
5742
|
*
|
|
@@ -5286,6 +5785,175 @@ export declare class Repository {
|
|
|
5286
5785
|
* @returns Revwalk to traverse the commit graph in this repository.
|
|
5287
5786
|
*/
|
|
5288
5787
|
revwalk(): Revwalk
|
|
5788
|
+
/**
|
|
5789
|
+
* Save the local modifications to a new stash.
|
|
5790
|
+
*
|
|
5791
|
+
* This method saves your current working directory and index state to a new stash entry,
|
|
5792
|
+
* allowing you to temporarily store changes and work on something else. The working directory
|
|
5793
|
+
* is reverted to match the HEAD commit after stashing.
|
|
5794
|
+
*
|
|
5795
|
+
* @category Repository/Methods
|
|
5796
|
+
* @signature
|
|
5797
|
+
* ```ts
|
|
5798
|
+
* class Repository {
|
|
5799
|
+
* stashSave(options?: StashSaveOptions): string;
|
|
5800
|
+
* }
|
|
5801
|
+
* ```
|
|
5802
|
+
*
|
|
5803
|
+
* @param {StashSaveOptions} [options] - Options for saving the stash.
|
|
5804
|
+
* @returns {string} The object ID (40-character SHA1) of the commit containing the stashed state.
|
|
5805
|
+
* @throws {Error} If there are no local changes to stash or if the stash operation fails.
|
|
5806
|
+
*
|
|
5807
|
+
* @example
|
|
5808
|
+
* ```ts
|
|
5809
|
+
* import { openRepository } from 'es-git';
|
|
5810
|
+
*
|
|
5811
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5812
|
+
*
|
|
5813
|
+
* // Simple stash
|
|
5814
|
+
* const stashId = repo.stashSave({
|
|
5815
|
+
* stasher: { name: 'Seokju Na', email: 'seokju.me@toss.im' },
|
|
5816
|
+
* message: 'WIP: implementing new feature'
|
|
5817
|
+
* });
|
|
5818
|
+
*
|
|
5819
|
+
* // Stash including untracked files
|
|
5820
|
+
* repo.stashSave({
|
|
5821
|
+
* stasher: { name: 'Seokju Na', email: 'seokju.me@toss.im' },
|
|
5822
|
+
* includeUntracked: true
|
|
5823
|
+
* });
|
|
5824
|
+
* ```
|
|
5825
|
+
*/
|
|
5826
|
+
stashSave(options?: StashSaveOptions | undefined | null): string
|
|
5827
|
+
/**
|
|
5828
|
+
* Apply a single stashed state from the stash list.
|
|
5829
|
+
*
|
|
5830
|
+
* This method applies the changes from a stash entry to your working directory.
|
|
5831
|
+
* Unlike `stashPop`, this does not remove the stash from the list after applying.
|
|
5832
|
+
* Conflicts may occur if the stashed changes conflict with the current working directory.
|
|
5833
|
+
*
|
|
5834
|
+
* @category Repository/Methods
|
|
5835
|
+
* @signature
|
|
5836
|
+
* ```ts
|
|
5837
|
+
* class Repository {
|
|
5838
|
+
* stashApply(index: number, options?: StashApplyOptions): void;
|
|
5839
|
+
* }
|
|
5840
|
+
* ```
|
|
5841
|
+
*
|
|
5842
|
+
* @param {number} index - The index of the stash to apply (0 is the most recent).
|
|
5843
|
+
* @param {StashApplyOptions} [options] - Options for applying the stash.
|
|
5844
|
+
* @throws {Error} If the stash index is invalid or if there are conflicts during application.
|
|
5845
|
+
*
|
|
5846
|
+
* @example
|
|
5847
|
+
* ```ts
|
|
5848
|
+
* import { openRepository } from 'es-git';
|
|
5849
|
+
*
|
|
5850
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5851
|
+
*
|
|
5852
|
+
* // Apply the most recent stash
|
|
5853
|
+
* repo.stashApply(0);
|
|
5854
|
+
*
|
|
5855
|
+
* // Apply with options
|
|
5856
|
+
* repo.stashApply(0, { reinstantiateIndex: true });
|
|
5857
|
+
* ```
|
|
5858
|
+
*/
|
|
5859
|
+
stashApply(index: number, options?: StashApplyOptions | undefined | null): void
|
|
5860
|
+
/**
|
|
5861
|
+
* Remove a single stashed state from the stash list.
|
|
5862
|
+
*
|
|
5863
|
+
* This permanently deletes a stash entry. The stash is removed from the list and
|
|
5864
|
+
* cannot be recovered. All subsequent stashes will be reindexed (e.g., stash@{2}
|
|
5865
|
+
* becomes stash@{1} after dropping stash@{1}).
|
|
5866
|
+
*
|
|
5867
|
+
* @category Repository/Methods
|
|
5868
|
+
* @signature
|
|
5869
|
+
* ```ts
|
|
5870
|
+
* class Repository {
|
|
5871
|
+
* stashDrop(index: number): void;
|
|
5872
|
+
* }
|
|
5873
|
+
* ```
|
|
5874
|
+
*
|
|
5875
|
+
* @param {number} index - The index of the stash to drop (0 is the most recent).
|
|
5876
|
+
* @throws {Error} If the stash index is invalid.
|
|
5877
|
+
*
|
|
5878
|
+
* @example
|
|
5879
|
+
* ```ts
|
|
5880
|
+
* import { openRepository } from 'es-git';
|
|
5881
|
+
*
|
|
5882
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5883
|
+
*
|
|
5884
|
+
* // Drop the most recent stash
|
|
5885
|
+
* repo.stashDrop(0);
|
|
5886
|
+
*
|
|
5887
|
+
* // Drop the third stash
|
|
5888
|
+
* repo.stashDrop(2);
|
|
5889
|
+
* ```
|
|
5890
|
+
*/
|
|
5891
|
+
stashDrop(index: number): void
|
|
5892
|
+
/**
|
|
5893
|
+
* Apply a single stashed state from the stash list and remove it from the list if successful.
|
|
5894
|
+
*
|
|
5895
|
+
* This method combines `stashApply` and `stashDrop` into a single operation. It applies
|
|
5896
|
+
* the stash to your working directory and, if successful, removes it from the stash list.
|
|
5897
|
+
* If the application fails (e.g., due to conflicts), the stash remains in the list.
|
|
5898
|
+
*
|
|
5899
|
+
* @category Repository/Methods
|
|
5900
|
+
* @signature
|
|
5901
|
+
* ```ts
|
|
5902
|
+
* class Repository {
|
|
5903
|
+
* stashPop(index: number, options?: StashApplyOptions): void;
|
|
5904
|
+
* }
|
|
5905
|
+
* ```
|
|
5906
|
+
*
|
|
5907
|
+
* @param {number} index - The index of the stash to pop (0 is the most recent).
|
|
5908
|
+
* @param {StashApplyOptions} [options] - Options for applying the stash.
|
|
5909
|
+
* @throws {Error} If the stash index is invalid or if there are conflicts during application.
|
|
5910
|
+
*
|
|
5911
|
+
* @example
|
|
5912
|
+
* ```ts
|
|
5913
|
+
* import { openRepository } from 'es-git';
|
|
5914
|
+
*
|
|
5915
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5916
|
+
*
|
|
5917
|
+
* // Pop the most recent stash
|
|
5918
|
+
* repo.stashPop(0);
|
|
5919
|
+
*
|
|
5920
|
+
* // Pop with options
|
|
5921
|
+
* repo.stashPop(0, { reinstantiateIndex: true });
|
|
5922
|
+
* ```
|
|
5923
|
+
*/
|
|
5924
|
+
stashPop(index: number, options?: StashApplyOptions | undefined | null): void
|
|
5925
|
+
/**
|
|
5926
|
+
* Get the list of stash states in the repository.
|
|
5927
|
+
*
|
|
5928
|
+
* Returns a StashList object that provides access to all stashes in the repository.
|
|
5929
|
+
* The list is ordered with the most recent stash at index 0.
|
|
5930
|
+
*
|
|
5931
|
+
* @category Repository/Methods
|
|
5932
|
+
* @signature
|
|
5933
|
+
* ```ts
|
|
5934
|
+
* class Repository {
|
|
5935
|
+
* stashList(): StashList;
|
|
5936
|
+
* }
|
|
5937
|
+
* ```
|
|
5938
|
+
*
|
|
5939
|
+
* @returns {StashList} A container providing access to all stash entries in the repository.
|
|
5940
|
+
*
|
|
5941
|
+
* @example
|
|
5942
|
+
* ```ts
|
|
5943
|
+
* import { openRepository } from 'es-git';
|
|
5944
|
+
*
|
|
5945
|
+
* const repo = await openRepository('./path/to/repo');
|
|
5946
|
+
* const stashList = repo.stashList();
|
|
5947
|
+
*
|
|
5948
|
+
* if (!stashList.isEmpty()) {
|
|
5949
|
+
* console.log(`Found ${stashList.len()} stashes`);
|
|
5950
|
+
* for (const stash of stashList.iter()) {
|
|
5951
|
+
* console.log(`${stash.index()}: ${stash.message()}`);
|
|
5952
|
+
* }
|
|
5953
|
+
* }
|
|
5954
|
+
* ```
|
|
5955
|
+
*/
|
|
5956
|
+
stashList(): StashList
|
|
5289
5957
|
/**
|
|
5290
5958
|
* Test if the ignore rules apply to a given file.
|
|
5291
5959
|
*
|
|
@@ -5833,6 +6501,220 @@ export declare class Revwalk {
|
|
|
5833
6501
|
*/
|
|
5834
6502
|
hideRef(reference: string): this
|
|
5835
6503
|
}
|
|
6504
|
+
/**
|
|
6505
|
+
* A class to represent a git stash entry.
|
|
6506
|
+
*
|
|
6507
|
+
* A stash entry represents a snapshot of the working directory and index that has been saved
|
|
6508
|
+
* temporarily. Each stash entry has an index (position in the stash stack), an ID (commit SHA),
|
|
6509
|
+
* and an optional message describing the changes.
|
|
6510
|
+
*/
|
|
6511
|
+
export declare class StashEntry {
|
|
6512
|
+
/**
|
|
6513
|
+
* Get the index of this stash entry.
|
|
6514
|
+
*
|
|
6515
|
+
* The index represents the position of this stash in the stash stack, where 0 is the most recent stash.
|
|
6516
|
+
*
|
|
6517
|
+
* @category Stash/Methods
|
|
6518
|
+
* @signature
|
|
6519
|
+
* ```ts
|
|
6520
|
+
* class StashEntry {
|
|
6521
|
+
* index(): number;
|
|
6522
|
+
* }
|
|
6523
|
+
* ```
|
|
6524
|
+
*
|
|
6525
|
+
* @returns {number} Index of this stash entry (0-based, with 0 being the most recent).
|
|
6526
|
+
*
|
|
6527
|
+
* @example
|
|
6528
|
+
* ```ts
|
|
6529
|
+
* import { openRepository } from 'es-git';
|
|
6530
|
+
*
|
|
6531
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6532
|
+
* const stashList = repo.stashList();
|
|
6533
|
+
* const stash = stashList.get(0);
|
|
6534
|
+
* console.log(stash?.index()); // 0
|
|
6535
|
+
* ```
|
|
6536
|
+
*/
|
|
6537
|
+
index(): number
|
|
6538
|
+
/**
|
|
6539
|
+
* Get the id (SHA1) of this stash entry.
|
|
6540
|
+
*
|
|
6541
|
+
* Each stash is stored as a commit object, and this returns the commit SHA.
|
|
6542
|
+
*
|
|
6543
|
+
* @category Stash/Methods
|
|
6544
|
+
* @signature
|
|
6545
|
+
* ```ts
|
|
6546
|
+
* class StashEntry {
|
|
6547
|
+
* id(): string;
|
|
6548
|
+
* }
|
|
6549
|
+
* ```
|
|
6550
|
+
*
|
|
6551
|
+
* @returns {string} The 40-character hexadecimal SHA1 hash of the stash commit.
|
|
6552
|
+
*
|
|
6553
|
+
* @example
|
|
6554
|
+
* ```ts
|
|
6555
|
+
* import { openRepository } from 'es-git';
|
|
6556
|
+
*
|
|
6557
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6558
|
+
* const stashList = repo.stashList();
|
|
6559
|
+
* const stash = stashList.get(0);
|
|
6560
|
+
* console.log(stash?.id()); // e.g., "a1b2c3d4e5f6..."
|
|
6561
|
+
* ```
|
|
6562
|
+
*/
|
|
6563
|
+
id(): string
|
|
6564
|
+
/**
|
|
6565
|
+
* Get the message of this stash entry.
|
|
6566
|
+
*
|
|
6567
|
+
* Returns the message associated with the stash when it was created. If no custom message
|
|
6568
|
+
* was provided, it returns the default message generated by Git.
|
|
6569
|
+
*
|
|
6570
|
+
* @category Stash/Methods
|
|
6571
|
+
* @signature
|
|
6572
|
+
* ```ts
|
|
6573
|
+
* class StashEntry {
|
|
6574
|
+
* message(): string | null;
|
|
6575
|
+
* }
|
|
6576
|
+
* ```
|
|
6577
|
+
*
|
|
6578
|
+
* @returns {string | null} The stash message, or null if not available.
|
|
6579
|
+
*
|
|
6580
|
+
* @example
|
|
6581
|
+
* ```ts
|
|
6582
|
+
* import { openRepository } from 'es-git';
|
|
6583
|
+
*
|
|
6584
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6585
|
+
* const stashList = repo.stashList();
|
|
6586
|
+
* const stash = stashList.get(0);
|
|
6587
|
+
* console.log(stash?.message()); // e.g., "WIP on main: abc1234 fix: typo"
|
|
6588
|
+
* ```
|
|
6589
|
+
*/
|
|
6590
|
+
message(): string | null
|
|
6591
|
+
}
|
|
6592
|
+
/**
|
|
6593
|
+
* A container for a list of stash entries about a repository.
|
|
6594
|
+
*
|
|
6595
|
+
* The stash list provides access to all stashes in the repository. Stashes are indexed
|
|
6596
|
+
* from 0 (most recent) to n-1 (oldest). This class provides methods to access individual
|
|
6597
|
+
* stashes, check the count, and iterate over all stashes.
|
|
6598
|
+
*
|
|
6599
|
+
* @example
|
|
6600
|
+
* ```ts
|
|
6601
|
+
* import { openRepository } from 'es-git';
|
|
6602
|
+
*
|
|
6603
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6604
|
+
* const stashList = repo.stashList();
|
|
6605
|
+
* console.log(`Total stashes: ${stashList.len()}`);
|
|
6606
|
+
*
|
|
6607
|
+
* // Iterate over all stashes
|
|
6608
|
+
* for (const stash of stashList.iter()) {
|
|
6609
|
+
* console.log(`${stash.index()}: ${stash.message()}`);
|
|
6610
|
+
* }
|
|
6611
|
+
* ```
|
|
6612
|
+
*/
|
|
6613
|
+
export declare class StashList {
|
|
6614
|
+
/**
|
|
6615
|
+
* Gets a stash entry from this list at the specified index.
|
|
6616
|
+
*
|
|
6617
|
+
* @category Stash/Methods
|
|
6618
|
+
* @signature
|
|
6619
|
+
* ```ts
|
|
6620
|
+
* class StashList {
|
|
6621
|
+
* get(index: number): StashEntry | null;
|
|
6622
|
+
* }
|
|
6623
|
+
* ```
|
|
6624
|
+
*
|
|
6625
|
+
* @param {number} index - Index of the stash entry to get (0-based, where 0 is the most recent).
|
|
6626
|
+
* @returns {StashEntry | null} A stash entry from this list at the specified index, or `null` if the index is out of bounds.
|
|
6627
|
+
*
|
|
6628
|
+
* @example
|
|
6629
|
+
* ```ts
|
|
6630
|
+
* import { openRepository } from 'es-git';
|
|
6631
|
+
*
|
|
6632
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6633
|
+
* const stashList = repo.stashList();
|
|
6634
|
+
*
|
|
6635
|
+
* // Get the most recent stash
|
|
6636
|
+
* const stash = stashList.get(0);
|
|
6637
|
+
* if (stash) {
|
|
6638
|
+
* console.log(stash.message());
|
|
6639
|
+
* }
|
|
6640
|
+
* ```
|
|
6641
|
+
*/
|
|
6642
|
+
get(index: number): StashEntry | null
|
|
6643
|
+
/**
|
|
6644
|
+
* Gets the count of stash entries in this list.
|
|
6645
|
+
*
|
|
6646
|
+
* @category Stash/Methods
|
|
6647
|
+
* @signature
|
|
6648
|
+
* ```ts
|
|
6649
|
+
* class StashList {
|
|
6650
|
+
* len(): number;
|
|
6651
|
+
* }
|
|
6652
|
+
* ```
|
|
6653
|
+
*
|
|
6654
|
+
* @returns If there are no stashes in the repository, this should return 0.
|
|
6655
|
+
*/
|
|
6656
|
+
len(): number
|
|
6657
|
+
/**
|
|
6658
|
+
* Check if the stash list is empty.
|
|
6659
|
+
*
|
|
6660
|
+
* @category Stash/Methods
|
|
6661
|
+
* @signature
|
|
6662
|
+
* ```ts
|
|
6663
|
+
* class StashList {
|
|
6664
|
+
* isEmpty(): boolean;
|
|
6665
|
+
* }
|
|
6666
|
+
* ```
|
|
6667
|
+
*
|
|
6668
|
+
* @returns {boolean} Returns `true` if there are no stash entries in this repository.
|
|
6669
|
+
*
|
|
6670
|
+
* @example
|
|
6671
|
+
* ```ts
|
|
6672
|
+
* import { openRepository } from 'es-git';
|
|
6673
|
+
*
|
|
6674
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6675
|
+
* const stashList = repo.stashList();
|
|
6676
|
+
*
|
|
6677
|
+
* if (stashList.isEmpty()) {
|
|
6678
|
+
* console.log('No stashes found');
|
|
6679
|
+
* } else {
|
|
6680
|
+
* console.log(`Found ${stashList.len()} stashes`);
|
|
6681
|
+
* }
|
|
6682
|
+
* ```
|
|
6683
|
+
*/
|
|
6684
|
+
isEmpty(): boolean
|
|
6685
|
+
/**
|
|
6686
|
+
* Returns an iterator over the stash entries in this list.
|
|
6687
|
+
*
|
|
6688
|
+
* The iterator yields stash entries in order from newest (index 0) to oldest.
|
|
6689
|
+
*
|
|
6690
|
+
* @category Stash/Methods
|
|
6691
|
+
* @signature
|
|
6692
|
+
* ```ts
|
|
6693
|
+
* class StashList {
|
|
6694
|
+
* iter(): StashListIter;
|
|
6695
|
+
* }
|
|
6696
|
+
* ```
|
|
6697
|
+
*
|
|
6698
|
+
* @returns {StashListIter} An iterator that yields StashEntry objects.
|
|
6699
|
+
*
|
|
6700
|
+
* @example
|
|
6701
|
+
* ```ts
|
|
6702
|
+
* import { openRepository } from 'es-git';
|
|
6703
|
+
*
|
|
6704
|
+
* const repo = await openRepository('./path/to/repo');
|
|
6705
|
+
* const stashList = repo.stashList();
|
|
6706
|
+
*
|
|
6707
|
+
* // Iterate over stashes
|
|
6708
|
+
* for (const stash of stashList.iter()) {
|
|
6709
|
+
* console.log(`${stash.index()}: ${stash.message()}`);
|
|
6710
|
+
* }
|
|
6711
|
+
* ```
|
|
6712
|
+
*/
|
|
6713
|
+
iter(): StashListIter
|
|
6714
|
+
}
|
|
6715
|
+
export declare class StashListIter {
|
|
6716
|
+
[Symbol.iterator](): Iterator<StashEntry, void, void>
|
|
6717
|
+
}
|
|
5836
6718
|
/**
|
|
5837
6719
|
* A container for a list of status information about a repository.
|
|
5838
6720
|
*
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { AnnotatedCommit, Blame, BlameHunks, BlameHunksByLine, Blob, isValidBranchName, Branch, Branches, BranchType, Commit, ConfigLevel, ConfigEntries, Config, openConfig, openDefaultConfig, findGlobalConfigPath, findSystemConfigPath, findXdgConfigPath, parseConfigBool, parseConfigI32, parseConfigI64, DiffFlags, diffFlagsContains, DeltaType, DiffFormat, Diff, DiffStats, Deltas, DiffDelta, FileMode, DiffFile, IndexStage, Index, IndexEntries, Mailmap, createMailmapFromBuffer, FileFavor, ObjectType, GitObject, isValidOid, isZeroOid, zeroOid, hashObjectOid, hashFileOid, ReferenceType, Reference, isValidReferenceName, ReferenceFormat, normalizeReferenceName, Direction, CredentialType, FetchPrune, AutotagOption, RemoteRedirect, Remote, RepositoryState, RepositoryInitMode, Repository, initRepository, openRepository, discoverRepository, cloneRepository, RevparseMode, revparseModeContains, RevwalkSort, Revwalk, createSignature, StatusShow, Statuses, StatusesIter, StatusEntry, isValidTagName, Tag, TreeWalkMode, Tree, TreeIter, TreeEntry } = nativeBinding
|
|
313
|
+
const { AnnotatedCommit, Blame, BlameHunks, BlameHunksByLine, Blob, isValidBranchName, Branch, Branches, BranchType, Commit, ConfigLevel, ConfigEntries, Config, openConfig, openDefaultConfig, findGlobalConfigPath, findSystemConfigPath, findXdgConfigPath, parseConfigBool, parseConfigI32, parseConfigI64, DiffFlags, diffFlagsContains, DeltaType, DiffFormat, Diff, DiffStats, Deltas, DiffDelta, FileMode, DiffFile, IndexStage, Index, IndexEntries, Mailmap, createMailmapFromBuffer, FileFavor, ObjectType, GitObject, isValidOid, isZeroOid, zeroOid, hashObjectOid, hashFileOid, Rebase, RebaseOperationType, ReferenceType, Reference, isValidReferenceName, ReferenceFormat, normalizeReferenceName, Direction, CredentialType, FetchPrune, AutotagOption, RemoteRedirect, Remote, RepositoryState, RepositoryInitMode, Repository, initRepository, openRepository, discoverRepository, cloneRepository, RevparseMode, revparseModeContains, RevwalkSort, Revwalk, createSignature, StashEntry, StashList, StashListIter, StatusShow, Statuses, StatusesIter, StatusEntry, isValidTagName, Tag, TreeWalkMode, Tree, TreeIter, TreeEntry } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.AnnotatedCommit = AnnotatedCommit
|
|
316
316
|
module.exports.Blame = Blame
|
|
@@ -356,6 +356,8 @@ module.exports.isZeroOid = isZeroOid
|
|
|
356
356
|
module.exports.zeroOid = zeroOid
|
|
357
357
|
module.exports.hashObjectOid = hashObjectOid
|
|
358
358
|
module.exports.hashFileOid = hashFileOid
|
|
359
|
+
module.exports.Rebase = Rebase
|
|
360
|
+
module.exports.RebaseOperationType = RebaseOperationType
|
|
359
361
|
module.exports.ReferenceType = ReferenceType
|
|
360
362
|
module.exports.Reference = Reference
|
|
361
363
|
module.exports.isValidReferenceName = isValidReferenceName
|
|
@@ -379,6 +381,9 @@ module.exports.revparseModeContains = revparseModeContains
|
|
|
379
381
|
module.exports.RevwalkSort = RevwalkSort
|
|
380
382
|
module.exports.Revwalk = Revwalk
|
|
381
383
|
module.exports.createSignature = createSignature
|
|
384
|
+
module.exports.StashEntry = StashEntry
|
|
385
|
+
module.exports.StashList = StashList
|
|
386
|
+
module.exports.StashListIter = StashListIter
|
|
382
387
|
module.exports.StatusShow = StatusShow
|
|
383
388
|
module.exports.Statuses = Statuses
|
|
384
389
|
module.exports.StatusesIter = StatusesIter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-git",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-next.153+40f6275",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "https://github.com/toss/es-git.git"
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"packageManager": "yarn@4.9.
|
|
16
|
+
"packageManager": "yarn@4.9.2",
|
|
17
17
|
"napi": {
|
|
18
18
|
"name": "es-git",
|
|
19
19
|
"triples": {
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"vitest": "^3.0.5"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"es-git-darwin-x64": "0.
|
|
61
|
-
"es-git-darwin-arm64": "0.
|
|
62
|
-
"es-git-win32-x64-msvc": "0.
|
|
63
|
-
"es-git-win32-arm64-msvc": "0.
|
|
64
|
-
"es-git-linux-x64-gnu": "0.
|
|
65
|
-
"es-git-linux-x64-musl": "0.
|
|
66
|
-
"es-git-android-arm64": "0.
|
|
67
|
-
"es-git-linux-arm64-gnu": "0.
|
|
68
|
-
"es-git-linux-arm64-musl": "0.
|
|
69
|
-
"es-git-android-arm-eabi": "0.
|
|
60
|
+
"es-git-darwin-x64": "0.5.0-next.153+40f6275",
|
|
61
|
+
"es-git-darwin-arm64": "0.5.0-next.153+40f6275",
|
|
62
|
+
"es-git-win32-x64-msvc": "0.5.0-next.153+40f6275",
|
|
63
|
+
"es-git-win32-arm64-msvc": "0.5.0-next.153+40f6275",
|
|
64
|
+
"es-git-linux-x64-gnu": "0.5.0-next.153+40f6275",
|
|
65
|
+
"es-git-linux-x64-musl": "0.5.0-next.153+40f6275",
|
|
66
|
+
"es-git-android-arm64": "0.5.0-next.153+40f6275",
|
|
67
|
+
"es-git-linux-arm64-gnu": "0.5.0-next.153+40f6275",
|
|
68
|
+
"es-git-linux-arm64-musl": "0.5.0-next.153+40f6275",
|
|
69
|
+
"es-git-android-arm-eabi": "0.5.0-next.153+40f6275"
|
|
70
70
|
}
|
|
71
71
|
}
|