lib/versioner: Minor fixes in comments and error message (#9031)
* lib/versioner: Factor out DefaultPath constant. Replace several instances where .stversions is named literally to all use the same definition in the versioner package. Exceptions are the packages where a cyclic dependency on versioner is impossible, or some tests which combine the versions base path with other components. * lib/versioner: Fix comment about trash can in simple versioner. * lib/versioner: Fix wrong versioning type string in error message. The error message shows the folder type instead of the versioning type, although the correct field is used in the comparison.
This commit is contained in:
+1
-1
@@ -399,7 +399,7 @@ func (m *model) addAndStartFolderLockedWithIgnores(cfg config.FolderConfiguratio
|
||||
// These are our metadata files, and they should always be hidden.
|
||||
ffs := cfg.Filesystem(nil)
|
||||
_ = ffs.Hide(config.DefaultMarkerName)
|
||||
_ = ffs.Hide(".stversions")
|
||||
_ = ffs.Hide(versioner.DefaultPath)
|
||||
_ = ffs.Hide(".stignore")
|
||||
|
||||
var ver versioner.Versioner
|
||||
|
||||
@@ -2647,7 +2647,7 @@ func TestVersionRestore(t *testing.T) {
|
||||
file = filepath.FromSlash(file)
|
||||
}
|
||||
tag := version.In(time.Local).Truncate(time.Second).Format(versioner.TimeFormat)
|
||||
taggedName := filepath.Join(".stversions", versioner.TagFilename(file, tag))
|
||||
taggedName := filepath.Join(versioner.DefaultPath, versioner.TagFilename(file, tag))
|
||||
fd, err := filesystem.Open(file)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -2680,7 +2680,7 @@ func TestVersionRestore(t *testing.T) {
|
||||
}
|
||||
for _, version := range versions {
|
||||
if version.VersionTime.Equal(beforeRestore) || version.VersionTime.After(beforeRestore) {
|
||||
fd, err := filesystem.Open(".stversions/" + versioner.TagFilename(file, version.VersionTime.Format(versioner.TimeFormat)))
|
||||
fd, err := filesystem.Open(versioner.DefaultPath + "/" + versioner.TagFilename(file, version.VersionTime.Format(versioner.TimeFormat)))
|
||||
must(t, err)
|
||||
defer fd.Close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user