filter-repo: fix fast-import crash with renaming

When non-merge commits have files in the _files_tweaked set (they were
modified by a blob or commit callback), they may become empty.  However,
new_1st_parent is more accurately named
new_1st_parent_if_would_become_non_merge; it will always be None for
non-merge commits.  So we need to get the correct parent.

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 6 years ago
parent dd438dc455
commit 4ee915e4dd

@ -1210,7 +1210,9 @@ class FastExportFilter(object):
# rest. But I'm worried about fast-import blocking on fi_output
# buffers filling up so I instead read from it as I go.
for change in commit.file_changes:
fi_input.write("ls :{} {}\n".format(new_1st_parent, change.filename))
parent = new_1st_parent or commit.from_commit
assert parent # Should be good based on the checks above
fi_input.write("ls :{} {}\n".format(parent, change.filename))
fi_input.flush()
parent_version = fi_output.readline().split()
if change.type == 'D':

Loading…
Cancel
Save