cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp

Home Page:https://cakebuild.net/extensions/cake-git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to use with Git CLI

pascalberger opened this issue · comments

Using LibGit2Sharp has some limitations and can lead to runtime errors. In some cases Git CLI is available and could be used to achieve the task. We could add a global switch to the addin to define if the addin should run in LibGit2Sharp or Git CLI mode and then have separate implementation for every alias (one with LibGit2Sharp, another with Git CLI).

Ideally it would not load LibGit2Sharp when used in Git CLI mode, but this would require a bigger refactoring and have LibGit2Sharp manually loaded at runtime.

Seems like a separate addin to me, there's some fundamental differences between libgit and git cli scripts.

Essentially an fairly complete libgit to cli abstraction would need to be created.

The downside of having it in a separate addin is that recipe scripts (like e.g. Cake.Issues.Recipe or Cake.Recipe) would need to implement the abstraction themselves if they want to have support for both, except a third addin which implements the abstraction is created, but this sound quite complicated to maintain, keep up to date and compatible. The advantage of separate addins would be that we can get rid of LibGit2Sharp completely (but this won't help if both addins were used together in a recipe script).

One way to solve not even loading libgit could be to move current Cake.Git libgit implementation out of process too, and have a common cli protocol. between the different git provider wrappers in Cake.Git. Would add complexity though, and likely a noticeable performance hit, especially since there's not a 1:1 mapping between git cli scripts and libgit library.
If all logic would be in Cake.Git would mean maintaining a multiple set of implementations for each alias, having one to one many commands emulate the other one.