commit: skip discarding the index if there is no pre-commit hook