Frontend API for fetch, clone, merge, pull, push.
Hi John, thanks for your work on these packages!
I'm curious if you have any thoughts on what higher-level APIs for fetch, clone, merge, pull, and push operations might look like. As it stands, it looks like there's a bit of inconsistency among the backends with respect to how these operations are performed. As far as I can tell, this is how these operations are supported currently:
- Fetch: Provided by
Git.Libgit2.lgRemoteFetch. It looks likeMonadGitused to have aremoteFetchmethod. - Clone: Provided by
lgRemoteFetchfollowed byGit.Working.checkoutFiles. However,Bindings.Libgit2.Cloneis also provided; it's not clear what advantages using libgit2's convenience function for this might be. - Merge: At a low level, the caller can implement whatever "merge" strategy they want by directly manipulating blobs and trees, and creating a commit with multiple parents. However, it would be useful to provide an API for writing conflicts to the index for compatibility with the
gitcommand line tool. It doesn't look like thereadIndexorwriteIndexmethods are implemented anywhere. libgit2 provides a handy set of merge utility functions that'd be useful in the frontend API as well. - Pull: Provided by
lgRemoteFetchplus merging at a low-level with blobs and trees. - Push: We have
Git.Commit.Push.pushCommit, but something inGit.Libgit2that takes advantage of libgit2's (likely more efficient?) push functionality would be handy.
Am I missing anything obvious/more convenient here?
A potential issue with introducing a frontend API for these operations is the difference in functionality among existing and future backends. Perhaps MonadGit could be broken into smaller classes, allowing backends to implement specific subsets of the frontend API capabilities.
Some nice ideas, and I don't see that you've missed much. Do you want to take over maintenance of gitlib-libgit2 perhaps?
I'll take a crack at these as time allows, and if you're looking for a (co-)maintainer I'd be happy to help.
@TravisWhitaker Yes, someone to help move things forward would be fantastic. I haven't had much time for gitlib lately, but I'd be more than happy to assist.