mirror of
https://github.com/restic/restic.git
synced 2025-10-10 08:13:16 +00:00
check: complain about mixed pack files
This commit is contained in:
@@ -66,6 +66,15 @@ func (e *ErrDuplicatePacks) Error() string {
|
||||
return fmt.Sprintf("pack %v contained in several indexes: %v", e.PackID, e.Indexes)
|
||||
}
|
||||
|
||||
// ErrMixedPack is returned when a pack is found that contains both tree and data blobs.
|
||||
type ErrMixedPack struct {
|
||||
PackID restic.ID
|
||||
}
|
||||
|
||||
func (e *ErrMixedPack) Error() string {
|
||||
return fmt.Sprintf("pack %v contains a mix of tree and data blobs", e.PackID.Str())
|
||||
}
|
||||
|
||||
// ErrOldIndexFormat is returned when an index with the old format is
|
||||
// found.
|
||||
type ErrOldIndexFormat struct {
|
||||
@@ -141,6 +150,11 @@ func (c *Checker) LoadIndex(ctx context.Context) (hints []error, errs []error) {
|
||||
Indexes: packToIndex[packID],
|
||||
})
|
||||
}
|
||||
if c.masterIndex.IsMixedPack(packID) {
|
||||
hints = append(hints, &ErrMixedPack{
|
||||
PackID: packID,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
err = c.repo.SetIndex(c.masterIndex)
|
||||
|
Reference in New Issue
Block a user