cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp
https://cakebuild.net/extensions/cake-git
Other
39 stars 64 forks source link

Allow to use with Git CLI #146

Open pascalberger opened 3 years ago

pascalberger commented 3 years ago

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.

devlead commented 3 years ago

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.

pascalberger commented 3 years ago

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).

devlead commented 3 years ago

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.