Skip to content

Commit

Permalink
repair packs: Add stub feature flag implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelEischer committed Oct 22, 2023
1 parent 2f35d32 commit a474df2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/restic/cmd_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args
for _, id := range salvagePacks {
strIds = append(strIds, id.String())
}
Warnf("restic repair packs %v\nrestic repair snapshots --forget\n\n", strings.Join(strIds, " "))
Warnf("RESTIC_FEATURES=repair-packs-v1 restic repair packs %v\nrestic repair snapshots --forget\n\n", strings.Join(strIds, " "))
Warnf("Corrupted blobs are either caused by hardware problems or bugs in restic. Please open an issue at https://github.com/restic/restic/issues/new/choose for further troubleshooting!\n")
}
}
Expand Down
9 changes: 7 additions & 2 deletions cmd/restic/cmd_repair_packs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ func init() {
cmdRepair.AddCommand(cmdRepairPacks)
}

// FIXME feature flag

func runRepairPacks(ctx context.Context, gopts GlobalOptions, args []string) error {
// FIXME discuss and add proper feature flag mechanism
flag, _ := os.LookupEnv("RESTIC_FEATURES")
if flag != "repair-packs-v1" {
return errors.Fatal("This command is experimental and may change/be removed without notice between restic versions. " +
"Set the environment variable 'RESTIC_FEATURES=repair-packs-v1' to enable it.")
}

ids := restic.NewIDSet()
for _, arg := range args {
id, err := restic.ParseID(arg)
Expand Down

0 comments on commit a474df2

Please sign in to comment.