commit.c: allow get_cached_commit_buffer to handle arbitrary repositories