Skip to content

Commit 3956bda

Browse files
authored
Merge pull request #286 from PysioHub/main
fix: prepare close #284
2 parents a3d88c3 + b2e59e6 commit 3956bda

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

.husky/commit-msg renamed to .husky/commit-msg.disabled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ commit_msg=$(cat "$1")
99
echo "$commit_msg"
1010

1111
# 添加短暂延迟等待commit完成
12-
# sleep 3
12+
# sleep 3
1313

1414
# 获取最新提交的签名状态
1515
LATEST_COMMIT=$(git rev-parse HEAD)

.husky/pre-commit

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,46 @@ fi
1414
if [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "win32" ] || [ "$OSTYPE" = "cygwin" ]; then
1515
# Windows 系统
1616
GPGSIGN=$(git config --get commit.gpgsign || echo "false")
17-
SSHSIGN=$(git config --get commit.sshsign || echo "false")
17+
GPG_FORMAT=$(git config --get gpg.format || echo "openpgp")
1818

1919
echo "检查GPG配置状态: $GPGSIGN"
20-
echo "检查SSH配置状态: $SSHSIGN"
20+
echo "检查GPG格式: $GPG_FORMAT"
2121

2222
if [ "$GPGSIGN" != "true" ]; then
23-
if [ "$SSHSIGN" = "true" ]; then
24-
echo -e "${YELLOW}警告: 当前使用 SSH 密钥签名${NC}"
25-
echo -e "${YELLOW}请改用 GPG 签名:${NC}"
26-
echo -e "${YELLOW}1. git config --global commit.sshsign false${NC}"
27-
echo -e "${YELLOW}2. git config --global commit.gpgsign true${NC}"
28-
exit 1
29-
else
30-
echo -e "${RED}错误: 未启用 GPG 签名${NC}"
31-
echo -e "${RED}请运行: git config --global commit.gpgsign true${NC}"
32-
exit 1
33-
fi
23+
echo -e "${RED}错误: 未启用提交签名${NC}"
24+
echo -e "${RED}请运行: git config --global commit.gpgsign true${NC}"
25+
exit 1
3426
fi
27+
28+
if [ "$GPG_FORMAT" = "ssh" ]; then
29+
echo -e "${YELLOW}警告: 当前使用 SSH 密钥签名${NC}"
30+
echo -e "${YELLOW}请改用 GPG 签名:${NC}"
31+
echo -e "${YELLOW}1. git config --global gpg.format openpgp${NC}"
32+
exit 1
33+
fi
34+
3535
echo -e "${GREEN}GPG签名检查通过 ✓${NC}"
3636
else
3737
# Linux系统
3838
GPGSIGN=$(git config --get commit.gpgsign || echo "false")
39-
SSHSIGN=$(git config --get commit.sshsign || echo "false")
39+
GPG_FORMAT=$(git config --get gpg.format || echo "openpgp")
4040

4141
printf "检查GPG配置状态: %s\n" "$GPGSIGN"
42-
printf "检查SSH配置状态: %s\n" "$SSHSIGN"
42+
printf "检查GPG格式: %s\n" "$GPG_FORMAT"
4343

4444
if [ "$GPGSIGN" != "true" ]; then
45-
if [ "$SSHSIGN" = "true" ]; then
46-
printf "${YELLOW}警告: 当前使用 SSH 密钥签名${NC}\n"
47-
printf "${YELLOW}请改用 GPG 签名:${NC}\n"
48-
printf "${YELLOW}1. git config --global commit.sshsign false${NC}\n"
49-
printf "${YELLOW}2. git config --global commit.gpgsign true${NC}\n"
50-
exit 1
51-
else
52-
printf "${RED}错误: 未启用 GPG 签名${NC}\n"
53-
printf "${RED}请运行: git config --global commit.gpgsign true${NC}\n"
54-
exit 1
55-
fi
45+
printf "${RED}错误: 未启用提交签名${NC}\n"
46+
printf "${RED}请运行: git config --global commit.gpgsign true${NC}\n"
47+
exit 1
5648
fi
49+
50+
if [ "$GPG_FORMAT" = "ssh" ]; then
51+
printf "${YELLOW}警告: 当前使用 SSH 密钥签名${NC}\n"
52+
printf "${YELLOW}请改用 GPG 签名:${NC}\n"
53+
printf "${YELLOW}1. git config --global gpg.format openpgp${NC}\n"
54+
exit 1
55+
fi
56+
5757
printf "${GREEN}GPG签名检查通过 ✓${NC}\n"
5858
fi
5959

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"docs:dev": "vuepress-vite dev src",
1111
"docs:update-package": "npx vp-update",
1212
"test": "jest",
13-
"coverage": "jest --coverage"
13+
"coverage": "jest --coverage",
14+
"prepare": "husky install"
1415
},
1516
"devDependencies": {
1617
"@babel/core": "^7.26.0",

0 commit comments

Comments
 (0)