refactor libgit2 thread handle
add code coverage for remote clone test