GitSharp.Core.Repository.MapCommit C# (CSharp) Method

MapCommit() public method

Access a Commit by SHA'1 id.
public MapCommit ( ObjectId id ) : Commit
id ObjectId
return Commit
        public Commit MapCommit(ObjectId id)
        {
            ObjectLoader or = OpenObject(id);
            if (or == null)
            {
                return null;
            }

            byte[] raw = or.Bytes;
            if (Constants.OBJ_COMMIT == or.Type)
            {
                return new Commit(this, id, raw);
            }

            throw new IncorrectObjectTypeException(id, ObjectType.Commit);
        }

Same methods

Repository::MapCommit ( string resolveString ) : Commit

Usage Example

        public void Refresh()
        {
            cache.Clear();
            if (!string.IsNullOrEmpty(initFolder))
            {
                try
                {
                    this.repository = Repository.Open(initFolder);

                    if (this.repository != null)
                    {
                        var id = repository.Resolve("HEAD");
                        var commit = repository.MapCommit(id);
                        this.commitTree = (commit != null ? commit.TreeEntry : new Tree(repository));
                        this.index = repository.Index;
                        this.index.RereadIfNecessary();
                        //this.ignoreHandler = new IgnoreHandler(repository);
                        //this.watcher = new FileSystemWatcher(this.repository.WorkingDirectory.FullName);
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
All Usage Examples Of GitSharp.Core.Repository::MapCommit