diff options
author | nulltoken <emeric.fermas@gmail.com> | 2011-06-27 12:46:17 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2011-06-27 21:38:18 +0400 |
commit | 7b7a4abe1fee6266f6e8574d0d07c0219570f90c (patch) | |
tree | 57c551b1cf5ea98a82c3ead29f4be991f1a49fcd /LibGit2Sharp/RepositoryInformation.cs | |
parent | c0013852416b2848be1e4900c7b508eb877173f2 (diff) |
Fix Repository.IsEmpty implementation
This should fix issue #52.
Diffstat (limited to 'LibGit2Sharp/RepositoryInformation.cs')
-rw-r--r-- | LibGit2Sharp/RepositoryInformation.cs | 14 |
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> |