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

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

namespace LibGit2Sharp
{
    /// <summary>
    /// Represents a local reference data from a remote repository which
    /// has been retreived through a Fetch process.
    /// </summary>
    internal class FetchHead : ReferenceWrapper<GitObject>
    {
        /// <summary>
        /// Needed for mocking purposes.
        /// </summary>
        protected FetchHead()
        { }

        internal FetchHead(Repository repo, string remoteCanonicalName,
            string url, ObjectId targetId, bool forMerge, int index)
            : base(repo, new DirectReference(
                string.Format(CultureInfo.InvariantCulture, "FETCH_HEAD[{0}]", index),
                repo, targetId), r => r.CanonicalName)
        {
            Url = url;
            ForMerge = forMerge;
            RemoteCanonicalName = remoteCanonicalName;
        }

        /// <summary>
        /// Returns "FETCH_HEAD[i]", where i is the index of this fetch head.
        /// </summary>
        protected override string Shorten()
        {
            return CanonicalName;
        }

        /// <summary>
        /// Gets the canonical name of the reference this <see cref="FetchHead"/>
        /// points to in the remote repository it's been fetched from.
        /// </summary>
        public virtual string RemoteCanonicalName { get; private set; }

        /// <summary>
        /// Gets the <see cref="GitObject"/> that this fetch head points to.
        /// </summary>
        public virtual GitObject Target
        {
            get { return TargetObject; }
        }

        /// <summary>
        /// The URL of the remote repository this <see cref="FetchHead"/>
        /// has been built from.
        /// </summary>
        public virtual String Url { get; private set; }

        /// <summary>
        /// Determines if this fetch head entry has been explicitly fetched.
        /// </summary>
        public virtual bool ForMerge { get; private set; }
    }
}