Class Repository
The representation of a Git repository, including its objects, references and the methods that operate on it.
Inherited Members
Namespace: Dogged
Assembly: Dogged.dll
Syntax
public class Repository : NativeDisposable
Properties
| Improve this Doc View SourceHead
Retrieve and resolve the reference pointed to by HEAD
.
The repository HEAD will be peeled to a direct reference.
Declaration
public DirectReference Head { get; }
Property Value
Type | Description |
---|---|
DirectReference |
HeadCommit
Get the commit pointed to by HEAD.
Declaration
public Commit HeadCommit { get; }
Property Value
Type | Description |
---|---|
Commit |
Index
Describes the repository's index.
Declaration
public Index Index { get; }
Property Value
Type | Description |
---|---|
Index |
IsBare
Indicates whether the specified repository is bare.
Declaration
public bool IsBare { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsHeadDetached
Indicates whether the HEAD is detached, meaning it points directly at an object id instead of a branch.
Declaration
public bool IsHeadDetached { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ObjectDatabase
Declaration
public ObjectDatabase ObjectDatabase { get; set; }
Property Value
Type | Description |
---|---|
ObjectDatabase |
Objects
An accessor for Git objects.
Declaration
public ObjectCollection Objects { get; }
Property Value
Type | Description |
---|---|
ObjectCollection |
Path
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
System.String |
References
An accessor for references.
Declaration
public ReferenceCollection References { get; }
Property Value
Type | Description |
---|---|
ReferenceCollection |
Workdir
Declaration
public string Workdir { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceClone(String, String)
Clone a remote repository.
Declaration
public static Repository Clone(string remotePath, string localPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | remotePath | The remote repository to clone |
System.String | localPath | The local path to clone to |
Returns
Type | Description |
---|---|
Repository | The newly cloned repository |
CreateCustomRepository()
Create a custom repository that is not bound to an on-disk repository or working directory. To use it, you can can configure custom backends.
Declaration
public static Repository CreateCustomRepository()
Returns
Type | Description |
---|---|
Repository | The newly created repository |
Discover(String, Boolean)
Discover the git repository that the given path is beneath. Walks up parent paths until the repository working directory is found and returns the Repository.
Declaration
public static string Discover(string path, bool acrossFilesystems = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to start discovery at. |
System.Boolean | acrossFilesystems | Whether to traverse filesystem boundaries (false by default) |
Returns
Type | Description |
---|---|
System.String | The newly repository, or null if none was discovered |
Init(String, Boolean)
Creates a new Git repository in the given folder.
Declaration
public static Repository Init(string path, bool bare = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to the repository |
System.Boolean | bare | If true, a Git repository without a working directory is created at the given path. If false, the provided path will be considered as the working directory into which the .git directory will be created. |
Returns
Type | Description |
---|---|
Repository | The newly initialized repository |
Open(String)
Opens the Git repository at the given path
.
This can be either a path to the repository's working tree,
or to the actual repository folder (the ".git" folder beneath
a working directory or a bare repository).
Declaration
public static Repository Open(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to the repository or a repository's working tree. |
Returns
Type | Description |
---|---|
Repository | The repository |