1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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

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()