Skip to content

Commit

Permalink
fix: do not crash the build in case old scripts exist
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Jan 7, 2022
1 parent 779280e commit 8aeecce
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class GitHooksExtension(val settings: Settings) : Serializable {
} else {
val oldScript = hook.readText()
if (oldScript != script) {
settings.gradle.rootProject.logger.warn(
println(
"""
|The hook $name exists, but its content differs from the one generated by the git-hooks plugin.
|
Expand All @@ -70,10 +70,10 @@ open class GitHooksExtension(val settings: Settings) : Serializable {
|
|New content:
|${script.withMargins()}
""".trimMargin()
""".trimMargin().lines().joinToString(separator = "\n") { "WARNING: $it" }
)
if (overwriteExisting) {
settings.gradle.rootProject.logger.warn("Overwriting git hook $name")
println("WARNING: Overwriting git hook $name")
hook.writeText(script)
}
}
Expand Down

0 comments on commit 8aeecce

Please sign in to comment.