Skip to content

Commit 2022551

Browse files
committed
checksum: also sum the name of the files, so it changes after renaming
1 parent baac067 commit 2022551

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/status/checksum.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ func (c *Checksum) checksum(files ...string) (string, error) {
5858
if info.IsDir() {
5959
continue
6060
}
61-
if _, err := io.Copy(h, f); err != nil {
61+
// also sum the filename, so checksum changes for renaming a file
62+
if _, err = io.Copy(h, strings.NewReader(info.Name())); err != nil {
63+
return "", err
64+
}
65+
if _, err = io.Copy(h, f); err != nil {
6266
return "", err
6367
}
6468
}

0 commit comments

Comments
 (0)