builtin-commit: use reduce_heads() only when appropriate