packfile: allow rearrange_packed_git to handle arbitrary repositories