def default_branch(self, url: str) -> Optional[RemoteBranch]: if GitOffline.is_repo_cloned(self.path): default_branch = GitOffline.get_default_branch(self.path, self.name) if default_branch is not None: return RemoteBranch(self.path, default_branch, self.name) default_branch = GitOnline.get_default_branch(url) if default_branch is None: return None git_dir = GitOffline.git_dir(self.path) if git_dir is not None and git_dir.is_dir(): GitOffline.save_default_branch(git_dir, self.name, default_branch) return RemoteBranch(self.path, default_branch, self.name)
def exists(self) -> bool: return GitOffline.is_repo_cloned(self.path)