blob: e7f610772d0cde2af8e11c38a5e042db769dbc18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System;
using LibGit2Sharp.Core.Handles;
namespace LibGit2Sharp.Core
{
internal class ObjectSafeWrapper : IDisposable
{
private readonly GitObjectSafeHandle objectPtr;
public ObjectSafeWrapper(ObjectId id, RepositorySafeHandle handle, bool allowNullObjectId = false)
{
Ensure.ArgumentNotNull(handle, "handle");
if (allowNullObjectId && id == null)
{
objectPtr = new NullGitObjectSafeHandle();
}
else
{
Ensure.ArgumentNotNull(id, "id");
objectPtr = Proxy.git_object_lookup(handle, id, GitObjectType.Any);
}
}
public GitObjectSafeHandle ObjectPtr
{
get { return objectPtr; }
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
objectPtr.SafeDispose();
}
}
}
|