remove increment flag on imageContexts.new()
Rename the methods to match my understanding of the behaviour. Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
4d62f67117
commit
aafd7fa969
2 changed files with 8 additions and 10 deletions
|
@ -189,7 +189,7 @@ func from(b *Builder, args []string, attributes map[string]bool, original string
|
|||
return err
|
||||
}
|
||||
b.resetImageCache()
|
||||
if _, err := b.imageContexts.new(ctxName, true); err != nil {
|
||||
if _, err := b.imageContexts.add(ctxName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -846,11 +846,7 @@ func mountByRef(b *Builder, name string) (*imageMount, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
im, err := b.imageContexts.new("", false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
im.id = image.ImageID()
|
||||
im := b.imageContexts.newImageMount(image.ImageID())
|
||||
return im, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,11 @@ type imageContexts struct {
|
|||
currentName string
|
||||
}
|
||||
|
||||
func (ic *imageContexts) new(name string, increment bool) (*imageMount, error) {
|
||||
func (ic *imageContexts) newImageMount(id string) *imageMount {
|
||||
return &imageMount{ic: ic, id: id}
|
||||
}
|
||||
|
||||
func (ic *imageContexts) add(name string) (*imageMount, error) {
|
||||
im := &imageMount{ic: ic}
|
||||
if len(name) > 0 {
|
||||
if ic.byName == nil {
|
||||
|
@ -33,10 +37,8 @@ func (ic *imageContexts) new(name string, increment bool) (*imageMount, error) {
|
|||
}
|
||||
ic.byName[name] = im
|
||||
}
|
||||
if increment {
|
||||
ic.list = append(ic.list, im)
|
||||
}
|
||||
ic.currentName = name
|
||||
ic.list = append(ic.list, im)
|
||||
return im, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue