forked from forgejo/forgejo
* 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:
parent
a27d5d2b23
commit
dbb0c9658c
4 changed files with 18 additions and 12 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue