From 1e653ab645b513966c3fe9b13db7a5a9c9a8acb7 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Fri, 29 May 2015 14:20:05 -0700 Subject: [PATCH] Attempt to retain tagging behavior Signed-off-by: Stephen J Day --- graph/pull.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/graph/pull.go b/graph/pull.go index 8dc03dedc2..b396fb7ec9 100644 --- a/graph/pull.go +++ b/graph/pull.go @@ -699,9 +699,15 @@ func (s *TagStore) pullV2Tag(r *registry.Session, out io.Writer, endpoint *regis out.Write(sf.FormatStatus("", "Digest: %s", localDigest)) - // always set the digest so we can use the digest whether we pull by it or not. - if err = s.SetDigest(repoInfo.LocalName, localDigest.String(), downloads[0].img.ID); err != nil { - return false, err + if tag == localDigest.String() { + // TODO(stevvooe): Ideally, we should always set the digest so we can + // use the digest whether we pull by it or not. Unfortunately, the tag + // store treats the digest as a separate tag, meaning there may be an + // untagged digest image that would seem to be dangling by a user. + + if err = s.SetDigest(repoInfo.LocalName, localDigest.String(), downloads[0].img.ID); err != nil { + return false, err + } } if !utils.DigestReference(tag) {