changeset 696:a7383625c891

git_handler: don't write out objects if already in object store object_store.add_object doesn't check to see if the object is already in a pack, so it is still written out in that case. Do the check ourselves before calling add_object.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 03 Mar 2014 22:44:09 -0800
parents 2c67099875cd
children a58ae693ab72
files hggit/git_handler.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py	Thu Feb 27 17:20:31 2014 -0800
+++ b/hggit/git_handler.py	Mon Mar 03 22:44:09 2014 -0800
@@ -427,7 +427,8 @@
             commit.encoding = extra['encoding']
 
         for obj, nodeid in exporter.update_changeset(ctx):
-            self.git.object_store.add_object(obj)
+            if obj.id not in self.git.object_store:
+                self.git.object_store.add_object(obj)
 
         tree_sha = exporter.root_tree_sha
 
@@ -437,7 +438,8 @@
 
         commit.tree = tree_sha
 
-        self.git.object_store.add_object(commit)
+        if commit.id not in self.git.object_store:
+            self.git.object_store.add_object(commit)
         self.map_set(commit.id, ctx.hex())
 
         self.swap_out_encoding(oldenc)