mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 14:56:29 +00:00
debug: Support pack ID prefixes in debug examine
This commit is contained in:
parent
2d6a943911
commit
95bcc9ea31
@ -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 New Issue
Block a user