Class Refs
Functions to operate on Git references.
[CompilationMapping(SourceConstructFlags.Module)]
public static class Refs
- Inheritance
-
Refs
- Inherited Members
Methods
IsHeadDetached(LocalPath)
Determines if the repository is in the detached head state.
public static bool IsHeadDetached(LocalPath gitDirectory)
Parameters
gitDirectory
LocalPathPath to the
.git
directory.
Returns
ReadHead(LocalPath)
Reads a reference from the HEAD
file in the repository.
public static Task<Ref?> ReadHead(LocalPath gitDirectory)
Parameters
gitDirectory
LocalPathPath to the repository's
.git
directory.
Returns
ReadRefs(LocalPath)
Reads the list of references available in a repository.
public static IEnumerable<Ref> ReadRefs(LocalPath repositoryPath)
Parameters
repositoryPath
LocalPathPath to a repository's
.git
directory.
Returns
Remarks
This function supports both packed and unpacked refs.
UpdateAllRefs(Sha1Hash, Sha1Hash, LocalPath)
Update all refs pointing to the specified commit to point to the new commit.
public static void UpdateAllRefs(Sha1Hash oldCommit, Sha1Hash newCommit, LocalPath gitDirectory)
Parameters
oldCommit
Sha1HashOld commit to update from.
newCommit
Sha1HashNew commit to update to.
gitDirectory
LocalPathPath to the
.git
directory.
UpdateHead(Sha1Hash, Sha1Hash, LocalPath)
Update the HEAD
all reference to point to the new commit if it points to the old commit.
public static void UpdateHead(Sha1Hash oldCommit, Sha1Hash newCommit, LocalPath gitDirectory)