Closed pluttrell closed 7 years ago
The deprecated version of open
is the one taking a single un-named argument. The documentation of OpenOp shows the new methods, which take named arguments depending on how exactly you want to search for the git directory.
I've also updated that wiki page to use a non-deprecated call.
@ajoberstar Thanks for getting back to me. I tried the named versions with the latest version (1.7.2) of the plugin and the latest version of Intellij (2017.2) and still have the same problem.
In addition to dir:
, I've tried currentDir:
and see the same thing.
For reference here's the full build.gradle
that demonstrates what I'm seeing:
buildscript {
repositories {
jcenter()
}
}
plugins {
id "org.ajoberstar.grgit" version "1.7.2"
}
apply plugin: 'java'
repositories {
jcenter()
}
def repo = org.ajoberstar.grgit.Grgit.open(dir: '.')
task validateGitRepoClean {
doFirst {
assert repo.status().clean : 'Git repo found to contain uncommitted changes. A clean repo is required for this task'
}
}
This is an artifact of the way Grgit uses the Groovy MOP. The only concrete methods are the deprecated ones, so Intellij reports them that way.
This will be fixed in 2.0, but your usage is correct.
Intellij (2017.1 EAP) is reporting that the
Grgit.open()
method is deprecated. What should we use instead?I'm using
id "org.ajoberstar.grgit" version "1.6.0"
, which I understand to be the latest version.For reference, I chose this
open
method based on this wiki article.In case it matters, my use case is just to determine if my repo is clean/dirty, and I'm using
repo.status().clean
to determine such.