From: Rob Browning Date: Sat, 10 Dec 2016 17:57:05 +0000 (-0600) Subject: gc: restart catpipe after each new pack X-Git-Tag: 0.29-rc1~3 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d418807c4cb329f5956553eece28b5f54a33f707;hp=8815d8ac4c4b6b9b4df94790b81ff95db030f1d1;p=bup.git 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 --- 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)