mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-06-01 18:05:19 +02:00
filter-repo: ensure we close files so they get written
It appears that python will usually write out files even if we do not explicitly close them, but other tweaks to the code can make this not happen. Explicitly close the files to be safe. Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
1c4551021f
commit
7ceb213f04
|
@ -2666,6 +2666,10 @@ class InputFileBackup:
|
|||
self.input_file = input_file
|
||||
self.output_file = output_file
|
||||
|
||||
def close(self):
|
||||
self.input_file.close()
|
||||
self.output_file.close()
|
||||
|
||||
def read(self, size):
|
||||
output = self.input_file.read(size)
|
||||
self.output_file.write(output)
|
||||
|
@ -3896,6 +3900,7 @@ class RepoFilter(object):
|
|||
# Make sure fast-export completed successfully
|
||||
if not self._args.stdin and self._fep.wait():
|
||||
raise SystemExit(_("Error: fast-export failed; see above.")) # pragma: no cover
|
||||
self._input.close()
|
||||
|
||||
# If we're not the manager of self._output, we should avoid post-run cleanup
|
||||
if not self._managed_output:
|
||||
|
|
Loading…
Reference in New Issue
Block a user