Files

24 lines
816 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# post-merge — git merge / pull 完成后,从 fragment 源确定性重建 changelog 视图,
# 覆盖掉 merge=union 临时产生的乱序/重复内容。
# 若视图被重建(说明 union 留下了脏内容),提示用户提交一次。
ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
cd "$ROOT" || exit 0
BUILD=".cursor/changelog/tools/changelog_build.py"
[ -f "$BUILD" ] || exit 0
if command -v python >/dev/null 2>&1; then PY=python
elif command -v python3 >/dev/null 2>&1; then PY=python3
else exit 0
fi
PYTHONIOENCODING=utf-8 "$PY" "$BUILD" >/dev/null 2>&1 || exit 0
if ! git diff --quiet -- .cursor/changelog/changelog-*.md 2>/dev/null; then
echo "[changelog] 已从 fragment 源重建视图merge 后清理)。请 git add + commit 这些视图文件。"
fi
exit 0