(in bzrlib\vf_repository.py:2139)
new_pack._write_data('', flush=True)
(which in turn calls _write_data in bzrlib\repofmt\groupcompress_repo.py:153)
def _write_data(bytes, flush=False, _buffer=self._buffer, _write=self.write_stream.write, _update=self._hash.update): _buffer[0].append(bytes) _buffer[1] += len(bytes)
# buffer cap
if _buffer[1] > self._cache_limit or flush: bytes = ''.join(_buffer[0]) _write(bytes) # <------- THERE IT IS _update(bytes) _buffer[:] = [[], 0]
(this calls AppendBasedFileStream.write in bzrlib\transport\__init__.py:286)
def write(self, bytes): self.transport.append_bytes(self.relpath, bytes)
Obviously, AppendBasedFileStream.write doesn't care if bytes is actually empty. And the flush causes a write call with an empty buffer.
So in the end, the problem boils down to how I fixed it already. But I changed the commit to check for an empty buffer in append_bytes, that will cover all possible append cases.
I found out what the problem is:
(in bzrlib\ vf_repository. py:2139) _write_ data('' , flush=True)
new_pack.
(which in turn calls _write_data in bzrlib\ repofmt\ groupcompress_ repo.py: 153) self._buffer,
_write= self.write_ stream. write, _update= self._hash. update) :
_buffer[ 0].append( bytes)
_buffer[ 1] += len(bytes)
bytes = ''.join(_buffer[0])
_write( bytes) # <------- THERE IT IS
_update( bytes)
_buffer[ :] = [[], 0]
def _write_data(bytes, flush=False, _buffer=
# buffer cap
if _buffer[1] > self._cache_limit or flush:
(this calls AppendBasedFile Stream. write in bzrlib\ transport\ __init_ _.py:286)
self.transport .append_ bytes(self. relpath, bytes)
def write(self, bytes):
Obviously, AppendBasedFile Stream. write doesn't care if bytes is actually empty. And the flush causes a write call with an empty buffer.
So in the end, the problem boils down to how I fixed it already. But I changed the commit to check for an empty buffer in append_bytes, that will cover all possible append cases.