Shivam | Spotless Pre-commit Hook (#3877)
This commit is contained in:
committed by
GitHub Enterprise
parent
dea3de2b42
commit
2ca6152fd4
@@ -30,3 +30,15 @@ spotless {
|
||||
googleJavaFormat().aosp()
|
||||
}
|
||||
}
|
||||
|
||||
task createSpotlessPreCommitHook() {
|
||||
def gitHooksDirectory = new File("$project.rootDir/.git/hooks/")
|
||||
if (!gitHooksDirectory.exists()) gitHooksDirectory.mkdirs()
|
||||
new File("$project.rootDir/.git/hooks", "pre-commit").text =
|
||||
"""#!/bin/sh
|
||||
set -e
|
||||
./gradlew -PdisableSpotlessCheck spotlessApply
|
||||
git update-index --again :/:
|
||||
"""
|
||||
"chmod +x .git/hooks/pre-commit".execute()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user