-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support: Recomended way to check if in git directory. #397
Comments
In your plugin, you could do something like: try {
var grgitExtension = project.getExtensions().getBytType(GrgitServiceExtension.class);
var grgit = grgitExtension.getService().getGrgit();
// if it exists
} catch (IllegalStateException e) {
// if no git repo
} |
Would something like try {
var grgit = Grgit.open();
} catch (Exception e) {
} Also work? |
spacey-sooty
added a commit
to spacey-sooty/GradleRIO
that referenced
this issue
Mar 28, 2024
not sure if this works see ajoberstar/grgit#397
Yes, just be mindful of the behavior of Grgit.open with no args. Generally this wouldn't be an issue, but Gradle historically didn't guarantee the working directory matches the project directory, so it could cause it to find the wrong Git repo. |
spacey-sooty
added a commit
to spacey-sooty/GradleRIO
that referenced
this issue
Mar 28, 2024
requires ajoberstar/grgit#399 Try use grgit to check if in git repo not sure if this works see ajoberstar/grgit#397 fix grgit
spacey-sooty
added a commit
to spacey-sooty/GradleRIO
that referenced
this issue
Jun 30, 2024
requires ajoberstar/grgit#399 Try use grgit to check if in git repo not sure if this works see ajoberstar/grgit#397 fix grgit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a Gradle plugin that will log extra data related to git info if within a git directory. What would be the recomended way to check this?
The text was updated successfully, but these errors were encountered: