From 5d16b11ffc98f9df8dfc204c3c125ce633be07a1 Mon Sep 17 00:00:00 2001 From: "Kai A. Hiller" Date: Sun, 13 Dec 2020 21:24:44 +0100 Subject: [PATCH] Stop pre-commit hook from installing programs --- hooks/pre-commit.hook | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hooks/pre-commit.hook b/hooks/pre-commit.hook index f8002b6b..029f11fd 100755 --- a/hooks/pre-commit.hook +++ b/hooks/pre-commit.hook @@ -1,16 +1,14 @@ #!/bin/sh -if ! which rustup &> /dev/null; then - curl https://sh.rustup.rs -sSf | sh -s -- -y - export PATH=$PATH:$HOME/.cargo/bin - if ! which rustup &> /dev/null; then - echo "Failed to install rustup" - fi +if ! which cargo &> /dev/null; then + echo "Commit aborted! Please install cargo and rustfmt to check the code style of Fractal." + exit -1 fi -if ! rustup component list|grep rustfmt &> /dev/null; then - echo "Installing rustfmt.." - rustup component add rustfmt +if ! cargo fmt --help &> /dev/null; then + echo "Commit aborted! You need rustfmt to check the code style of Fractal." + echo "Install it via rustup ('rustup component add rustfmt') or your package manager." + exit -1 fi echo "--Checking style--"