Commit 0e4bde8a authored by ale's avatar ale
Browse files

Only use --repository-file with restic >= 0.11

parent d8932a2e
Pipeline #24122 passed with stages
in 2 minutes and 52 seconds
......@@ -37,20 +37,17 @@ type resticRepository struct {
func (r *resticRepository) resticCmd(cmd string) string {
args := []string{r.bin, cmd}
if r.repositoryFile != "" {
// Work around https://github.com/restic/restic/issues/3104
// ("restic init" does not respect --repository-file in Restic
// versions prior to 0.12).
if cmd == "init" && r.version.LessThan(resticFixedIssue3104Version) {
args = append(args, "--repo", r.uri)
} else {
args = append(args, "--repository-file", r.repositoryFile)
}
// Work around https://github.com/restic/restic/issues/3104
// ("restic init" does not respect --repository-file in Restic
// versions prior to 0.12).
if r.version.LessThan(resticRepositoryFileVersion) || (cmd == "init" && r.version.LessThan(resticFixedIssue3104Version)) {
args = append(args, "--repo", r.uri)
} else {
args = append(args, "--repository-file", r.repositoryFile)
}
if r.passwordFile != "" {
args = append(args, "--password-file", r.passwordFile)
}
args = append(args, "--password-file", r.passwordFile)
return strings.Join(args, " ")
}
......@@ -71,6 +68,7 @@ var (
resticVersionRx = regexp.MustCompile(`^restic ([0-9.]+)`)
resticMinGoodVersion = version.Must(version.NewVersion("0.9"))
resticRepositoryFileVersion = version.Must(version.NewVersion("0.11"))
resticFixedIssue3104Version = version.Must(version.NewVersion("0.12"))
)
......
Supports Markdown
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