Potential fix for ADD .
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
parent
c6350bcc24
commit
93ff70a3e7
2 changed files with 23 additions and 1 deletions
|
@ -421,7 +421,9 @@ func (b *buildFile) CmdAdd(args string) error {
|
|||
} else if fi.IsDir() {
|
||||
var subfiles []string
|
||||
for file, sum := range sums {
|
||||
if strings.HasPrefix(file, origPath) {
|
||||
absFile := path.Join(b.contextPath, file)
|
||||
absOrigPath := path.Join(b.contextPath, origPath)
|
||||
if strings.HasPrefix(absFile, absOrigPath) {
|
||||
subfiles = append(subfiles, sum)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -592,6 +592,26 @@ func TestBuildADDLocalFileWithoutCache(t *testing.T) {
|
|||
checkCacheBehavior(t, template, false)
|
||||
}
|
||||
|
||||
func TestBuildADDCurrentDirectoryWithCache(t *testing.T) {
|
||||
template := testContextTemplate{`
|
||||
from {IMAGE}
|
||||
maintainer dockerio
|
||||
add . /usr/lib/bla
|
||||
`,
|
||||
nil, nil}
|
||||
checkCacheBehavior(t, template, true)
|
||||
}
|
||||
|
||||
func TestBuildADDCurrentDirectoryWithoutCache(t *testing.T) {
|
||||
template := testContextTemplate{`
|
||||
from {IMAGE}
|
||||
maintainer dockerio
|
||||
add . /usr/lib/bla
|
||||
`,
|
||||
nil, nil}
|
||||
checkCacheBehavior(t, template, false)
|
||||
}
|
||||
|
||||
func TestBuildADDRemoteFileWithCache(t *testing.T) {
|
||||
template := testContextTemplate{`
|
||||
from {IMAGE}
|
||||
|
|
Loading…
Add table
Reference in a new issue