[fractal] Stop pre-commit hook from installing programs



commit 5d16b11ffc98f9df8dfc204c3c125ce633be07a1
Author: Kai A. Hiller <V02460 gmail com>
Date:   Sun Dec 13 21:24:44 2020 +0100

    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--"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]