improve post-commit hook code