mirror of https://github.com/apache/lucene.git
LUCENE-9184, LUCENE-9183: allow skipping git status check in precommit with -Pvalidation.git.failOnModified=false (or place this in gradle.properties to make it permanent).
This commit is contained in:
parent
7dc35e3a62
commit
ff635cf701
|
@ -15,8 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This adds top-level 'precommit' task with essential
|
||||
// precommit validation checks.
|
||||
// This verifies local git repository's status.
|
||||
|
||||
import org.eclipse.jgit.api.*;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
|
@ -73,7 +72,17 @@ configure(rootProject) {
|
|||
}.sort()
|
||||
|
||||
if (offenders) {
|
||||
throw new GradleException("Working copy is not a clean git checkout, offending files:\n${offenders.join("\n")}")
|
||||
def checkProp = "validation.git.failOnModified"
|
||||
def shouldFail = Boolean.valueOf(propertyOrDefault(checkProp, true))
|
||||
def message = "Working copy is not a clean git checkout" +
|
||||
(shouldFail ? " (skip with -P${checkProp}=false)" : "") +
|
||||
", offending files:\n${offenders.join("\n")}"
|
||||
|
||||
if (shouldFail) {
|
||||
throw new GradleException(message)
|
||||
} else {
|
||||
logger.lifecycle("NOTE: ${message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue