diff --git a/weblate/trans/backups.py b/weblate/trans/backups.py index f7009054dc4b..0b86bd6e9003 100644 --- a/weblate/trans/backups.py +++ b/weblate/trans/backups.py @@ -278,6 +278,11 @@ def backup_component(self, backupzip, component) -> None: # Store VCS repo in case it is present if component.is_repo_link: return + + # Compact the repository + component.repo.compact() + + # Actually perform the backup self.backup_dir( backupzip, component.full_path, diff --git a/weblate/vcs/base.py b/weblate/vcs/base.py index 38d12ab00369..2667d26f57ab 100644 --- a/weblate/vcs/base.py +++ b/weblate/vcs/base.py @@ -562,3 +562,6 @@ def get_remote_branch_name(self, branch: str | None = None) -> str: def list_remote_branches(self): return [] + + def compact(self) -> None: + return diff --git a/weblate/vcs/git.py b/weblate/vcs/git.py index be745e1d67f7..88a21bbd7645 100644 --- a/weblate/vcs/git.py +++ b/weblate/vcs/git.py @@ -566,6 +566,9 @@ def status(self): return "\n".join(result) + def compact(self) -> None: + self.execute(["gc"]) + class GitWithGerritRepository(GitRepository): name = "Gerrit"