refs: failing test for concurrent ref access

If we remove a reference while we're iterating through the packed refs,
the position in the iterator will be off.
refs: copy the packed refs on iteration

This lets us work without worrying about what's happening but work on a
snapshot.
clone: re-use the local transport's path resolution

Whe already worked out the kinks with the function used in the local
transport. Expose it and make use of it in the local clone method
instead of trying to work it out again.
Merge pull request #2395 from libgit2/cmn/ref-iter-concurrent

Concurrent ref iterator access
Merge pull request #2399 from libgit2/cmn/path-to-path

clone: re-use the local transport's path resolution