C# Class LibGit2Sharp.Repository

A Repository is the primary interface into a git repository
Inheritance: IDisposable
Exibir arquivo Open project: tclem/libgit2sharp Class Usage Examples

Private Properties

Property Type Description
IsReferencePeelable bool

Public Methods

Method Description
Discover ( string startingPath ) : string

Probe for a git repository.

The lookup start from startingPath and walk upward parent directories if nothing has been found.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

HasObject ( string sha ) : bool

Tells if the specified sha exists in the repository. Exceptions: ArgumentException ArgumentNullException

Init ( string path, bool isBare = false ) : string

Init a repo at the specified path.

Lookup ( ObjectId id, GitObjectType type = GitObjectType.Any ) : GitObject

Try to lookup an object by its ObjectId and GitObjectType. If no matching object is found, null will be returned.

Lookup ( string shaOrReferenceName, GitObjectType type = GitObjectType.Any ) : GitObject

Try to lookup an object by its sha or a reference canonical name and GitObjectType. If no matching object is found, null will be returned.

Repository ( string path ) : System

Initializes a new instance of the Repository class.

For a standard repository, path should point to the ".git" folder. For a bare repository, path should directly point to the repository folder.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Private Methods

Method Description
IsReferencePeelable ( System.Reference reference ) : bool

Method Details

Discover() public static method

Probe for a git repository.

The lookup start from startingPath and walk upward parent directories if nothing has been found.

public static Discover ( string startingPath ) : string
startingPath string The base path where the lookup starts.
return string

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
protected Dispose ( bool disposing ) : void
disposing bool
return void

HasObject() public method

Tells if the specified sha exists in the repository. Exceptions: ArgumentException ArgumentNullException
public HasObject ( string sha ) : bool
sha string The sha.
return bool

Init() public static method

Init a repo at the specified path.
public static Init ( string path, bool isBare = false ) : string
path string The path to the working folder when initializing a standard ".git" repository. Otherwise, when initializing a bare repository, the path to the expected location of this later.
isBare bool true to initialize a bare repository. False otherwise, to initialize a standard ".git" repository.
return string

Lookup() public method

Try to lookup an object by its ObjectId and GitObjectType. If no matching object is found, null will be returned.
public Lookup ( ObjectId id, GitObjectType type = GitObjectType.Any ) : GitObject
id ObjectId The id to lookup.
type GitObjectType The kind of GitObject being looked up
return GitObject

Lookup() public method

Try to lookup an object by its sha or a reference canonical name and GitObjectType. If no matching object is found, null will be returned.
public Lookup ( string shaOrReferenceName, GitObjectType type = GitObjectType.Any ) : GitObject
shaOrReferenceName string The sha or reference canonical name to lookup.
type GitObjectType The kind of being looked up
return GitObject

Repository() public method

Initializes a new instance of the Repository class.

For a standard repository, path should point to the ".git" folder. For a bare repository, path should directly point to the repository folder.

public Repository ( string path ) : System
path string The path to the git repository to open.
return System