Class Commits
Functions to manipulate Git commits.
[CompilationMapping(SourceConstructFlags.Module)]
public static class Commits
- Inheritance
-
Commits
- Inherited Members
Methods
ReadCommit(PackIndex, LocalPath, Sha1Hash)
Reads a commit with specified hash
.
public static Task<Commit> ReadCommit(PackIndex index, LocalPath gitDirectory, Sha1Hash hash)
Parameters
index
PackIndexPack file index of the repository.
gitDirectory
LocalPathPath to the
.git
directory.hash
Sha1HashCommit hash.
Returns
ReadCommitBody(Stream)
Reads the commit body from a stream.
public static CommitBody ReadCommitBody(Stream decodedInput)
Parameters
decodedInput
Stream
Returns
TraverseCommits(LocalPath, Sha1Hash)
Starting with commit headCommitHash
, will enumerate all its parents. The enumeration order
between commits not related via parent-child relationship is unspecified, but any commit is guaranteed to be
returned before any of its parents.
public static IAsyncEnumerable<Commit> TraverseCommits(LocalPath gitDirectory, Sha1Hash headCommitHash)
Parameters
gitDirectory
LocalPathPath to the
.git
directory.headCommitHash
Sha1HashHash of the starting commit.
Returns
WriteCommitBody(CommitBody, Stream)
Writes the commit body's internal representation as a Git object to a passed stream.
public static void WriteCommitBody(CommitBody commit, Stream stream)
Parameters
commit
CommitBodystream
Stream