filter-repo: protect against truncated fast-import input

Use the 'feature done' ability to mark when the fast-import stream is
finished, so that an aborted run (due to running into some kind of bug
while filtering, whether a bug in the code, or an error in the repo or
flags specified for the case under consideration) won't cause the repo
to be rewritten.

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2018-09-03 20:38:58 -07:00
parent e5a3a134b1
commit fa515c8d10

View File

@ -1074,6 +1074,7 @@ def fast_export_output(source_repo, extra_args = None):
_IDS._avoid_ids_below(biggest_mark)
# Create and return the git process
extra_args.append('--use-done-feature')
return subprocess.Popen(["git", "fast-export", "--topo-order"] + extra_args,
stdout=subprocess.PIPE,
cwd=source_repo)
@ -1371,7 +1372,8 @@ def run_fast_filter():
input = sys.stdin
fe_orig = None
else:
fep_cmd = ['git', 'fast-export', '--no-data'] + args.revisions
fep_cmd = ['git', 'fast-export',
'--no-data', '--use-done-feature'] + args.revisions
fep = subprocess.Popen(fep_cmd, stdout=subprocess.PIPE)
input = fep.stdout
if args.dry_run or args.debug: