[fractal] Make pre-commit hook work for non-terminal environments
- From: Alejandro Domínguez <aledomu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal] Make pre-commit hook work for non-terminal environments
- Date: Wed, 6 Jan 2021 18:06:35 +0000 (UTC)
commit 32ccb30d31dafb0b3fd7c42a43d6f469bf7f9c8c
Author: Kai A. Hiller <V02460 gmail com>
Date: Mon Dec 14 19:06:48 2020 +0100
Make pre-commit hook work for non-terminal environments
hooks/pre-commit.hook | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/hooks/pre-commit.hook b/hooks/pre-commit.hook
index a367c2c9..92db1337 100755
--- a/hooks/pre-commit.hook
+++ b/hooks/pre-commit.hook
@@ -19,6 +19,13 @@ install_rustfmt() {
if ! which cargo &> /dev/null || ! cargo fmt --help &> /dev/null; then
echo "Can't check Fractal's code style, because rustfmt could not be run."
+
+ if [ ! -t 1 ]; then
+ # No input is possible
+ echo "Performing commit."
+ exit 0
+ fi
+
echo ""
echo "y: Install rustfmt via rustup"
echo "n: Don't install rustfmt and perform the commit"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]