Skip to content

Commit f0436de

Browse files
committed
simplify fuzzer branch handling
1 parent 04ffb01 commit f0436de

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

docker/test/fuzzer/run-fuzzer.sh

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,25 @@ function clone
4242
(
4343
cd "$repo_dir"
4444
if [ "$PR_TO_TEST" != "0" ]; then
45-
if git fetch --depth 100 origin "+refs/pull/$PR_TO_TEST/merge"; then
45+
if git fetch --depth 1 origin "+refs/pull/$PR_TO_TEST/merge"; then
4646
git checkout FETCH_HEAD
4747
echo "Checked out pull/$PR_TO_TEST/merge ($(git rev-parse FETCH_HEAD))"
4848
else
49-
git fetch --depth 100 origin "+refs/pull/$PR_TO_TEST/head"
49+
git fetch --depth 1 origin "+refs/pull/$PR_TO_TEST/head"
5050
git checkout "$SHA_TO_TEST"
5151
echo "Checked out nominal SHA $SHA_TO_TEST for PR $PR_TO_TEST"
5252
fi
5353
# Use BASE_BRANCH from environment variable if available, otherwise fall back to master
5454
if [ -n "$BASE_BRANCH" ]; then
5555
echo "Using base branch from environment: $BASE_BRANCH"
56-
# Fetch the specific base branch first (without depth limit to allow merge-base)
57-
git fetch origin --depth 100 "$BASE_BRANCH" || {
56+
# Fetch the specific base branch first
57+
git fetch --depth 1 origin "+refs/heads/$BASE_BRANCH:refs/remotes/origin/$BASE_BRANCH" || {
5858
echo "ERROR: Could not fetch base branch: $BASE_BRANCH"
5959
echo "Available remote branches:"
6060
git branch -r
6161
exit 1
6262
}
63-
MERGE_BASE=$(git merge-base HEAD "origin/$BASE_BRANCH" 2>/dev/null || echo "")
64-
if [ -z "$MERGE_BASE" ]; then
65-
echo "ERROR: No merge base found with base branch: $BASE_BRANCH"
66-
echo "Available remote branches:"
67-
git branch -r
68-
exit 1
69-
fi
70-
git diff --name-only "$MERGE_BASE" HEAD | tee ci-changed-files.txt
63+
git diff --name-only "origin/$BASE_BRANCH" HEAD | tee ci-changed-files.txt
7164
else
7265
echo "No BASE_BRANCH environment variable, using master"
7366
git diff --name-only master HEAD | tee ci-changed-files.txt

0 commit comments

Comments
 (0)