From a7cacc271d395c2bfdada635385a4b5c9b7a4068 Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Mon, 24 Aug 2026 12:10:12 +0300 Subject: [PATCH] fix: fetch all branch heads so gitStream can diff non-default base branches The shallow clone implies --single-branch, so only the default branch is fetched. Any PR whose base is a non-default branch fails git diff with a bad revision, surfacing as a misleading "PR branch was deleted" skip. Co-Authored-By: Claude Opus 5 (1M context) --- docs/downloads/bitbucket-pipelines.yml | 8 +++++++- docs/downloads/gitlab-ci.yml | 8 +++++++- docs/downloads/gitlab-k8s-ci.yml | 8 +++++++- docs/downloads/gitlab-shell-ci.yml | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/downloads/bitbucket-pipelines.yml b/docs/downloads/bitbucket-pipelines.yml index 0c3c256e7..ff3295905 100644 --- a/docs/downloads/bitbucket-pipelines.yml +++ b/docs/downloads/bitbucket-pipelines.yml @@ -40,7 +40,13 @@ pipelines: script: - git clone --shallow-since="6 months ago" --no-tags https://x-token-auth:$oauth_token@bitbucket.org/$full_repo.git gitstream/repo - git clone --depth=1 --no-tags https://x-token-auth:$oauth_token@bitbucket.org/$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG.git gitstream/cm - - cd gitstream/repo && git fetch origin $head_ref:$head_ref && git checkout $head_ref + - | + set -e + cd gitstream/repo + git checkout --detach + # Fetch all branches so any base branch can be diffed; keep --shallow-since or this pulls full history. + git fetch --no-tags --force --shallow-since="6 months ago" origin '+refs/heads/*:refs/heads/*' + git checkout "$head_ref" - docker pull gitstream/rules-engine:latest - | docker run -v $BITBUCKET_CLONE_DIR/gitstream:/code \ diff --git a/docs/downloads/gitlab-ci.yml b/docs/downloads/gitlab-ci.yml index f4a952d0b..7169b7894 100644 --- a/docs/downloads/gitlab-ci.yml +++ b/docs/downloads/gitlab-ci.yml @@ -27,7 +27,13 @@ gitstream-job: script: - git clone --shallow-since="6 months ago" --no-tags https://gitlab-ci-token:${CI_JOB_TOKEN}${repoUrl} gitstream/repo - git clone --depth=1 --no-tags https://gitlab-ci-token:${CI_JOB_TOKEN}${cmUrl} gitstream/cm - - cd gitstream/repo && git fetch origin $head_ref:$head_ref && git checkout $head_ref + - | + set -e + cd gitstream/repo + git checkout --detach + # Fetch all branches so any base branch can be diffed; keep --shallow-since or this pulls full history. + git fetch --no-tags --force --shallow-since="6 months ago" origin '+refs/heads/*:refs/heads/*' + git checkout "$head_ref" - docker pull gitstream/rules-engine:latest - | docker run -v $CI_PROJECT_DIR/gitstream:/code \ diff --git a/docs/downloads/gitlab-k8s-ci.yml b/docs/downloads/gitlab-k8s-ci.yml index c202a9c15..3feab3e58 100644 --- a/docs/downloads/gitlab-k8s-ci.yml +++ b/docs/downloads/gitlab-k8s-ci.yml @@ -26,7 +26,13 @@ gitstream-job: script: - git clone --shallow-since="6 months ago" --no-tags https://gitlab-ci-token:${CI_JOB_TOKEN}${repoUrl} gitstream/repo - git clone --depth=1 --no-tags https://gitlab-ci-token:${CI_JOB_TOKEN}${cmUrl} gitstream/cm - - cd gitstream/repo && git fetch origin $head_ref:$head_ref && git checkout $head_ref + - | + set -e + cd gitstream/repo + git checkout --detach + # Fetch all branches so any base branch can be diffed; keep --shallow-since or this pulls full history. + git fetch --no-tags --force --shallow-since="6 months ago" origin '+refs/heads/*:refs/heads/*' + git checkout "$head_ref" - docker pull gitstream/rules-engine:latest - | docker run -v $CI_PROJECT_DIR/gitstream:/code \ diff --git a/docs/downloads/gitlab-shell-ci.yml b/docs/downloads/gitlab-shell-ci.yml index 0f8eb279e..7827514a2 100644 --- a/docs/downloads/gitlab-shell-ci.yml +++ b/docs/downloads/gitlab-shell-ci.yml @@ -20,7 +20,13 @@ gitstream-job: script: - git clone --shallow-since="6 months ago" --no-tags https://gitlab-ci-token:${CI_JOB_TOKEN}${repoUrl} gitstream/repo - git clone --depth=1 --no-tags https://gitlab-ci-token:${CI_JOB_TOKEN}${cmUrl} gitstream/cm - - cd gitstream/repo && git fetch origin $head_ref:$head_ref && git checkout $head_ref + - | + set -e + cd gitstream/repo + git checkout --detach + # Fetch all branches so any base branch can be diffed; keep --shallow-since or this pulls full history. + git fetch --no-tags --force --shallow-since="6 months ago" origin '+refs/heads/*:refs/heads/*' + git checkout "$head_ref" - docker pull gitstream/rules-engine:latest - | docker run -v $CI_PROJECT_DIR/gitstream:/code \