Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion AnkiDroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,15 @@ play {
}

// Install Git pre-commit hook for Ktlint
// Resolve via git so worktrees (where `.git` is a file) are handled correctly.
def gitHooksDir = providers.exec {
workingDir = rootProject.rootDir
commandLine "git", "rev-parse", "--git-path", "hooks"
}.standardOutput.asText.map { rootProject.rootDir.toPath().resolve(it.trim()).toFile() }

tasks.register('installGitHook', Copy) {
from new File(rootProject.rootDir, 'pre-commit')
into { new File(rootProject.rootDir, '.git/hooks') }
into gitHooksDir
filePermissions {
user {
read = write = execute = true
Expand Down
Loading