Hash the sums for directory (ureadable when there is too many

This commit is contained in:
Guillaume J. Charmes 2013-12-26 16:42:05 -08:00
parent 894d4a23fb
commit cd735496da
No known key found for this signature in database
GPG Key ID: B33E4642CB6E3FF3
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package docker
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
@ -418,9 +420,11 @@ func (b *buildFile) CmdAdd(args string) error {
}
}
sort.Strings(subfiles)
hash = strings.Join(subfiles, ",")
hasher := sha256.New()
hasher.Write([]byte(strings.Join(subfiles, ",")))
hash = "dir:" + hex.EncodeToString(hasher.Sum(nil))
} else {
hash = sums[origPath]
hash = "file:" + sums[origPath]
}
b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", hash, dest)}
hit, err := b.probeCache()