1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix the bug of tag a existed tag name of a repository.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei Jitang 2014-09-30 16:57:17 +08:00
parent 4eb812e042
commit 5e6f16e342
2 changed files with 4 additions and 4 deletions

View file

@ -124,7 +124,7 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
}
if repoName != "" {
b.Daemon.Repositories().Set(repoName, tag, id, false)
b.Daemon.Repositories().Set(repoName, tag, id, true)
}
return engine.StatusOK
}

View file

@ -218,11 +218,11 @@ func (store *TagStore) Set(repoName, tag, imageName string, force bool) error {
var repo Repository
if r, exists := store.Repositories[repoName]; exists {
repo = r
if old, exists := store.Repositories[repoName][tag]; exists && !force {
return fmt.Errorf("Conflict: Tag %s is already set to image %s, if you want to replace it, please use -f option", tag, old)
}
} else {
repo = make(map[string]string)
if old, exists := store.Repositories[repoName]; exists && !force {
return fmt.Errorf("Conflict: Tag %s:%s is already set to %s", repoName, tag, old)
}
store.Repositories[repoName] = repo
}
repo[tag] = img.ID