all: Fix versioning path handling (#7407)

This commit is contained in:
Simon Frei
2021-02-26 12:04:05 +01:00
committed by GitHub
parent a69afc9eeb
commit fff8805ff6
13 changed files with 158 additions and 72 deletions
+19
View File
@@ -27,6 +27,7 @@ import (
// put the newest on top for readability.
var (
migrations = migrationSet{
{35, migrateToConfigV35},
{34, migrateToConfigV34},
{33, migrateToConfigV33},
{32, migrateToConfigV32},
@@ -93,6 +94,24 @@ func (m migration) apply(cfg *Configuration) {
cfg.Version = m.targetVersion
}
func migrateToConfigV35(cfg *Configuration) {
for i, fcfg := range cfg.Folders {
params := fcfg.Versioning.Params
if params["fsType"] != "" {
var fsType fs.FilesystemType
_ = fsType.UnmarshalText([]byte(params["fsType"]))
cfg.Folders[i].Versioning.FSType = fsType
}
if params["versionsPath"] != "" && params["fsPath"] == "" {
params["fsPath"] = params["versionsPath"]
}
cfg.Folders[i].Versioning.FSPath = params["fsPath"]
delete(cfg.Folders[i].Versioning.Params, "fsType")
delete(cfg.Folders[i].Versioning.Params, "fsPath")
delete(cfg.Folders[i].Versioning.Params, "versionsPath")
}
}
func migrateToConfigV34(cfg *Configuration) {
cfg.Defaults.Folder.Path = cfg.Options.DeprecatedDefaultFolderPath
cfg.Options.DeprecatedDefaultFolderPath = ""