]> arthur.barton.de Git - bup.git/blobdiff - git.py
cmd-save: completely reimplement using the indexfile.
[bup.git] / git.py
diff --git a/git.py b/git.py
index 6775bb2876a7d8c10d98b65027db432a4438fe77..5aa7933a520373f717ece351bd1472eaa6984797 100644 (file)
--- a/git.py
+++ b/git.py
@@ -183,11 +183,14 @@ class PackWriter:
     def write(self, type, content):
         return self._write(calc_hash(type, content), type, content)
 
-    def maybe_write(self, type, content):
-        bin = calc_hash(type, content)
+    def exists(self, id):
         if not self.objcache:
             self._make_objcache()
-        if not self.objcache.exists(bin):
+        return self.objcache.exists(id)
+
+    def maybe_write(self, type, content):
+        bin = calc_hash(type, content)
+        if not self.exists(bin):
             self._write(bin, type, content)
             self.objcache.add(bin)
         return bin