Add flexibility when dealing with index entries

Let `IndexEntry` instances live independent of their original index and bring some memory safety. Move to get an own copy of each instead of pointing to the copy inside the index, which we cannot trust to keep existing.

Allow creation of IndexEntry instances, which we need in order to make working with bare repositories more comfortable.