forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectType.cs
55 lines (46 loc) · 1.27 KB
/
ObjectType.cs
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using LibGit2Sharp.Core;
namespace LibGit2Sharp
{
/// <summary>
/// Underlying type of a <see cref="GitObject"/>
/// </summary>
public enum ObjectType
{
/// <summary>
/// A commit object.
/// </summary>
Commit = 1,
/// <summary>
/// A tree (directory listing) object.
/// </summary>
Tree = 2,
/// <summary>
/// A file revision object.
/// </summary>
Blob = 3,
/// <summary>
/// An annotated tag object.
/// </summary>
Tag = 4,
}
internal static class ObjectTypeExtensions
{
public static GitObjectType ToGitObjectType(this ObjectType type)
{
switch (type)
{
case ObjectType.Commit:
return GitObjectType.Commit;
case ObjectType.Tree:
return GitObjectType.Tree;
case ObjectType.Blob:
return GitObjectType.Blob;
case ObjectType.Tag:
return GitObjectType.Tag;
default:
throw new InvalidOperationException(string.Format("Cannot map {0} to a GitObjectType.", type));
}
}
}
}