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

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