From 2022551b262c8b663ef66a48c58c6f828af60536 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 2 Nov 2017 10:31:34 -0200 Subject: [PATCH] checksum: also sum the name of the files, so it changes after renaming --- internal/status/checksum.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/status/checksum.go b/internal/status/checksum.go index df344edd..e8599b7c 100644 --- a/internal/status/checksum.go +++ b/internal/status/checksum.go @@ -58,7 +58,11 @@ func (c *Checksum) checksum(files ...string) (string, error) { if info.IsDir() { continue } - if _, err := io.Copy(h, f); err != nil { + // also sum the filename, so checksum changes for renaming a file + if _, err = io.Copy(h, strings.NewReader(info.Name())); err != nil { + return "", err + } + if _, err = io.Copy(h, f); err != nil { return "", err } }