GitSharp.Core.BlobBasedConfig.BlobBasedConfig C# (CSharp) Method

BlobBasedConfig() public method

The constructor from commit and path
/// the path does not exist in the commit's tree. /// /// the tree and/or blob cannot be accessed. /// /// the blob is not a valid configuration format. ///
public BlobBasedConfig ( Config @base, Commit commit, string path ) : System.IO
@base Config
commit Commit The commit that contains the object
path string The path within the tree of the commit
return System.IO
        public BlobBasedConfig(Config @base, Commit commit, string path)
            : base(@base)
        {
            ObjectId treeId = commit.TreeId;
            Repository r = commit.Repository;
            TreeWalk.TreeWalk tree = TreeWalk.TreeWalk.ForPath(r, path, treeId);
            if (tree == null)
            {
                throw new FileNotFoundException("Entry not found by path: " + path);
            }
            ObjectId blobId = tree.getObjectId(0);
            ObjectLoader loader = tree.Repository.OpenBlob(blobId);

            if (loader == null)
            {
                throw new IOException("Blob not found: " + blobId + " for path: " + path);
            }

            fromText(RawParseUtils.decode(loader.Bytes));
        }

Same methods

BlobBasedConfig::BlobBasedConfig ( Config @base, Repository r, ObjectId objectid ) : System.IO
BlobBasedConfig::BlobBasedConfig ( Config @base, byte blob ) : System.IO
BlobBasedConfig