From be1f4114c73c74bdeccf68f7acacaac5d60d7757 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Fri, 11 Dec 2015 15:13:03 -0800 Subject: [PATCH] Remove unnecessary stat from blob Get method This calls Stat before Open, which should be unnecessary because Open can handle the case of a nonexistent blob. Removing the Stat saves a round trip. This is similar to the removal of stat in Open in #1226. Signed-off-by: Aaron Lehmann --- registry/client/repository.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/registry/client/repository.go b/registry/client/repository.go index bb10ece7..8f525f0d 100644 --- a/registry/client/repository.go +++ b/registry/client/repository.go @@ -377,11 +377,7 @@ func (bs *blobs) Stat(ctx context.Context, dgst digest.Digest) (distribution.Des } func (bs *blobs) Get(ctx context.Context, dgst digest.Digest) ([]byte, error) { - desc, err := bs.Stat(ctx, dgst) - if err != nil { - return nil, err - } - reader, err := bs.Open(ctx, desc.Digest) + reader, err := bs.Open(ctx, dgst) if err != nil { return nil, err }