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

* Runtime: Reverse priority of tag lookup in TagStore.GetImage
This commit is contained in:
Guillaume J. Charmes
2013-07-12 16:15:04 -07:00
+4 -4
View File
@@ -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
}