Skip to content

Commit

Permalink
Merge pull request #3430 from csordasmarton/handle_no_remote_url
Browse files Browse the repository at this point in the history
[client] Handle use case when a repository doesn't have a remote url on storage
  • Loading branch information
bruntib authored Sep 10, 2021
2 parents 3ea0f3b + 5484fa9 commit 0168f93
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/client/codechecker_client/blame_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ def __get_blame_info(file_path: str):
except TypeError:
tracking_branch = repo.head.commit.hexsha

remote_url = None
try:
# Handle the use case when a repository doesn't have a remote url.
remote_url = next(repo.remote().urls, None)
except ValueError:
pass

try:
blame = repo.blame_incremental(repo.head.commit.hexsha, file_path)

res = {
'version': 'v1',
'tracking_branch': tracking_branch,
'remote_url': next(repo.remote().urls, None),
'remote_url': remote_url,
'commits': {},
'blame': []}

Expand Down

0 comments on commit 0168f93

Please sign in to comment.