Skip to content

Commit 7cd8f6a

Browse files
committed
Restore blind-write to remote.Put
This used to do a blind write, but I "simplified" that when introducing remote.Pusher, which actually broke some things downstream of ggcr, so this restores that behavior. Signed-off-by: Jon Johnson <[email protected]>
1 parent 9915a85 commit 7cd8f6a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pkg/v1/remote/pusher.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ func (p *Pusher) writer(ctx context.Context, repo name.Repository, o *options) (
125125
return rw, rw.init(ctx)
126126
}
127127

128+
func (p *Pusher) Put(ctx context.Context, ref name.Reference, t Taggable) error {
129+
w, err := p.writer(ctx, ref.Context(), p.o)
130+
if err != nil {
131+
return err
132+
}
133+
134+
m, err := taggableToManifest(t)
135+
if err != nil {
136+
return err
137+
}
138+
139+
return w.commitManifest(ctx, ref, m)
140+
}
141+
128142
func (p *Pusher) Push(ctx context.Context, ref name.Reference, t Taggable) error {
129143
w, err := p.writer(ctx, ref.Context(), p.o)
130144
if err != nil {

pkg/v1/remote/write.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,5 +709,5 @@ func Put(ref name.Reference, t Taggable, options ...Option) error {
709709
if err != nil {
710710
return err
711711
}
712-
return newPusher(o).Push(o.context, ref, t)
712+
return newPusher(o).Put(o.context, ref, t)
713713
}

0 commit comments

Comments
 (0)