|
@@ -407,18 +407,20 @@ func (b *buildFile) CmdAdd(args string) error {
|
|
hash string
|
|
hash string
|
|
sums = b.context.GetSums()
|
|
sums = b.context.GetSums()
|
|
)
|
|
)
|
|
|
|
+
|
|
|
|
+ // Has tarsum strips the '.' and './', we put it back for comparaison.
|
|
|
|
+ for file, sum := range sums {
|
|
|
|
+ if len(file) == 0 || file[0] != '.' && file[0] != '/' {
|
|
|
|
+ delete(sums, file)
|
|
|
|
+ sums["./"+file] = sum
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if fi, err := os.Stat(path.Join(b.contextPath, origPath)); err != nil {
|
|
if fi, err := os.Stat(path.Join(b.contextPath, origPath)); err != nil {
|
|
return err
|
|
return err
|
|
} else if fi.IsDir() {
|
|
} else if fi.IsDir() {
|
|
var subfiles []string
|
|
var subfiles []string
|
|
for file, sum := range sums {
|
|
for file, sum := range sums {
|
|
- // Has tarsum stips the '.' and './', we put it back for comparaison.
|
|
|
|
- if len(file) == 0 {
|
|
|
|
- file = "./"
|
|
|
|
- }
|
|
|
|
- if file[0] != '.' && file[0] != '/' {
|
|
|
|
- file = "./" + file
|
|
|
|
- }
|
|
|
|
if strings.HasPrefix(file, origPath) {
|
|
if strings.HasPrefix(file, origPath) {
|
|
subfiles = append(subfiles, sum)
|
|
subfiles = append(subfiles, sum)
|
|
}
|
|
}
|
|
@@ -435,7 +437,8 @@ func (b *buildFile) CmdAdd(args string) error {
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- if hit {
|
|
|
|
|
|
+ // If we do not have a hash, never use the cache
|
|
|
|
+ if hit && hash != "" {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
}
|