using LibGit2Sharp.Core; namespace LibGit2Sharp { /// /// Provides high level information about a repository. /// public class RepositoryInformation { private readonly Repository repo; /// /// Needed for mocking purposes. /// protected RepositoryInformation() { } internal RepositoryInformation(Repository repo, bool isBare) { this.repo = repo; IsBare = isBare; FilePath path = Proxy.git_repository_path(repo.Handle); FilePath workingDirectoryPath = Proxy.git_repository_workdir(repo.Handle); Path = path.Native; WorkingDirectory = workingDirectoryPath == null ? null : workingDirectoryPath.Native; IsShallow = Proxy.git_repository_is_shallow(repo.Handle); } /// /// Gets the normalized path to the git repository. /// public virtual string Path { get; private set; } /// /// Gets the normalized path to the working directory. /// /// If the repository is bare, null is returned. /// /// public virtual string WorkingDirectory { get; private set; } /// /// Indicates whether the repository has a working directory. /// public virtual bool IsBare { get; private set; } /// /// Indicates whether the repository is shallow (the result of `git clone --depth ...`) /// public virtual bool IsShallow { get; private set; } /// /// Indicates whether the Head points to an arbitrary commit instead of the tip of a local branch. /// public virtual bool IsHeadDetached { get { return Proxy.git_repository_head_detached(repo.Handle); } } /// /// Indicates whether the Head points to a reference which doesn't exist. /// public virtual bool IsHeadUnborn { get { return Proxy.git_repository_head_unborn(repo.Handle); } } /// /// The pending interactive operation. /// public virtual CurrentOperation CurrentOperation { get { return Proxy.git_repository_state(repo.Handle); } } /// /// The message for a pending interactive operation. /// public virtual string Message { get { return Proxy.git_repository_message(repo.Handle); } } } }