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

AbbreviatedObjectId.cs « libgit2sharp - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cda1261688c9674586731c61b1f07883b3ab8586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using LibGit2Sharp.Core;

namespace LibGit2Sharp
{
    internal class AbbreviatedObjectId : ObjectId
    {
        internal AbbreviatedObjectId(GitOid oid, int length) : base(oid)
        {
            if (length < MinHexSize || length > HexSize)
            {
                throw new ArgumentException(string.Format("Expected length should be comprised between {0} and {1}.", MinHexSize, HexSize), "length");
            }

            Length = length;
        }

        public int Length { get; private set; }

        public override string Sha { get { return base.Sha.Substring(0, Length); } }
    }
}