Skip to content

Commit f60a363

Browse files
committed
fix: 还原预提交脚本
1 parent 001b99d commit f60a363

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

.husky/pre-commit

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
# 1) 将 /images/* 文章图片就近复制并更新引用
2-
# 记录迁移前的变更状态
3-
BEFORE_STATUS=$(git status --porcelain)
4-
52
pnpm migrate:images || exit 1
63

7-
# 检查迁移后是否有新的变更
8-
AFTER_STATUS=$(git status --porcelain)
9-
10-
if [ "$BEFORE_STATUS" != "$AFTER_STATUS" ]; then
11-
echo "检测到迁移脚本产生了变更,添加所有变更到暂存区以确保完整提交..."
12-
# 只添加由于迁移产生的变更,而不是用户未暂存的所有变更
13-
git add -u
14-
fi
4+
# 将迁移后的变更加入暂存,确保本次提交包含更新
5+
git add -A
156

167
# 2) 校验图片路径与命名(不合规则阻止提交)
178
pnpm lint:images || exit 1

0 commit comments

Comments
 (0)