Skip to content

Commit 7ceb213

Browse files
committed
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 <[email protected]>
1 parent 1c45510 commit 7ceb213

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git-filter-repo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,6 +2666,10 @@ class InputFileBackup:
26662666
self.input_file = input_file
26672667
self.output_file = output_file
26682668

2669+
def close(self):
2670+
self.input_file.close()
2671+
self.output_file.close()
2672+
26692673
def read(self, size):
26702674
output = self.input_file.read(size)
26712675
self.output_file.write(output)
@@ -3896,6 +3900,7 @@ class RepoFilter(object):
38963900
# Make sure fast-export completed successfully
38973901
if not self._args.stdin and self._fep.wait():
38983902
raise SystemExit(_("Error: fast-export failed; see above.")) # pragma: no cover
3903+
self._input.close()
38993904

39003905
# If we're not the manager of self._output, we should avoid post-run cleanup
39013906
if not self._managed_output:

0 commit comments

Comments
 (0)