lib/versioner: Purge the empty directories in .stversions (fixes #4406)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4514 LGTM: AudriusButkevicius, imsodin
This commit is contained in:
committed by
Audrius Butkevicius
parent
0518a92cdb
commit
9471b9f6af
@@ -31,8 +31,10 @@ func TestTrashcanCleanout(t *testing.T) {
|
||||
{"testdata/.stversions/keep1/file2", false},
|
||||
{"testdata/.stversions/keep2/file1", false},
|
||||
{"testdata/.stversions/keep2/file2", true},
|
||||
{"testdata/.stversions/keep3/keepsubdir/file1", false},
|
||||
{"testdata/.stversions/remove/file1", true},
|
||||
{"testdata/.stversions/remove/file2", true},
|
||||
{"testdata/.stversions/remove/removesubdir/file1", true},
|
||||
}
|
||||
|
||||
os.RemoveAll("testdata")
|
||||
@@ -65,6 +67,10 @@ func TestTrashcanCleanout(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Lstat("testdata/.stversions/keep3"); os.IsNotExist(err) {
|
||||
t.Error("directory with non empty subdirs should not be removed")
|
||||
}
|
||||
|
||||
if _, err := os.Lstat("testdata/.stversions/remove"); !os.IsNotExist(err) {
|
||||
t.Error("empty directory should have been removed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user