Dulwich.io dulwich / 04d1390
Fix style errors, avoid peeking at internals. Jelmer Vernooń≥ 17 days ago
1 changed file(s) with 14 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
344344 b'refs/some/ref/sub', b'42d06bd4b77fed026b154d16493e5deab78f02ec')
345345
346346 def test_setitem_packed(self):
347 # It's allowed to set a new ref on a packed ref, the new ref will be placed outside on refs/
347 with open(os.path.join(self._refs.path, 'packed-refs'), 'w') as f:
348 f.write('# pack-refs with: peeled fully-peeled sorted \n')
349 f.write(
350 '42d06bd4b77fed026b154d16493e5deab78f02ec refs/some/packed\n')
351
352 # It's allowed to set a new ref on a packed ref, the new ref will be
353 # placed outside on refs/
348354 self._refs[b'refs/heads/packed'] = (
349355 b'3ec9c43c84ff242e3ef4a9fc5bc111fd780a76a8'
350356 )
351 f = open(os.path.join(self._refs.path, b'refs', b'heads', b'packed'),
352 'rb')
353 self.assertEqual(b'3ec9c43c84ff242e3ef4a9fc5bc111fd780a76a8',
354 f.read()[:40])
355 f.close()
356
357 self._refs._packed_refs[b'refs/some/packed'] = b'42d06bd4b77fed026b154d16493e5deab78f02ec'
357 packed_ref_path = os.path.join(
358 self._refs.path, b'refs', b'heads', b'packed')
359 with open(packed_ref_path, 'rb') as f:
360 self.assertEqual(
361 b'3ec9c43c84ff242e3ef4a9fc5bc111fd780a76a8',
362 f.read()[:40])
363
358364 self.assertRaises(
359365 OSError, self._refs.__setitem__,
360366 b'refs/some/packed/sub',