Class GitRepository
Helper for git repository
Inheritance
Namespace: BuildSystem.Utils.GitHelper
Assembly: BuildSystem.Utils.dll
Syntax
public sealed class GitRepository : Object
Properties
Branch
Gets the human-friendly name of this reference
Declaration
public string? Branch { get; }
Property Value
Type | Description |
---|---|
string |
CommitSha
Gets the Commit Sha that current branch points to. If the current branch points to the change, returns the parent commit sha
Declaration
public string? CommitSha { get; }
Property Value
Type | Description |
---|---|
string |
Path
Gets the normalized path to the git repository
Declaration
public string? Path { get; }
Property Value
Type | Description |
---|---|
string |
Repo
Git repository wrapper
Declaration
public Repository? Repo { get; }
Property Value
Type | Description |
---|---|
LibGit2Sharp.Repository |
Url
Gets the url to use to communicate with this remote repository
Declaration
public string? Url { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Clone(string, string, CloneOptions?)
Cloning an existing remote repository to a specified path. If a repository at the 'workdirPath' already exists, it will be returned
Declaration
public static GitRepository Clone(string sourceRepo, string workdirPath, CloneOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
string | sourceRepo | URI for the remote repository |
string | workdirPath | Local path to clone into. Path directory must be empty |
LibGit2Sharp.CloneOptions | options | Options to define clone behaviour |
Returns
Type | Description |
---|---|
GitRepository | Helper for git repository |
Get(string)
Exploring an existing git repository
Declaration
public static GitRepository? Get(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path to the git repository to open, can be either the path to the git directory or the path to the working directory |
Returns
Type | Description |
---|---|
GitRepository | Helper for git repository |
GetCommitsSince(string, bool)
Returns a list of commits since the 'commitSha'
Declaration
public Commit[] GetCommitsSince(string commitSha, bool firstParentOnly = false)
Parameters
Type | Name | Description |
---|---|---|
string | commitSha | |
bool | firstParentOnly |
Returns
Type | Description |
---|---|
Commit[] |