scm: Fix git clone issue for git+http protocol

`git clone` failed if the URL is specified as git+http.

    git: 'remote-git+http' is not a git command. See 'git --help'.

JIRA: RHELCMP-14340
Signed-off-by: Haibo Lin <hlin@redhat.com>
(cherry picked from commit 1a594e4148c409fc5383fd0a4b0e7ba04d13ec1c)
This commit is contained in:
Haibo Lin 2025-02-13 09:14:25 +08:00 committed by Stepan Oksanichenko
parent a6e7828033
commit 136a02bdbb

View File

@ -160,6 +160,9 @@ class GitWrapper(ScmBase):
if "://" not in repo: if "://" not in repo:
repo = "file://%s" % repo repo = "file://%s" % repo
if repo.startswith("git+http"):
repo = repo[4:]
git_cmd = ["git"] git_cmd = ["git"]
if "credential_helper" in self.options: if "credential_helper" in self.options:
git_cmd.extend(["-c", "credential.useHttpPath=true"]) git_cmd.extend(["-c", "credential.useHttpPath=true"])