diff options
Diffstat (limited to 'vendor/code.gitea.io/git/repo_tree.go')
-rw-r--r-- | vendor/code.gitea.io/git/repo_tree.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/code.gitea.io/git/repo_tree.go b/vendor/code.gitea.io/git/repo_tree.go index 6e3843f7e5..146b919d7a 100644 --- a/vendor/code.gitea.io/git/repo_tree.go +++ b/vendor/code.gitea.io/git/repo_tree.go @@ -18,6 +18,15 @@ func (repo *Repository) getTree(id SHA1) (*Tree, error) { // GetTree find the tree object in the repository. func (repo *Repository) GetTree(idStr string) (*Tree, error) { + if len(idStr) != 40 { + res, err := NewCommand("rev-parse", idStr).RunInDir(repo.Path) + if err != nil { + return nil, err; + } + if len(res) > 0 { + idStr = res[:len(res)-1] + } + } id, err := NewIDFromString(idStr) if err != nil { return nil, err |