diff --git a/plumbing/protocol/packp/advrefs.go b/plumbing/protocol/packp/advrefs.go index 208e9b1ca..bfb9f798a 100644 --- a/plumbing/protocol/packp/advrefs.go +++ b/plumbing/protocol/packp/advrefs.go @@ -203,11 +203,11 @@ func (a *AdvRefs) IsEmpty() bool { // MakeReferenceSlice returns a sorted slice with all the references, their // peeled values, and symrefs. func (a *AdvRefs) MakeReferenceSlice() ([]*plumbing.Reference, error) { - allRefs := make([]*plumbing.Reference, 0) refs, err := a.AllReferences() if err != nil { return nil, err } + allRefs := make([]*plumbing.Reference, 0, len(refs)) for _, ref := range refs { allRefs = append(allRefs, ref)