Table of Contents

Class Refs

Namespace
Fenrir.Git
Assembly
Fenrir.Git.dll

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 LocalPath

Path to the .git directory.

Returns

bool

ReadHead(LocalPath)

Reads a reference from the HEAD file in the repository.

public static Task<Ref?> ReadHead(LocalPath gitDirectory)

Parameters

gitDirectory LocalPath

Path to the repository's .git directory.

Returns

Task<Ref>

Reference if it's resolved, null if the HEAD file doesn't exist.

ReadRefs(LocalPath)

Reads the list of references available in a repository.

public static IEnumerable<Ref> ReadRefs(LocalPath repositoryPath)

Parameters

repositoryPath LocalPath

Path to a repository's .git directory.

Returns

IEnumerable<Ref>

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 Sha1Hash

Old commit to update from.

newCommit Sha1Hash

New commit to update to.

gitDirectory LocalPath

Path to the .git directory.

UpdateHead(Sha1Hash, Sha1Hash, LocalPath)

Update the HEADall reference to point to the new commit if it points to the old commit.

public static void UpdateHead(Sha1Hash oldCommit, Sha1Hash newCommit, LocalPath gitDirectory)

Parameters

oldCommit Sha1Hash

Old commit to update from.

newCommit Sha1Hash

New commit to update to.

gitDirectory LocalPath

Path to the .git directory.