forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGitOid.cs
More file actions
39 lines (34 loc) · 1007 Bytes
/
Copy pathGitOid.cs
File metadata and controls
39 lines (34 loc) · 1007 Bytes
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
using System.Runtime.InteropServices;
namespace LibGit2Sharp.Core
{
/// <summary>
/// Represents a unique id in git which is the sha1 hash of this id's content.
/// </summary>
internal struct GitOid
{
/// <summary>
/// Number of bytes in the Id.
/// </summary>
public const int Size = 20;
/// <summary>
/// The raw binary 20 byte Id.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Size)]
public byte[] Id;
public static implicit operator ObjectId(GitOid oid)
{
return new ObjectId(oid);
}
public static implicit operator ObjectId(GitOid? oid)
{
return oid == null ? null : new ObjectId(oid.Value);
}
/// <summary>
/// Static convenience property to return an id (all zeros).
/// </summary>
public static GitOid Empty
{
get { return new GitOid(); }
}
}
}