1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-24 07:01:59 +00:00

ChunkIndex.add: overwrite current (c)size w/ new values

This commit is contained in:
Marian Beermann 2016-04-17 00:37:40 +02:00
parent 30f732052e
commit 01fac8d7d9
2 changed files with 5 additions and 3 deletions

View file

@ -313,6 +313,8 @@ cdef class ChunkIndex(IndexBase):
assert refcount2 <= _MAX_VALUE
result64 = refcount1 + refcount2
values[0] = _htole32(min(result64, _MAX_VALUE))
values[1] = data[1]
values[2] = data[2]
else:
hashindex_set(self.index, key, data)

View file

@ -174,8 +174,8 @@ def test_chunkindex_add(self):
idx1 = ChunkIndex()
idx1.add(H(1), 5, 6, 7)
assert idx1[H(1)] == (5, 6, 7)
idx1.add(H(1), 1, 0, 0)
assert idx1[H(1)] == (6, 6, 7)
idx1.add(H(1), 1, 2, 3)
assert idx1[H(1)] == (6, 2, 3)
def test_incref_limit(self):
idx1 = ChunkIndex()
@ -266,7 +266,7 @@ def test_read_known_good(self):
idx2 = ChunkIndex()
idx2[H(3)] = 2**32 - 123456, 6, 7
idx1.merge(idx2)
assert idx1[H(3)] == (hashindex.MAX_VALUE, 0, 0)
assert idx1[H(3)] == (hashindex.MAX_VALUE, 6, 7)
def test_nsindex_segment_limit():