mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
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>
This commit is contained in:
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…
Reference in New Issue
Block a user