dotcloud/docker — pull request #1054 by nickstenning (2013-06-28 16:22:01+00:00)
Title: Reverse priority of tag lookup in TagStore.GetImage

Currently, if you have the following images:

foo/bar 1 23b27d50fb49
foo/bar 2 f2b86ec3fcc4

And you issue the following command:

docker tag foo/bar:2 foo/bar latest

docker will tag the "wrong" image, because the image id for foo/bar:1 starts
with a "2". That is, you'll end up with the following:

foo/bar 1 23b27d50fb49
foo/bar 2 f2b86ec3fcc4
foo/bar latest 23b27d50fb49

This commit reverses the priority given to tags vs. image ids in the
construction `/:`, meaning that if a tag that is an exact
match for the specified `tagOrId`, it will be tagged in preference to an image
with an id that happens to start with the correct character sequence.