From 41ba8f6c7a28286977114ab33ef332096237d7bc Mon Sep 17 00:00:00 2001 From: Tunglies Date: Sat, 14 Jun 2025 02:47:15 +0800 Subject: [PATCH] fix: streamline pre-push hook to run clippy only for src-tauri changes --- .husky/pre-push | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index c90d45ef..afeed10c 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,13 +1,11 @@ #!/bin/bash -# 运行 clippy -# cargo clippy --manifest-path ./src-tauri/Cargo.toml --fix +if git diff --cached --name-only | grep -q '^src-tauri/'; then + cargo clippy --manifest-path ./src-tauri/Cargo.toml + if [ $? -ne 0 ]; then + echo "Clippy found issues in src-tauri. Please fix them before pushing." + exit 1 + fi +fi -# 如果 clippy 失败,阻止 push -# if [ $? -ne 0 ]; then -# echo "Clippy found issues in sub_crate. Please fix them before pushing." -# exit 1 -# fi - -# 允许 push exit 0