commit: allow prepare_commit_graft to handle arbitrary repositories