cat: Add warning when pack was modified

This commit is contained in:
Alexander Neumann 2016-08-21 18:39:17 +02:00
parent 26351522c5
commit 6c6b0e2395
1 changed files with 5 additions and 0 deletions

View File

@ -157,6 +157,11 @@ func (cmd CmdCat) Execute(args []string) error {
return err return err
} }
hash := backend.Hash(buf)
if !hash.Equal(id) {
fmt.Fprintf(cmd.global.stderr, "Warning: hash of data does not match ID, want\n %v\ngot:\n %v\n", id.String(), hash.String())
}
_, err = os.Stdout.Write(buf) _, err = os.Stdout.Write(buf)
return err return err