You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if the GrgitService would have a way to determine whether grgit could be initialized or not instead of having a hard failure on get()-ing the service from the provider.
This makes using the grgit-service plugin a bit cumbersome.
You would currenltly use some construct like
val grgit by lazy(NONE) {
runCatching {
grgitService.service.get().grgit
}.getOrNull()
}
It would be nicer if the service initialization would not fail and instead the service provides the information whether grgit is available, for example by returning a null value like with the grgit plugin.
The text was updated successfully, but these errors were encountered:
Vampire
changed the title
Way to get
Way to get whther the grgit initialization was successful from the service
Feb 17, 2022
Vampire
changed the title
Way to get whther the grgit initialization was successful from the service
Way to get whether the grgit initialization was successful from the service
Feb 17, 2022
I made a point of keeping the org.ajoberstar.grgit behavior the same as in v4 (falling back to null) for backwards compatibility, but wanted to play out how big of a deal it would be for the service to hard fail. So the starting point was keep it simple for the new plugin and learn from user feedback.
I was thinking that in some cases, the action you're trying to do can't legitimately be performed if there is no repo. For example, if I have a task to push to a repository, I likely wouldn't want to run it if I had a copy of the project outside of a Git repo. Not sure if it should silently work in that case either, but maybe the user wants an easier way to make that decision for themselves.
Perhaps it should just return an Optional<Grgit> and make it more explicit to the user they need to handle that no-repo case.
It would be nice if the
GrgitService
would have a way to determine whethergrgit
could be initialized or not instead of having a hard failure onget()
-ing the service from the provider.This makes using the
grgit-service
plugin a bit cumbersome.You would currenltly use some construct like
It would be nicer if the service initialization would not fail and instead the service provides the information whether grgit is available, for example by returning a
null
value like with thegrgit
plugin.The text was updated successfully, but these errors were encountered: