diff options
author | Filip Navara <filip.navara@gmail.com> | 2019-05-03 02:33:11 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-05-02 20:33:11 -0400 |
commit | dbb0c9658c637bb987ec7d09a43be5ace5ac6708 (patch) | |
tree | d96905eee793b8bd323f942db7b5f361177221b6 /modules/git/tree.go | |
parent | a27d5d2b230e7b63a4b1959991d8b638527f48c6 (diff) | |
download | gitea-dbb0c9658c637bb987ec7d09a43be5ace5ac6708.tar.gz gitea-dbb0c9658c637bb987ec7d09a43be5ace5ac6708.zip |
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>
Diffstat (limited to 'modules/git/tree.go')
-rw-r--r-- | modules/git/tree.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/git/tree.go b/modules/git/tree.go index 8f55d7a8c5..6ca893cb7b 100644 --- a/modules/git/tree.go +++ b/modules/git/tree.go @@ -15,9 +15,9 @@ import ( // Tree represents a flat directory listing. type Tree struct { - ID SHA1 - CommitID SHA1 - repo *Repository + ID SHA1 + ResolvedID SHA1 + repo *Repository gogitTree *object.Tree @@ -106,7 +106,7 @@ func (t *Tree) ListEntriesRecursive() (Entries, error) { seen := map[plumbing.Hash]bool{} walker := object.NewTreeWalker(t.gogitTree, true, seen) for { - _, entry, err := walker.Next() + fullName, entry, err := walker.Next() if err == io.EOF { break } @@ -121,6 +121,7 @@ func (t *Tree) ListEntriesRecursive() (Entries, error) { ID: entry.Hash, gogitTreeEntry: &entry, ptree: t, + fullName: fullName, } entries = append(entries, convertedEntry) } |