(ctx context.Context, a, b []mount.Mount, opts ...diff.Opt)
| 76 | } |
| 77 | |
| 78 | func (r *diffRemote) Compare(ctx context.Context, a, b []mount.Mount, opts ...diff.Opt) (ocispec.Descriptor, error) { |
| 79 | var config diff.Config |
| 80 | for _, opt := range opts { |
| 81 | if err := opt(&config); err != nil { |
| 82 | return ocispec.Descriptor{}, err |
| 83 | } |
| 84 | } |
| 85 | if tm := epoch.FromContext(ctx); tm != nil && config.SourceDateEpoch == nil { |
| 86 | config.SourceDateEpoch = tm |
| 87 | } |
| 88 | var sourceDateEpoch *timestamppb.Timestamp |
| 89 | if config.SourceDateEpoch != nil { |
| 90 | sourceDateEpoch = timestamppb.New(*config.SourceDateEpoch) |
| 91 | } |
| 92 | req := &diffapi.DiffRequest{ |
| 93 | Left: mount.ToProto(a), |
| 94 | Right: mount.ToProto(b), |
| 95 | MediaType: config.MediaType, |
| 96 | Ref: config.Reference, |
| 97 | Labels: config.Labels, |
| 98 | SourceDateEpoch: sourceDateEpoch, |
| 99 | } |
| 100 | resp, err := r.client.Diff(ctx, req) |
| 101 | if err != nil { |
| 102 | return ocispec.Descriptor{}, errgrpc.ToNative(err) |
| 103 | } |
| 104 | return oci.DescriptorFromProto(resp.Diff), nil |
| 105 | } |
nothing calls this directly
no test coverage detected