diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-05-27 13:19:51 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-05-27 13:37:27 +0200 |
commit | 6398d67067837fe2a77d5d5290fec85719a02a8c (patch) | |
tree | e3a2e6407cead893624ef8fe3e6f6d1508fafbe1 /cgit | |
parent | README: update URLs (diff) | |
download | cgitize-6398d67067837fe2a77d5d5290fec85719a02a8c.tar.gz cgitize-6398d67067837fe2a77d5d5290fec85719a02a8c.zip |
clone to NAME.git folders
It seems to be the convention and the default behaviour of `git clone
--bare`, so do that.
Diffstat (limited to '')
-rw-r--r-- | cgitize/cgit.py | 2 | ||||
-rw-r--r-- | cgitize/repo.py | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/cgitize/cgit.py b/cgitize/cgit.py index dd06216..e2e872e 100644 --- a/cgitize/cgit.py +++ b/cgitize/cgit.py @@ -18,7 +18,7 @@ class CGitServer: def get_clone_url(self, repo): if self.clone_url is None: return None - return self.clone_url.format(repo=repo.dir) + return self.clone_url.format(repo=repo.url_path) class CGitRCWriter: diff --git a/cgitize/repo.py b/cgitize/repo.py index 079801f..dd55b17 100644 --- a/cgitize/repo.py +++ b/cgitize/repo.py @@ -93,6 +93,10 @@ class Repo: return self._name @property + def namegit(self): + return f'{self.name}.git' + + @property def desc(self): if self._desc is not None and self._desc: return self._desc @@ -124,8 +128,15 @@ class Repo: return self.clone_url return url_replace_auth(self.clone_url, self.url_auth) + def _with_dir(self, s): + if self._dir is None: + return s + return os.path.join(self._dir, s) + @property def dir(self): - if self._dir is None: - return self.name - return os.path.join(self._dir, self.name) + return self._with_dir(self.namegit) + + @property + def url_path(self): + return self._with_dir(self.name) |