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

GitObjectType.cs « LibGit2Sharp - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2b03cb5e684c7a908a34bf3be8b7717e0480605f (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;

namespace LibGit2Sharp
{
    /// <summary>
    ///   Underlying type of a <see cref = "GitObject" />
    /// </summary>
    public enum GitObjectType
    {
        /// <summary>
        ///   Object can be of any type.
        /// </summary>
        Any = -2,

        /// <summary>
        ///   Object is invalid.
        /// </summary>
        Bad = -1,

        /// <summary>
        ///   Reserved for future use.
        /// </summary>
        Ext1 = 0,

        /// <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,

        /// <summary>
        ///   Reserved for future use.
        /// </summary>
        Ext2 = 5,

        /// <summary>
        ///   A delta, base is given by an offset.
        /// </summary>
        OfsDelta = 6,

        /// <summary>
        ///   A delta, base is given by object id.
        /// </summary>
        RefDelta = 7
    }

    internal static class GitObjectTypeExtensions
    {
        public static TreeEntryTargetType ToTreeEntryTargetType(this GitObjectType type)
        {
            switch (type)
            {
                case GitObjectType.Commit:
                    return TreeEntryTargetType.GitLink;

                case GitObjectType.Tree:
                    return TreeEntryTargetType.Tree;

                case GitObjectType.Blob:
                    return TreeEntryTargetType.Blob;

                default:
                    throw new InvalidOperationException(string.Format("Cannot map {0} to a TreeEntryTargetType.", type));
            }
        }
    }
}