Example #1
0
 internal GitDirectoryTreeEntry(GitTree tree, string name, GitTreeElementType mask, GitId item) : base(tree, name, item)
 {
     ElementType = mask;
 }
Example #2
0
        internal static async ValueTask <GitObject> FromBucketAsync(GitRepository repository, GitObjectBucket rdr, GitId id, GitObjectType type = GitObjectType.None)
        {
            GitObjectType tp;

            if (type == GitObjectType.None)
            {
                tp = await rdr.ReadTypeAsync().ConfigureAwait(false);
            }
            else
            {
                tp = type;
            }

            switch (tp)
            {
            case GitObjectType.Commit:
                return(new GitCommit(repository, rdr, id));

            case GitObjectType.Tree:
                return(new GitTree(repository, rdr, id));

            case GitObjectType.Blob:
                return(new GitBlob(repository, rdr, id));

            case GitObjectType.Tag:
                return(new GitTagObject(repository, rdr, id));

            default:
                throw new ArgumentOutOfRangeException(nameof(type));
            }
        }
Example #3
0
 internal GitTreeEntry(GitTree tree, string name, GitId id)
 {
     InTree = tree ?? throw new ArgumentNullException(nameof(tree));
     Name   = name ?? throw new ArgumentNullException(nameof(name));
     Id     = id ?? throw new ArgumentNullException(nameof(id));
 }
Example #4
0
 private protected GitObject(GitRepository repository, GitId id)
 {
     Repository = repository ?? throw new ArgumentNullException(nameof(repository));
     Id         = id ?? throw new ArgumentNullException(nameof(id));
 }
Example #5
0
 internal GitBlob(GitRepository repository, GitBucket rdr, GitId id)
     : base(repository, id)
 {
     _rdr = rdr;
 }
Example #6
0
 /// <summary>
 /// Return length of this hash in bytes
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 /// <exception cref="ArgumentOutOfRangeException"></exception>
 public static int HashLength(this GitIdType type)
 {
     return(GitId.HashLength(type));
 }
Example #7
0
 internal GitCommit(GitRepository repository, GitObjectBucket objectReader, GitId id)
     : base(repository, id)
 {
     _rb = new GitCommitObjectBucket(objectReader);
 }
Example #8
0
 internal GitTagObject(GitRepository repository, GitObjectBucket rdr, GitId id)
     : base(repository, id)
 {
     _rb = new GitTagObjectBucket(rdr);
 }