Skip to content

Commit

Permalink
fix: remove root from virtual referrers (#1130)
Browse files Browse the repository at this point in the history
Signed-off-by: Shiwei Zhang <[email protected]>
  • Loading branch information
shizhMSFT authored Sep 25, 2023
1 parent 8cf946f commit 4cf5390
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/oras/root/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"encoding/json"
"fmt"
"slices"
"strings"
"sync"

Expand Down Expand Up @@ -202,6 +203,9 @@ func recursiveCopy(ctx context.Context, src oras.ReadOnlyGraphTarget, dst oras.T
if err != nil {
return err
}
referrers = slices.DeleteFunc(referrers, func(desc ocispec.Descriptor) bool {
return content.Equal(desc, root)
})

findPredecessor := opts.FindPredecessors
opts.FindPredecessors = func(ctx context.Context, src content.ReadOnlyGraphStorage, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
Expand Down

0 comments on commit 4cf5390

Please sign in to comment.