Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-28387: Protect against missing build directories. #74

Merged
merged 1 commit into from
Jan 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions python/lsst/verify/metadata/lsstsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def get_package_branch(self, package_name):
Name of the checked-out Git branch. If GitPython is not
installed, `None` is always returned instead.
"""
if git is not None:
repo = git.Repo(self.get_package_repo_path(package_name))
path = self.get_package_repo_path(package_name)
if git is not None and os.path.exists(path):
repo = git.Repo(path)
return repo.active_branch.name
else:
return None
Expand All @@ -109,8 +110,9 @@ def get_package_commit_sha(self, package_name):
Hex SHA of the checkout-out Git commit. If GitPython is not
installed, `None` is always returned instead.
"""
if git is not None:
repo = git.Repo(self.get_package_repo_path(package_name))
path = self.get_package_repo_path(package_name)
if git is not None and os.path.exists(path):
repo = git.Repo(path)
return repo.active_branch.commit.hexsha
else:
return None
Expand Down