Determine conflict winner based on change type and modification time (fixes #1848)

This commit is contained in:
Jakob Borg
2015-07-21 15:29:02 +02:00
parent 6e4d33c741
commit da4ebb6535
5 changed files with 106 additions and 24 deletions

View File

@@ -9,6 +9,7 @@
package integration
import (
"bytes"
"io/ioutil"
"log"
"os"
@@ -156,15 +157,23 @@ func TestConflictsDefault(t *testing.T) {
}
rc.AwaitSync("default", sender, receiver)
// The conflict should manifest on the s2 side again, where we should have
// moved the file to a conflict copy instead of just deleting it.
// The conflict is resolved to the advantage of the edit over the delete.
// As such, we get the edited content synced back to s1 where it was
// removed.
files, err = osutil.Glob("s2/*sync-conflict*")
if err != nil {
t.Fatal(err)
}
if len(files) != 2 {
t.Errorf("Expected 2 conflicted files instead of %d", len(files))
if len(files) != 1 {
t.Errorf("Expected 1 conflicted files instead of %d", len(files))
}
bs, err := ioutil.ReadFile("s1/testfile.txt")
if err != nil {
t.Error("reading file:", err)
}
if !bytes.Contains(bs, []byte("more text added to s2")) {
t.Error("s1/testfile.txt should contain data added in s2")
}
}