* Support treeish argument to porcelain.reset(), rather than
requiring a ref/commit id. (Jelmer Vernooij)
+ * Handle race condition when mtime doesn't change between writes/reads.
+ (Jelmer Vernooij, #541)
+
IMPROVEMENTS
* Add basic support for reading ignore files in ``dulwich.ignore``.
"""Git object store interfaces and implementation."""
-
from io import BytesIO
import errno
from itertools import chain
import stat
import sys
import tempfile
+import time
from dulwich.diff_tree import (
tree_changes,
self.close()
return
raise
- self._pack_cache_time = os.stat(self.pack_dir).st_mtime
+ self._pack_cache_time = max(
+ os.stat(self.pack_dir).st_mtime, time.time())
pack_files = set()
for name in pack_dir_contents:
if name.startswith("pack-") and name.endswith(".pack"):
def _pack_cache_stale(self):
try:
- return os.stat(self.pack_dir).st_mtime > self._pack_cache_time
+ return os.stat(self.pack_dir).st_mtime >= self._pack_cache_time
except OSError as e:
if e.errno == errno.ENOENT:
return True
b'refs/heads/foo': r_clone[b'HEAD'].id,
b'refs/heads/master': new_id,
}, self.repo.get_refs())
- self.assertEqual(r_clone[b'HEAD'].id, self.repo.refs[refs_path])
+ self.assertEqual(r_clone[b'HEAD'].id, self.repo[refs_path].id)
# Get the change in the target repo corresponding to the add
# this will be in the foo branch.