forked from TrueCloudLab/restic
debug: Support pack ID prefixes in debug examine
This commit is contained in:
parent
2d6a943911
commit
95bcc9ea31
1 changed files with 13 additions and 7 deletions
|
@ -427,12 +427,23 @@ func storePlainBlob(id restic.ID, prefix string, plain []byte) error {
|
|||
}
|
||||
|
||||
func runDebugExamine(gopts GlobalOptions, args []string) error {
|
||||
repo, err := OpenRepository(gopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ids := make([]restic.ID, 0)
|
||||
for _, name := range args {
|
||||
id, err := restic.ParseID(name)
|
||||
if err != nil {
|
||||
Warnf("error: %v\n", err)
|
||||
continue
|
||||
name, err = restic.Find(gopts.ctx, repo.Backend(), restic.PackFile, name)
|
||||
if err == nil {
|
||||
id, err = restic.ParseID(name)
|
||||
}
|
||||
if err != nil {
|
||||
Warnf("error: %v\n", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
ids = append(ids, id)
|
||||
}
|
||||
|
@ -441,11 +452,6 @@ func runDebugExamine(gopts GlobalOptions, args []string) error {
|
|||
return errors.Fatal("no pack files to examine")
|
||||
}
|
||||
|
||||
repo, err := OpenRepository(gopts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !gopts.NoLock {
|
||||
lock, err := lockRepo(gopts.ctx, repo)
|
||||
defer unlockRepo(lock)
|
||||
|
|
Loading…
Reference in a new issue