mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 21:05:10 +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 {
|
func runDebugExamine(gopts GlobalOptions, args []string) error {
|
||||||
|
repo, err := OpenRepository(gopts)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
ids := make([]restic.ID, 0)
|
ids := make([]restic.ID, 0)
|
||||||
for _, name := range args {
|
for _, name := range args {
|
||||||
id, err := restic.ParseID(name)
|
id, err := restic.ParseID(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warnf("error: %v\n", err)
|
name, err = restic.Find(gopts.ctx, repo.Backend(), restic.PackFile, name)
|
||||||
continue
|
if err == nil {
|
||||||
|
id, err = restic.ParseID(name)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
Warnf("error: %v\n", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
}
|
}
|
||||||
@ -441,11 +452,6 @@ func runDebugExamine(gopts GlobalOptions, args []string) error {
|
|||||||
return errors.Fatal("no pack files to examine")
|
return errors.Fatal("no pack files to examine")
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := OpenRepository(gopts)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !gopts.NoLock {
|
if !gopts.NoLock {
|
||||||
lock, err := lockRepo(gopts.ctx, repo)
|
lock, err := lockRepo(gopts.ctx, repo)
|
||||||
defer unlockRepo(lock)
|
defer unlockRepo(lock)
|
||||||
|
Loading…
Reference in New Issue
Block a user