mirror of https://github.com/apache/cassandra
Add BUILD_OFFLINE capability to skip post-checkout submodule init
Patch by Josh McKenzie; reviewed by David Capwell for CASSANDRA-21364
This commit is contained in:
parent
8876ad4c03
commit
f55c4d2a9b
|
|
@ -31,11 +31,18 @@ _main() {
|
|||
root_dir="$(git rev-parse --show-toplevel)"
|
||||
cd "$root_dir"
|
||||
|
||||
if [[ ! -e .gitmodules ]]; then
|
||||
if ! git ls-files --error-unmatch .gitmodules &>/dev/null; then
|
||||
# nothing to see here, look away!
|
||||
return 0
|
||||
fi
|
||||
git submodule update --init --recursive
|
||||
|
||||
local extra_args=()
|
||||
if [[ -n "${BUILD_OFFLINE:-}" ]]; then
|
||||
echo "BUILD_OFFLINE is defined; using --no-fetch for submodule updates (local SHAs only)."
|
||||
echo "If your submodules are not already available locally, expect this to error out."
|
||||
extra_args+=(--no-fetch)
|
||||
fi
|
||||
git submodule update --init --recursive "${extra_args[@]}"
|
||||
}
|
||||
|
||||
_main "$@"
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ _main() {
|
|||
root_dir="$(git rev-parse --show-toplevel)"
|
||||
cd "$root_dir"
|
||||
|
||||
[[ ! -e .gitmodules ]] && return 0
|
||||
git ls-files --error-unmatch .gitmodules &>/dev/null || return 0
|
||||
local enabled=$(git config --bool cassandra.pre-commit.verify-submodules.enabled || echo true)
|
||||
[ "$enabled" == "false" ] && return 0
|
||||
local submodules=( $(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') )
|
||||
|
|
|
|||
Loading…
Reference in New Issue