Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ObjectType.cs « LibGit2Sharp - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b4e007d56e7933cdf373e945e94a876169471aa (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
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));
            }
        }
    }
}