some fixes

This commit is contained in:
Lunny Xiao 2024-05-25 17:27:29 +08:00
parent c7359599c7
commit b4306dec58
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 4 additions and 6 deletions

View File

@ -7,6 +7,7 @@
package git package git
import ( import (
"context"
"io" "io"
"github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing"
@ -57,7 +58,7 @@ func (t *Tree) ListEntries() (Entries, error) {
} }
// ListEntriesRecursiveWithSize returns all entries of current tree recursively including all subtrees // ListEntriesRecursiveWithSize returns all entries of current tree recursively including all subtrees
func (t *Tree) ListEntriesRecursiveWithSize() (Entries, error) { func (t *Tree) ListEntriesRecursiveWithSize(ctx context.Context) (Entries, error) {
if t.gogitTree == nil { if t.gogitTree == nil {
err := t.loadTreeObject() err := t.loadTreeObject()
if err != nil { if err != nil {
@ -93,6 +94,6 @@ func (t *Tree) ListEntriesRecursiveWithSize() (Entries, error) {
} }
// ListEntriesRecursiveFast is the alias of ListEntriesRecursiveWithSize for the gogit version // ListEntriesRecursiveFast is the alias of ListEntriesRecursiveWithSize for the gogit version
func (t *Tree) ListEntriesRecursiveFast() (Entries, error) { func (t *Tree) ListEntriesRecursiveFast(ctx context.Context) (Entries, error) {
return t.ListEntriesRecursiveWithSize() return t.ListEntriesRecursiveWithSize(ctx)
} }

View File

@ -105,9 +105,6 @@ func (t *Tree) listEntriesRecursive(ctx context.Context, extraArgs TrustedCmdArg
t.entriesRecursive = append(t.entriesRecursive, entry) t.entriesRecursive = append(t.entriesRecursive, entry)
return nil return nil
}, extraArgs) }, extraArgs)
if err == nil {
t.entriesRecursiveParsed = true
}
return t.entriesRecursive, err return t.entriesRecursive, err
} }