Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2012-03-06 12:17:27 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2012-03-06 12:17:27 (GMT)
commite351ddb5cb9183ea9f6fd80ae7754db1929a128b (patch)
treea5724849df90d8a9cab934b825cfaacb0ee657bf
parentad061c03425e567c4ccd727157af6749b803407d (diff)
Don't record parent version as git commit
For reasons explained in ad061c0, we can't rely on the ancestry information (chain of parent commits) stored in git being complete - at least not without doing extensive additional processing (recreating branch history using rebase). Additionally, storing the parent commit caused deleted entries to still be referenced if there were more recent commits based upon them that hadn't also been deleted, causing storage space not to be reclaimed. For now, we simply don't record ancestry directly in git. We still have all the information in the metadata (so no information loss) and don't actually use the ancestry information stored in git.
-rw-r--r--gdatastore/datastore.py16
1 files changed, 1 insertions, 15 deletions
diff --git a/gdatastore/datastore.py b/gdatastore/datastore.py
index 4b5064f..ae9a657 100644
--- a/gdatastore/datastore.py
+++ b/gdatastore/datastore.py
@@ -583,16 +583,6 @@ class InternalApi(object):
os.makedirs(self._git_dir)
self._git_call('init', ['-q', '--bare'])
- def _find_git_parent(self, tree_id, parent_id):
- if not parent_id:
- return None
-
- try:
- return self._git_call('rev-parse',
- [_format_ref(tree_id, parent_id)]).strip()
- except GitError:
- return None
-
def _format_commit_message(self, metadata):
return pprint.pformat(to_native(metadata))
@@ -624,13 +614,9 @@ class InternalApi(object):
return self._create_repo()
def _store_entry(self, tree_id, version_id, parent_id, path, metadata):
- parent_hash = self._find_git_parent(tree_id, parent_id)
commit_message = self._format_commit_message(metadata)
tree_hash = self._write_tree(path)
- commit_options = [tree_hash]
- if parent_hash:
- commit_options += ['-p', parent_hash]
- commit_hash = self._git_call('commit-tree', commit_options,
+ commit_hash = self._git_call('commit-tree', [tree_hash],
input=commit_message).strip()
self._git_call('update-ref', [_format_ref(tree_id, version_id),
commit_hash])