From cd735496da6d977748d5c3b19976f42d2cc1933e Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 26 Dec 2013 16:42:05 -0800 Subject: [PATCH] Hash the sums for directory (ureadable when there is too many --- buildfile.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildfile.go b/buildfile.go index aab5c24eff..4f72a73520 100644 --- a/buildfile.go +++ b/buildfile.go @@ -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()