Index reset should generate file conflicts (fixes #1613)
This commit is contained in:
10
Godeps/_workspace/src/github.com/syncthing/protocol/vector.go
generated
vendored
10
Godeps/_workspace/src/github.com/syncthing/protocol/vector.go
generated
vendored
@@ -103,3 +103,13 @@ func (a Vector) Concurrent(b Vector) bool {
|
||||
comp := a.Compare(b)
|
||||
return comp == ConcurrentGreater || comp == ConcurrentLesser
|
||||
}
|
||||
|
||||
// Counter returns the current value of the given counter ID.
|
||||
func (v Vector) Counter(id uint64) uint64 {
|
||||
for _, c := range v {
|
||||
if c.ID == id {
|
||||
return c.Value
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
14
Godeps/_workspace/src/github.com/syncthing/protocol/vector_test.go
generated
vendored
14
Godeps/_workspace/src/github.com/syncthing/protocol/vector_test.go
generated
vendored
@@ -118,5 +118,17 @@ func TestMerge(t *testing.T) {
|
||||
t.Errorf("%d: %+v.Merge(%+v) == %+v (expected %+v)", i, tc.a, tc.b, m, tc.m)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCounterValue(t *testing.T) {
|
||||
v0 := Vector{Counter{42, 1}, Counter{64, 5}}
|
||||
if v0.Counter(42) != 1 {
|
||||
t.Error("Counter error, %d != %d", v0.Counter(42), 1)
|
||||
}
|
||||
if v0.Counter(64) != 5 {
|
||||
t.Error("Counter error, %d != %d", v0.Counter(64), 5)
|
||||
}
|
||||
if v0.Counter(72) != 0 {
|
||||
t.Error("Counter error, %d != %d", v0.Counter(72), 0)
|
||||
}
|
||||
}
|
||||
|
||||
1
Godeps/_workspace/src/github.com/thejerf/suture/pre-commit
generated
vendored
1
Godeps/_workspace/src/github.com/thejerf/suture/pre-commit
generated
vendored
@@ -9,3 +9,4 @@ if [ ! -z "$GOLINTOUT" -o "$?" != 0 ]; then
|
||||
fi
|
||||
|
||||
go test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user