filter-repo: prune commits that started empty if they now have no parents

If ancient history that pre-dated some subdirectory had a few empty
commits, we would rather those all got pruned as well.  Empty commits
from the original repository should only be retained if they have at
least one retained parent.

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 6 years ago
parent e3fde7689c
commit 057947f6ff

@ -987,9 +987,10 @@ class FastExportFilter(object):
# Now print the resulting commit, unless all its changes were dropped and
# it was a non-merge commit
merge_commit = len(commit.get_parents()) > 1
merge_commit = len(parents) > 1
if not commit.dumped:
if merge_commit or not had_file_changes or commit.file_changes:
if (commit.file_changes or merge_commit or
(not had_file_changes and len(parents) >= 1)):
commit.dump(self._output)
new_id = None
# Determine the mapping of old commit hash to new one

Loading…
Cancel
Save