From c2004faf9c7b8d85b070009ae9b6fc9efe0c839f Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Wed, 22 Feb 2023 16:59:56 -0300 Subject: [PATCH] git-ref2info: fix https Makefile URL for gitlab.com (eg, rk35xx-legacy) (#4848) --- lib/functions/general/git-ref2info.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/functions/general/git-ref2info.sh b/lib/functions/general/git-ref2info.sh index e7066ec08..f805bc759 100644 --- a/lib/functions/general/git-ref2info.sh +++ b/lib/functions/general/git-ref2info.sh @@ -62,11 +62,12 @@ function memoized_git_ref_to_info() { ;; "https://gitlab.com/"*) - # parse org/repo from https://gitlab.com/org/repoß - declare org_and_repo="" - org_and_repo="$(echo "${git_source}" | cut -d/ -f4-5)" - org_and_repo="${org_and_repo%.git}" # remove .git if present - url="https://gitlab.com/${org_and_repo}/-/raw/${sha1}/Makefile" + # GitLab is more complex than GitHub, there can be more levels. + # This code is incomplete... but it works for now. + # Example: input: https://gitlab.com/rk3588_linux/rk/kernel.git + # output: https://gitlab.com/rk3588_linux/rk/kernel/-/raw/linux-5.10/Makefile + declare gitlab_path="${git_source%.git}" # remove .git + url="${gitlab_path}/-/raw/${sha1}/Makefile" ;; "https://source.codeaurora.org/external/imx/linux-imx")