diff --git a/update-libfuzzer.sh b/update-libfuzzer.sh index 088b8cf..50d9fc6 100755 --- a/update-libfuzzer.sh +++ b/update-libfuzzer.sh @@ -2,20 +2,26 @@ # Usage: # -# ./update-libfuzzer $commit_hash -# -# Where `$commit_hash` is a commit hash from -# https://github.com/llvm-mirror/llvm-project +# $ ./update-libfuzzer.sh set -ex +# The LLVM commit from which we are vendoring libfuzzer. This must be a commit +# hash from https://github.com/llvm/llvm-project +COMMIT=3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff + cd "$(dirname $0)" project_dir="$(pwd)" tmp_dir="$(mktemp -d)" - -git clone https://github.com/llvm/llvm-project.git "$tmp_dir" cd "$tmp_dir" -git checkout "$1" + +git init +git remote add llvm https://github.com/llvm/llvm-project.git +git sparse-checkout set compiler-rt/lib/fuzzer + +git fetch --depth 1 llvm "$COMMIT" --filter=blob:none +git checkout "$COMMIT" + rm -rf "$project_dir/libfuzzer/" mv "$tmp_dir/compiler-rt/lib/fuzzer/" "$project_dir/libfuzzer/"