Kaynağa Gözat

Merge pull request #1054 from nickstenning/getimage-by-tag

* Runtime: Reverse priority of tag lookup in TagStore.GetImage
Guillaume J. Charmes 12 yıl önce
ebeveyn
işleme
933b9d44e1
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 4 4
      tags.go

+ 4 - 4
tags.go

@@ -204,15 +204,15 @@ func (store *TagStore) GetImage(repoName, tagOrID string) (*Image, error) {
 	} else if repo == nil {
 		return nil, nil
 	}
-	//go through all the tags, to see if tag is in fact an ID
+	if revision, exists := repo[tagOrID]; exists {
+		return store.graph.Get(revision)
+	}
+	// If no matching tag is found, search through images for a matching image id
 	for _, revision := range repo {
 		if strings.HasPrefix(revision, tagOrID) {
 			return store.graph.Get(revision)
 		}
 	}
-	if revision, exists := repo[tagOrID]; exists {
-		return store.graph.Get(revision)
-	}
 	return nil, nil
 }