Skip to content

Commit

Permalink
Check for duplicate versions of substrate and polkadot (paritytech#891)
Browse files Browse the repository at this point in the history
* modified pre-commit

* fixes

* testing

* testing

* testing
  • Loading branch information
alistair-singh committed Jul 19, 2023
1 parent 4950e80 commit c1ff60a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ chronic typos .
# comment here and run `cargo +nightly fmt` manually without nix for https://github.com/oxalica/rust-overlay/issues/66#issuecomment-993816000
#(cd parachain && SKIP_WASM_BUILD= cargo +nightly fmt --all)

check_duplicate_versions() {
local duplicates=`grep -Ei "source = \"git.*$1" cumulus/Cargo.lock parachain/Cargo.lock | sed 's/\.git//g' | sort -u`
local version_count=`echo "$duplicates" | awk -F':' '{for (i=2; i<NF; i++) printf $i " "; print $NF}' | sort -u | wc -l | xargs`
if [ "$version_count" != "1" ]; then
echo Duplicate $1 versions detected
echo "$duplicates"
exit 1
fi
}

check_duplicate_versions substrate
check_duplicate_versions polkadot

echo 'Pre-commit hook successful!'

0 comments on commit c1ff60a

Please sign in to comment.