From d418807c4cb329f5956553eece28b5f54a33f707 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 10 Dec 2016 11:57:05 -0600 Subject: [PATCH] gc: restart catpipe after each new pack Without this, the space taken by the stale packfiles that gc removes won't be available to the filesystem until the entire gc run ends (or the catpipe is otherwise reset). Signed-off-by: Rob Browning Tested-by: Rob Browning --- lib/bup/gc.py | 2 ++ lib/bup/git.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bup/gc.py b/lib/bup/gc.py index 446092f..c0a1c0e 100644 --- a/lib/bup/gc.py +++ b/lib/bup/gc.py @@ -138,6 +138,8 @@ def sweep(live_objects, existing_count, cat_pipe, threshold, compression, if verbosity: log('removing ' + basename(p) + '\n') os.unlink(p) + if ns.stale_files: # So git cat-pipe will close them + cat_pipe.restart() ns.stale_files = [] writer = git.PackWriter(objcache_maker=None, diff --git a/lib/bup/git.py b/lib/bup/git.py index 0f701a5..fc9eb39 100644 --- a/lib/bup/git.py +++ b/lib/bup/git.py @@ -1131,7 +1131,7 @@ class CatPipe: self.p = None self.inprogress = None - def _restart(self): + def restart(self): self._abort() self.p = subprocess.Popen(['git', 'cat-file', '--batch'], stdin=subprocess.PIPE, @@ -1142,7 +1142,7 @@ class CatPipe: def _fast_get(self, id): if not self.p or self.p.poll() != None: - self._restart() + self.restart() assert(self.p) poll_result = self.p.poll() assert(poll_result == None) -- 2.39.2