Skip to content

Commit

Permalink
Merge pull request #3453 from csordasmarton/fix_git_commit_url
Browse files Browse the repository at this point in the history
[server] Fix getting git commit url
  • Loading branch information
csordasmarton authored Oct 14, 2021
2 parents e1b6492 + bdee72e commit d2db1b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/server/codechecker_server/api/report_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,8 @@ def get_commit_url(
if m:
url = git_commit_url["url"]
for key, value in m.groupdict().items():
url = url.replace(f"${key}", value)
if value is not None:
url = url.replace(f"${key}", value)

return url

Expand Down
7 changes: 7 additions & 0 deletions web/server/tests/unit/test_git_commit_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ def test_gerrit_url(self):
'https://user@gerrit.ericsson.se/a/team/proj.git',
self.__git_commit_urls))

self.assertEqual(
"https://gerrit.ericsson.se/"
"gitweb?p=team/proj.git;a=commit;h=$commit",
get_commit_url(
'https://gerrit.ericsson.se/a/team/proj.git',
self.__git_commit_urls))

def test_bitbucket_url(self):
""" Get commit url for a bitbucket repository. """
self.assertEqual(
Expand Down

0 comments on commit d2db1b4

Please sign in to comment.