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
|
@ -421,7 +421,9 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||||
} else if fi.IsDir() {
|
} else if fi.IsDir() {
|
||||||
var subfiles []string
|
var subfiles []string
|
||||||
for file, sum := range sums {
|
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)
|
subfiles = append(subfiles, sum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -592,6 +592,26 @@ func TestBuildADDLocalFileWithoutCache(t *testing.T) {
|
||||||
checkCacheBehavior(t, template, false)
|
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) {
|
func TestBuildADDRemoteFileWithCache(t *testing.T) {
|
||||||
template := testContextTemplate{`
|
template := testContextTemplate{`
|
||||||
from {IMAGE}
|
from {IMAGE}
|
||||||
|
|
Loading…
Reference in New Issue