-
Notifications
You must be signed in to change notification settings - Fork 75
Description
What happened?
Currently applying the plugin throws an exception if the project is not inside a git repository (i.e. .git folder is missing).
What did you want to happen?
It would be nice if it was possible to define/enable some kind of fallback version (for example "UNKNOWN") if the git repo can't be found.
gitVersion() would then return this fallback version.
versionDetails() could either return null if the git repo is missing or include a boolean field indicating if the repo was found and empty/default values for other fields.
Alternatively just pushing the exception into gitVersion() and versionDetails() instead of throwing it as soon as the plugin is applied would make it much cleaner for people to manually implement fallback version support using a try-catch block.
This would be useful in cases where you for whatever reason have the code without the git repo and want to run a build and don't care about the version.
One possible use case for this as pointed out in #327 is running unit tests in the CI where code might be copied in without the git repo itself.
Also in general the current behavior forces you to be constantly paranoid about copying the code and the git repo together no matter what you actually want to do with the code.