Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove Repository.HasObject()

  • Loading branch information...
commit f2216121813678da5e7a51fe069cc202fb4255d8 1 parent 0d3c547
nulltoken nulltoken authored
22 LibGit2Sharp.Tests/RepositoryFixture.cs
View
@@ -268,28 +268,6 @@ public void LookingUpWithBadParamsThrows()
}
[Test]
- public void CanCheckForObjectExistence()
- {
- using (var repo = new Repository(BareTestRepoPath))
- {
- repo.HasObject("8496071c1b46c854b31185ea97743be6a8774479").ShouldBeTrue();
- repo.HasObject("1385f264afb75a56a5bec74243be9b367ba4ca08").ShouldBeTrue();
- repo.HasObject("ce08fe4884650f067bd5703b6a59a8b3b3c99a09").ShouldBeFalse();
- repo.HasObject("8496071c1c46c854b31185ea97743be6a8774479").ShouldBeFalse();
- }
- }
-
- [Test]
- public void CheckingForObjectExistenceWithBadParamsThrows()
- {
- using (var repo = new Repository(BareTestRepoPath))
- {
- Assert.Throws<ArgumentException>(() => repo.HasObject(string.Empty));
- Assert.Throws<ArgumentNullException>(() => repo.HasObject(null));
- }
- }
-
- [Test]
public void CanDiscoverABareRepoGivenTheRepoPath()
{
string path = Repository.Discover(BareTestRepoPath);
11 LibGit2Sharp/Core/DatabaseSafeHandle.cs
View
@@ -1,11 +0,0 @@
-namespace LibGit2Sharp.Core
-{
- internal class DatabaseSafeHandle : SafeHandleBase
- {
- protected override bool ReleaseHandle()
- {
- NativeMethods.git_odb_free(handle);
- return true;
- }
- }
-}
10 LibGit2Sharp/Core/NativeMethods.cs
View
@@ -180,13 +180,6 @@ static NativeMethods()
public static extern GitObjectType git_object_type(IntPtr obj);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool git_odb_exists(DatabaseSafeHandle db, ref GitOid id);
-
- [DllImport(libgit2)]
- public static extern void git_odb_free(IntPtr obj);
-
- [DllImport(libgit2)]
public static extern int git_oid_cmp(ref GitOid a, ref GitOid b);
[DllImport(libgit2)]
@@ -267,9 +260,6 @@ static NativeMethods()
RepositorySafeHandle repo);
[DllImport(libgit2)]
- public static extern int git_repository_odb(out DatabaseSafeHandle odb, RepositorySafeHandle repository);
-
- [DllImport(libgit2)]
public static extern int git_repository_discover(
byte[] repository_path, // NB: This is more properly a StringBuilder, but it's UTF8
int size,
1  LibGit2Sharp/LibGit2Sharp.csproj
View
@@ -53,7 +53,6 @@
<Compile Include="Configuration.cs" />
<Compile Include="ConfigurationLevel.cs" />
<Compile Include="Core\Compat\Tuple.cs" />
- <Compile Include="Core\DatabaseSafeHandle.cs" />
<Compile Include="Core\EnumExtensions.cs" />
<Compile Include="DetachedHead.cs" />
<Compile Include="LibGit2Exception.cs" />
24 LibGit2Sharp/Repository.cs
View
@@ -164,30 +164,6 @@ protected virtual void Dispose(bool disposing)
#endregion
- ///<summary>
- /// Tells if the specified sha exists in the repository.
- ///
- /// Exceptions:
- /// ArgumentException
- /// ArgumentNullException
- ///</summary>
- ///<param name = "sha">The sha.</param>
- ///<returns></returns>
- [Obsolete]
- public bool HasObject(string sha) //TODO: To be removed from front facing API (maybe should we create an Repository.Advanced to hold those kind of functions)?
- {
- var id = new ObjectId(sha);
-
- DatabaseSafeHandle odb;
- Ensure.Success(NativeMethods.git_repository_odb(out odb, handle));
-
- using(odb)
- {
- GitOid oid = id.Oid;
- return NativeMethods.git_odb_exists(odb, ref oid);
- }
- }
-
/// <summary>
/// Init a repo at the specified <paramref name = "path" />.
/// </summary>
Please sign in to comment.
Something went wrong with that request. Please try again.