Commit d52335b2 authored by ale's avatar ale

Use atom-specific names for restic stdin snapshots

parent 3654e8d1
Pipeline #4680 failed with stages
in 4 minutes and 34 seconds
......@@ -221,8 +221,18 @@ func (r *resticRepository) RestoreCmd(ctx context.Context, rctx RuntimeContext,
// A special path for stdin datasets that is likely to be unused by the
// rest of the filesystem (the path namespace in Restic is global).
func datasetStdinPath(ds *Dataset) string {
dsPath := filepath.Join(ds.Source, ds.ID)
return fmt.Sprintf("/STDIN_%s", strings.Replace(dsPath, "/", "_", -1))
var dsPath string
switch len(ds.Atoms) {
case 0:
dsPath = ds.Source
case 1:
dsPath = filepath.Join(ds.Source, ds.Atoms[0].Name)
default:
dsPath = filepath.Join(ds.Source, "all")
}
dsPath = strings.TrimPrefix(dsPath, "/")
dsPath = strings.Replace(dsPath, "/", "_", -1)
return fmt.Sprintf("/STDIN_%s", dsPath)
}
func (r *resticRepository) BackupStreamCmd(backup *Backup, ds *Dataset) string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment