Support git repositories without ".git" suffix

This commit is contained in:
allegroai 2020-01-27 15:40:24 +02:00
parent 92984742ca
commit 9f8e814ca6

View File

@ -201,11 +201,13 @@ class GitDetector(Detector):
)
def _post_process_info(self, info):
if info.url and not info.url.endswith(".git"):
info.url += ".git"
# Deprecated code: this was intended to make sure git repository names always
# ended with ".git", but this is not always the case (e.g. Azure Repos)
# if info.url and not info.url.endswith(".git"):
# info.url += ".git"
if (info.branch or "").startswith("origin/"):
info.branch = info.branch[len("origin/") :]
info.branch = info.branch[len("origin/"):]
return info