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

TreeEntryTargetType.cs « LibGit2Sharp - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a4e54d73a18148dac5637bb969b266e8443cdc90 (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
using System;
using System.Globalization;
using LibGit2Sharp.Core;

namespace LibGit2Sharp
{
    /// <summary>
    /// Underlying type of the target a <see cref="TreeEntry"/>
    /// </summary>
    public enum TreeEntryTargetType
    {
        /// <summary>
        /// A file revision object.
        /// </summary>
        Blob,

        /// <summary>
        /// A tree object.
        /// </summary>
        Tree,

        /// <summary>
        /// A pointer to a commit object in another repository.
        /// </summary>
        GitLink,
    }

    internal static class TreeEntryTargetTypeExtensions
    {
        public static GitObjectType ToGitObjectType(this TreeEntryTargetType type)
        {
            switch (type)
            {
                case TreeEntryTargetType.Tree:
                    return GitObjectType.Tree;

                case TreeEntryTargetType.Blob:
                    return GitObjectType.Blob;

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