Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2011-06-27 12:46:17 +0400
committernulltoken <emeric.fermas@gmail.com>2011-06-27 21:38:18 +0400
commit7b7a4abe1fee6266f6e8574d0d07c0219570f90c (patch)
tree57c551b1cf5ea98a82c3ead29f4be991f1a49fcd /LibGit2Sharp/RepositoryInformation.cs
parentc0013852416b2848be1e4900c7b508eb877173f2 (diff)
Fix Repository.IsEmpty implementation
This should fix issue #52.
Diffstat (limited to 'LibGit2Sharp/RepositoryInformation.cs')
-rw-r--r--LibGit2Sharp/RepositoryInformation.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/LibGit2Sharp/RepositoryInformation.cs b/LibGit2Sharp/RepositoryInformation.cs
index 5d6baf55..2be3d62d 100644
--- a/LibGit2Sharp/RepositoryInformation.cs
+++ b/LibGit2Sharp/RepositoryInformation.cs
@@ -47,7 +47,19 @@ namespace LibGit2Sharp
/// </value>
public bool IsEmpty
{
- get { return NativeMethods.git_repository_is_empty(repo.Handle); }
+ get
+ {
+ //TODO: Remove this once git_repository_is_empty() accepts detached head state
+ if (repo.Refs["HEAD"] is DirectReference)
+ {
+ return false;
+ }
+
+ var res = NativeMethods.git_repository_is_empty(repo.Handle);
+ Ensure.Success(res, true);
+
+ return (res == 1);
+ }
}
/// <summary>