@@ -1715,6 +1715,45 @@ export interface CreateLightweightTagOptions {
1715
1715
* - `PostOrder` : Runs the traversal in post-order.
1716
1716
*/
1717
1717
export type TreeWalkMode = 'PreOrder' | 'PostOrder' ;
1718
+ /**
1719
+ * A structure to represent an annotated commit, the input to merge and rebase.
1720
+ *
1721
+ * An annotated commit contains information about how it was looked up, which
1722
+ * may be useful for functions like merge or rebase to provide context to the
1723
+ * operation.
1724
+ */
1725
+ export declare class AnnotatedCommit {
1726
+ /**
1727
+ * Gets the commit ID that the given Annotated Commit refers to.
1728
+ *
1729
+ * @category AnnotatedCommit/Methods
1730
+ * @signature
1731
+ * ```ts
1732
+ * class AnnotatedCommit {
1733
+ * id(): string;
1734
+ * }
1735
+ * ```
1736
+ *
1737
+ * @returns The commit ID that this Annotated Commit refers to.
1738
+ */
1739
+ id ( ) : string
1740
+ /**
1741
+ * Get the refname that the given Annotated Commit refers to.
1742
+ *
1743
+ * @category AnnotatedCommit/Methods
1744
+ * @signature
1745
+ * ```ts
1746
+ * class AnnotatedCommit {
1747
+ * refname(): string | null;
1748
+ * }
1749
+ * ```
1750
+ *
1751
+ * @returns The refname that this Annotated Commit refers to. If this created from a reference,
1752
+ * the return value is `null`.
1753
+ * @throws Throws error if the refname is not valid utf-8.
1754
+ */
1755
+ refname ( ) : string | null
1756
+ }
1718
1757
/** A wrapper around git2::Blame providing Node.js bindings */
1719
1758
export declare class Blame {
1720
1759
/**
@@ -3931,6 +3970,57 @@ export declare class Remote {
3931
3970
* This class corresponds to a git repository in libgit2.
3932
3971
*/
3933
3972
export declare class Repository {
3973
+ /**
3974
+ * Creates an Annotated Commit from the given commit.
3975
+ *
3976
+ * @category Repository/Methods
3977
+ * @signature
3978
+ * ```ts
3979
+ * class Repository {
3980
+ * getAnnotatedCommit(commit: Commit): AnnotatedCommit;
3981
+ * }
3982
+ * ```
3983
+ *
3984
+ * @param {Commit } commit - Commit to creates a Annotated Commit.
3985
+ * @returns An Annotated Commit created from commit.
3986
+ */
3987
+ getAnnotatedCommit ( commit : Commit ) : AnnotatedCommit
3988
+ /**
3989
+ * Creates a Annotated Commit from the given reference.
3990
+ *
3991
+ * @category Repository/Methods
3992
+ * @signature
3993
+ * ```ts
3994
+ * class Repository {
3995
+ * getAnnotatedCommitFromReference(reference: Reference): AnnotatedCommit;
3996
+ * }
3997
+ * ```
3998
+ *
3999
+ * @param {Reference } reference - Reference to creates a Annotated Commit.
4000
+ * @returns An Annotated Commit created from reference.
4001
+ */
4002
+ getAnnotatedCommitFromReference ( reference : GitReference ) : AnnotatedCommit
4003
+ /**
4004
+ * Creates a Annotated Commit from `FETCH_HEAD`.
4005
+ *
4006
+ * @category Repository/Methods
4007
+ * @signature
4008
+ * ```ts
4009
+ * class Repository {
4010
+ * getAnnotatedCommitFromFetchHead(
4011
+ * branchName: string,
4012
+ * remoteUrl: string,
4013
+ * id: string,
4014
+ * ): AnnotatedCommit;
4015
+ * }
4016
+ * ```
4017
+ *
4018
+ * @param {String } branchName - Name of the remote branch.
4019
+ * @param {String } remoteUrl - Url of the remote.
4020
+ * @param {String } id - The commit object id of the remote branch.
4021
+ * @returns An Annotated Commit created from `FETCH_HEAD`.
4022
+ */
4023
+ getAnnotatedCommitFromFetchHead ( branchName : string , remoteUrl : string , id : string ) : AnnotatedCommit
3934
4024
/**
3935
4025
* Creates a blame object for the file at the given path
3936
4026
*
@@ -4701,6 +4791,64 @@ export declare class Repository {
4701
4791
* @param {string } refname - Specified reference to point into `HEAD`.
4702
4792
*/
4703
4793
setHead ( refname : string ) : void
4794
+ /**
4795
+ * Determines whether the repository `HEAD` is detached.
4796
+ *
4797
+ * @category Repository/Methods
4798
+ * @signature
4799
+ * ```ts
4800
+ * class Repository {
4801
+ * headDetached(): boolean;
4802
+ * }
4803
+ * ```
4804
+ *
4805
+ * @returns Returns `true` if the repository `HEAD` is detached.
4806
+ */
4807
+ headDetached ( ) : boolean
4808
+ /**
4809
+ * Make the repository HEAD directly point to the commit.
4810
+ *
4811
+ * If the provided commitish cannot be found in the repository, the HEAD
4812
+ * is unaltered and an error is returned.
4813
+ *
4814
+ * If the provided commitish cannot be peeled into a commit, the HEAD is
4815
+ * unaltered and an error is returned.
4816
+ *
4817
+ * Otherwise, the HEAD will eventually be detached and will directly point
4818
+ * to the peeled commit.
4819
+ *
4820
+ * @category Repository/Methods
4821
+ * @signature
4822
+ * ```ts
4823
+ * class Repository {
4824
+ * setHeadDetached(commitish: Commit): void;
4825
+ * }
4826
+ * ```
4827
+ *
4828
+ * @param {Commit } commitish - A Commit which the HEAD should point to.
4829
+ */
4830
+ setHeadDetached ( commit : Commit ) : void
4831
+ /**
4832
+ * Make the repository HEAD directly point to the commit.
4833
+ *
4834
+ * If the provided commitish cannot be found in the repository, the HEAD
4835
+ * is unaltered and an error is returned.
4836
+ * If the provided commitish cannot be peeled into a commit, the HEAD is
4837
+ * unaltered and an error is returned.
4838
+ * Otherwise, the HEAD will eventually be detached and will directly point
4839
+ * to the peeled commit.
4840
+ *
4841
+ * @category Repository/Methods
4842
+ * @signature
4843
+ * ```ts
4844
+ * class Repository {
4845
+ * setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): void;
4846
+ * }
4847
+ * ```
4848
+ *
4849
+ * @param {AnnotatedCommit } commitish - An Annotated Commit which the HEAD should point to.
4850
+ */
4851
+ setHeadDetachedFromAnnotated ( commitish : AnnotatedCommit ) : void
4704
4852
/**
4705
4853
* Extract a signature from an object identified by its ID.
4706
4854
*
0 commit comments