From d82b41be08a2263847786a3dfb9c9db2f2529840 Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 25 Apr 2023 23:48:25 +0200 Subject: [PATCH] Fetch more commits from source repository to find merge-base Gitlab CI fetches only 10 commits from source repository which might not be enough for git merge-base. --- CI/ubuntu_gcc_preprocess.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CI/ubuntu_gcc_preprocess.sh b/CI/ubuntu_gcc_preprocess.sh index 3d38471569..6219c5df0b 100755 --- a/CI/ubuntu_gcc_preprocess.sh +++ b/CI/ubuntu_gcc_preprocess.sh @@ -51,6 +51,15 @@ TARGET_BRANCH="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-master}" git fetch target "${TARGET_BRANCH:?}" +if [[ "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" ]]; then + git remote add source "${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}" + git fetch source "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" +elif [[ "${CI_COMMIT_BRANCH}" ]]; then + git fetch origin "${CI_COMMIT_BRANCH:?}" +else + git fetch origin +fi + BASE_VERSION=$(git merge-base "target/${TARGET_BRANCH:?}" "${VERSION:?}") # Save and use scripts from this commit because they may be absent or different in the base version