]> arthur.barton.de Git - bup.git/commitdiff
get: note writes in just_write and fsck after tests
authorRob Browning <rlb@defaultvalue.org>
Sun, 19 Feb 2017 18:56:36 +0000 (12:56 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 3 Mar 2019 23:44:19 +0000 (17:44 -0600)
Thanks to Karl Kiniger for reporting the problem, and to Tim
Riemenschneider for tracking down the cause and suggesting fsck after
each test.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/git.py
t/test-get

index 73dce1914571adbe0be965c89c8ae4278329b4f4..23fadb3866bb40cd94974042fa6e192300cc600a 100644 (file)
@@ -723,17 +723,18 @@ class PackWriter:
         return self.objcache.exists(id, want_source=want_source)
 
     def just_write(self, sha, type, content):
-        """Write an object to the pack file, bypassing the objcache.  Fails if
-        sha exists()."""
+        """Write an object to the pack file without checking for duplication."""
         self._write(sha, type, content)
+        # If nothing else, gc doesn't have/want an objcache
+        if self.objcache is not None:
+            self.objcache.add(sha)
 
     def maybe_write(self, type, content):
         """Write an object to the pack file if not present and return its id."""
         sha = calc_hash(type, content)
         if not self.exists(sha):
-            self.just_write(sha, type, content)
             self._require_objcache()
-            self.objcache.add(sha)
+            self.just_write(sha, type, content)
         return sha
 
     def new_blob(self, blob):
index 9d3381ee26d56e4bee5b5d61df085210390f6fdc..fd9c7e00b01b5d7fc928af808f95d45b9342e3a6 100755 (executable)
@@ -238,6 +238,8 @@ def _run_get(disposition, method, what):
         cmd = get_cmd + (method, src, dest)
     result = exo(cmd, check=False, stderr=PIPE)
     get_cases_tested += 1
+    fsck = ex((bup_cmd, '-d', 'get-dest', 'fsck'), check=False)
+    wvpasseq(0, fsck.rc)
     return result
 
 def run_get(disposition, method, what=None, given=None):