def check_multiple_branches(repository):
"""Check whether a git repository has more than one branch.
Parameters
----------
repository : string
Path to a git repository
Results
-------
boolean
True if the repository has more than 1 branch, False otherwise
Raises
------
git.InvalidGitRepositoryError if repository is a path to a directory
but not a git repository
git.NoSuchPathError if repository is not a path to a directory
"""
repo = git.Repo(repository)
branches = repo.branches
if len(branches) > 1:
return True
else:
return False
评论列表
文章目录