chore(sync): detect merge commits explicitly in post-commit hook

This commit is contained in:
2026-04-24 23:00:49 +02:00
parent 4fcff2367a
commit 500e5704e2

View File

@@ -17,7 +17,16 @@ if [ ! -f "${CONF_FILE}" ] || [ ! -f "${SYNC_SCRIPT}" ]; then
fi
# Files changed in the commit we just made.
changed="$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null || true)"
# Merge commits: `git diff-tree HEAD` without a range returns the
# combined-condensed diff (empty for clean, no-conflict merges),
# which would skip regen on merges that bring in watched files via
# the merged branch. Use a range against the first parent when HEAD
# has two parents; plain HEAD for regular commits.
if git rev-parse --verify HEAD^2 >/dev/null 2>&1; then
changed="$(git diff-tree --no-commit-id --name-only -r HEAD^1 HEAD 2>/dev/null || true)"
else
changed="$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null || true)"
fi
if [ -z "${changed}" ]; then
exit 0
fi