aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz/oss-fuzz-build
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-06-14 16:48:59 +0200
committerJay Berkenbilt <ejb@ql.org>2019-06-14 17:05:48 +0200
commitd0b26b83379f4744f58f3c6e9ac85fdddb4c41ba (patch)
tree45beadee05efe984ffbd46287ce9306707e13bd5 /fuzz/oss-fuzz-build
parent3d03024ab235cf09517b8b1125093a9062151da2 (diff)
downloadqpdf-d0b26b83379f4744f58f3c6e9ac85fdddb4c41ba.tar.zst
oss-fuzz-build: support branch switching
Diffstat (limited to 'fuzz/oss-fuzz-build')
-rwxr-xr-xfuzz/oss-fuzz-build17
1 files changed, 16 insertions, 1 deletions
diff --git a/fuzz/oss-fuzz-build b/fuzz/oss-fuzz-build
index 8a0b7d42..20bd01ed 100755
--- a/fuzz/oss-fuzz-build
+++ b/fuzz/oss-fuzz-build
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -ex
# This is used invoked from
# https://github.com/google/oss-fuzz/blob/master/projects/qpdf/build.sh
@@ -6,6 +6,21 @@
# It should be run from the top level directory of a clean checkout of
# qpdf. It is also exercised in ../azure-pipelines/build-fuzzer
+if [[ $GITHUB_FORK != "" ]]; then
+ git remote add fork https://github.com/$GITHUB_FORK/qpdf
+ git fetch fork --depth=1
+ CUR_BRANCH=$(git rev-parse --abbrev-ref @)
+ if [[ $GITHUB_BRANCH == "" ]]; then
+ GITHUB_BRANCH=$CUR_BRANCH
+ fi
+ if [[ $GITHUB_BRANCH == $CUR_BRANCH ]]; then
+ git reset --hard fork/$CUR_BRANCH
+ else
+ git branch -f $GITHUB_BRANCH fork/$GITHUB_BRANCH
+ git checkout $GITHUB_BRANCH
+ fi
+fi
+
./configure \
--enable-oss-fuzz \
--enable-static \