Skip to content

Commit

Permalink
manifest check: handle not found files.
Browse files Browse the repository at this point in the history
Close #3
  • Loading branch information
jbenet committed Jan 10, 2014
1 parent 229ddb4 commit 52dd8f6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions data_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,20 @@ func (mf *Manifest) Check(path string) (bool, error) {
return false, fmt.Errorf("data manifest: file not in manifest %s", path)
}

mfmt := "data manifest: check %.7s %s %s"

newHash, err := hashFile(path)
if err != nil {
return false, err
switch err.(type) {
case *os.PathError:
// non existent files count as not hashing correctly.
pOut(mfmt, oldHash, path, "FAIL - not found\n")
return false, nil
default:
return false, err
}
}

mfmt := "data manifest: check %.7s %s %s"
if newHash != oldHash {
pOut(mfmt, oldHash, path, "FAIL\n")
return false, nil
Expand Down

0 comments on commit 52dd8f6

Please sign in to comment.