Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit e351ddb5cb9183ea9f6fd80ae7754db1929a128b

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.
  
583583 os.makedirs(self._git_dir)
584584 self._git_call('init', ['-q', '--bare'])
585585
586 def _find_git_parent(self, tree_id, parent_id):
587 if not parent_id:
588 return None
589
590 try:
591 return self._git_call('rev-parse',
592 [_format_ref(tree_id, parent_id)]).strip()
593 except GitError:
594 return None
595
596586 def _format_commit_message(self, metadata):
597587 return pprint.pformat(to_native(metadata))
598588
614614 return self._create_repo()
615615
616616 def _store_entry(self, tree_id, version_id, parent_id, path, metadata):
617 parent_hash = self._find_git_parent(tree_id, parent_id)
618617 commit_message = self._format_commit_message(metadata)
619618 tree_hash = self._write_tree(path)
620 commit_options = [tree_hash]
621 if parent_hash:
622 commit_options += ['-p', parent_hash]
623 commit_hash = self._git_call('commit-tree', commit_options,
619 commit_hash = self._git_call('commit-tree', [tree_hash],
624620 input=commit_message).strip()
625621 self._git_call('update-ref', [_format_ref(tree_id, version_id),
626622 commit_hash])