Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/tools/maint/clang-format-diff.sh
7085 views
1
#!/bin/bash
2
# Based on binaryen/scripts/clang-format-diff.sh
3
# TODO(sbc): Switch to pre-packaged github actions once we find one that
4
# is mature enough for our needs.
5
6
set -o errexit
7
set -o pipefail
8
set -o xtrace
9
10
if [ -n "$1" ]; then
11
BRANCH="$1"
12
else
13
BRANCH="@{upstream}"
14
fi
15
16
MERGE_BASE=$(git merge-base $BRANCH HEAD)
17
FORMAT_ARGS=${MERGE_BASE}
18
if [ -n "$LLVM_VERSION" ]; then
19
FORMAT_ARGS="--binary=clang-format-${LLVM_VERSION} ${FORMAT_ARGS}"
20
fi
21
22
git clang-format ${FORMAT_ARGS} --diff
23
24