diff options
Diffstat (limited to 'modules/git/repo_tree.go')
-rw-r--r-- | modules/git/repo_tree.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/git/repo_tree.go b/modules/git/repo_tree.go index 8a024fe6ac..8bb7291744 100644 --- a/modules/git/repo_tree.go +++ b/modules/git/repo_tree.go @@ -35,14 +35,15 @@ func (repo *Repository) GetTree(idStr string) (*Tree, error) { if err != nil { return nil, err } + resolvedID := id commitObject, err := repo.gogitRepo.CommitObject(plumbing.Hash(id)) - if err != nil { - return nil, err + if err == nil { + id = SHA1(commitObject.TreeHash) } - treeObject, err := repo.getTree(SHA1(commitObject.TreeHash)) + treeObject, err := repo.getTree(id) if err != nil { return nil, err } - treeObject.CommitID = id + treeObject.ResolvedID = resolvedID return treeObject, nil } |