Fix #6813: Allow git.GetTree to take both commit and tree names (#6816)

* Allow git.GetTree to take both commit and tree names, return full paths on entries listed through Tree.ListEntriesRecursive

Signed-off-by: Filip Navara <filip.navara@gmail.com>

* Fix the SHA returned on Git Tree APIs called with commit hash or symbolic name

Signed-off-by: Filip Navara <filip.navara@gmail.com>
This commit is contained in:
Filip Navara
2019-05-03 02:33:11 +02:00
committed by techknowlogick
parent a27d5d2b23
commit dbb0c9658c
4 changed files with 18 additions and 12 deletions

View File

@ -23,7 +23,7 @@ func GetTreeBySHA(repo *models.Repository, sha string, page, perPage int, recurs
}
}
tree := new(api.GitTreeResponse)
tree.SHA = gitTree.CommitID.String()
tree.SHA = gitTree.ResolvedID.String()
tree.URL = repo.APIURL() + "/git/trees/" + tree.SHA
var entries git.Entries
if recursive {