mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-01-02 03:34:39 -06:00
In fixed-size chunking, create a new chunk after returning the old one
This commit is contained in:
18
integration_tests/fixed_test.sh
Executable file
18
integration_tests/fixed_test.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Sanity test for the fixed-size chunking algorithm
|
||||||
|
|
||||||
|
. ./test_functions.sh
|
||||||
|
|
||||||
|
fixture
|
||||||
|
|
||||||
|
pushd ${TEST_REPO}
|
||||||
|
${DUPLICACY} init integration-tests $TEST_STORAGE -c 64 -max 64 -min 64
|
||||||
|
|
||||||
|
add_file file3
|
||||||
|
add_file file4
|
||||||
|
|
||||||
|
|
||||||
|
${DUPLICACY} backup
|
||||||
|
${DUPLICACY} check --files -stats
|
||||||
|
popd
|
||||||
@@ -1132,7 +1132,7 @@ func (manager *BackupManager) RestoreFile(chunkDownloader *ChunkDownloader, chun
|
|||||||
fileHash = hash
|
fileHash = hash
|
||||||
return nil, false
|
return nil, false
|
||||||
})
|
})
|
||||||
if fileHash == entry.Hash {
|
if fileHash == entry.Hash && fileHash != "" {
|
||||||
LOG_TRACE("DOWNLOAD_SKIP", "File %s unchanged (by hash)", entry.Path)
|
LOG_TRACE("DOWNLOAD_SKIP", "File %s unchanged (by hash)", entry.Path)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ func (maker *ChunkMaker) ForEachChunk(reader io.Reader, endOfChunk func(chunk *C
|
|||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
startNewChunk()
|
|
||||||
maker.bufferStart = 0
|
maker.bufferStart = 0
|
||||||
for maker.bufferStart < maker.minimumChunkSize && !isEOF {
|
for maker.bufferStart < maker.minimumChunkSize && !isEOF {
|
||||||
count, err := reader.Read(maker.buffer[maker.bufferStart : maker.minimumChunkSize])
|
count, err := reader.Read(maker.buffer[maker.bufferStart : maker.minimumChunkSize])
|
||||||
@@ -174,6 +173,7 @@ func (maker *ChunkMaker) ForEachChunk(reader io.Reader, endOfChunk func(chunk *C
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
endOfChunk(chunk, false)
|
endOfChunk(chunk, false)
|
||||||
|
startNewChunk()
|
||||||
fileSize = 0
|
fileSize = 0
|
||||||
fileHasher = maker.config.NewFileHasher()
|
fileHasher = maker.config.NewFileHasher()
|
||||||
isEOF = false
|
isEOF = false
|
||||||
|
|||||||
Reference in New Issue
Block a user