diff --git a/.gitlab/search-common-ancestor.sh b/.gitlab/search-common-ancestor.sh index 7c33309ab5..d5394ffe8f 100644 --- a/.gitlab/search-common-ancestor.sh +++ b/.gitlab/search-common-ancestor.sh @@ -30,7 +30,7 @@ git remote add mr-origin ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL} source_branch="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-${CI_COMMIT_BRANCH}}" git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" mr-origin "${source_branch}" &> ./fetch_origin.log -newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent "origin/${source_branch}") | head -1) +newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent "mr-origin/${source_branch}") | head -1) if [ -z "${newest_common_ancestor_sha}" ]; then echo "Couldn’t find common ancestor with upstream main branch. This typically" echo "happens if you branched from main a long time ago. Please update"