From f02b01b7773ae21008a231a2bbb325e580c15952 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Tue, 15 Feb 2022 07:07:40 -0500 Subject: [PATCH] gitsrht/types: Remove Repository.update_visibility method --- gitsrht/types/__init__.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/gitsrht/types/__init__.py b/gitsrht/types/__init__.py index 4a75b55..c8edb2c 100644 --- a/gitsrht/types/__init__.py +++ b/gitsrht/types/__init__.py @@ -24,33 +24,11 @@ class Repository(Base, BaseRepositoryMixin): clone_in_progress = sa.Column(sa.Boolean, nullable=False) - # Must match gitsrht-update-hook/post-update.go#updateRepoVisibility() - def update_visibility(self): - if not os.path.exists(self.path): - # Repo dir not initialized yet - return - # In order to clone a public repo via http, a git-daemon-export-ok file - # must exist inside the repo directory. A private repo shouldn't have - # this file to improve security. - path = os.path.join(self.path, "git-daemon-export-ok") - should_exist = self.visibility in (RepoVisibility.public, RepoVisibility.unlisted) - if should_exist: - with open(path, 'w'): - pass - elif not should_exist and os.path.exists(path): - os.unlink(path) - @property def git_repo(self): if not self._git_repo: self._git_repo = GitRepository(self.path) return self._git_repo -def update_visibility_event(mapper, connection, target): - target.update_visibility() - -event.listen(Repository, 'after_insert', update_visibility_event) -event.listen(Repository, 'after_update', update_visibility_event) - from gitsrht.types.artifact import Artifact from gitsrht.types.sshkey import SSHKey -- 2.38.4