Backpropagate Cargo.lock updates to all lock files (#9180)
* Experiment to backpropagate Cargo.lock updates to all lock files * Move most of dependabot-specific code to its own file * Various cleanups * Fine tune.. * Clean up shells and stop obscure API...
This commit is contained in:
38
scripts/cargo-for-all-lock-files.sh
Executable file
38
scripts/cargo-for-all-lock-files.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
shifted_args=()
|
||||
while [[ -n $1 ]]; do
|
||||
if [[ $1 = -- ]]; then
|
||||
escape_marker=found
|
||||
shift
|
||||
break
|
||||
else
|
||||
shifted_args+=("$1")
|
||||
shift
|
||||
fi
|
||||
done
|
||||
|
||||
# When "--" appear at the first and shifted_args is empty, consume it here
|
||||
# to unambiguously pass and use any other "--" for cargo
|
||||
if [[ -n $escape_marker && ${#shifted_args[@]} -gt 0 ]]; then
|
||||
files="${shifted_args[*]}"
|
||||
for file in $files; do
|
||||
if [[ $file = "${file%Cargo.lock}" ]]; then
|
||||
echo "$0: unrecognizable as Cargo.lock path (prepend \"--\"?): $file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
shifted_args=()
|
||||
else
|
||||
files="$(git ls-files :**/Cargo.lock)"
|
||||
fi
|
||||
|
||||
for lock_file in $files; do
|
||||
(
|
||||
set -x
|
||||
cd "$(dirname "$lock_file")"
|
||||
cargo "${shifted_args[@]}" "$@"
|
||||
)
|
||||
done
|
Reference in New Issue
Block a user