filter-repo: perf hack -- avoid expensive empty pruning checks

If a commit was a non-merge commit previously, then since we do not do
any kind of blob modifications (or funny parent grafting), there is no
way for a filemodify instruction to introduce the same version of the
file that already existed in the parent, as such the only check we need
to do to determine whether a commit becomes empty is whether
file_changes is empty.  Subsequent more expensive checks can be skipped.

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2018-12-20 11:27:29 -08:00
parent d0037275af
commit dbdb18170b

View File

@ -1130,6 +1130,12 @@ class FastExportFilter(object):
if not fast_import_pipes:
return False
# Perf hack: since we don't support blob rewriting yet, non-merge commits
# can only be empty if commit.file_changes is empty, which we checked
# above. So return early in such a case.
if len(orig_parents) < 2:
return False
# Finally, the hard case: due to either blob rewriting, or due to pruning
# of empty commits wiping out the first parent history back to the merge
# base, the list of file_changes we have may not actually differ from our