This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 43fdd65fb5 Fixed: Gradle build failure in a linked git worktree
(OFBIZ-13470) (#1517)
43fdd65fb5 is described below
commit 43fdd65fb5b1274a94bc870ab4ab8cd90cb7217c
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Jul 31 12:22:57 2026 +0530
Fixed: Gradle build failure in a linked git worktree (OFBIZ-13470) (#1517)
Fixed: Gradle build failure in a linked git worktree (OFBIZ-13470)
`./gradlew` failed in a linked git worktree because the git-hooks plugin
assumed `$rootDir/.git/hooks` was a directory. In a worktree, `.git` is
a
gitlink file instead, so `Files.createDirectories()` threw. Now resolves
the hooks directory via `git rev-parse --git-common-dir`, which
correctly
points to the shared `.git/hooks` in both a normal checkout and a
worktree.
---
build.gradle | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/build.gradle b/build.gradle
index a676d084f7..0008973e47 100644
--- a/build.gradle
+++ b/build.gradle
@@ -337,6 +337,10 @@ checkstyle {
toolVersion = '10.20.2'
}
gitHooks {
+ // Resolve the real .git dir so this also works from a linked worktree,
+ // where "$rootDir/.git" (the plugin's default) is a gitlink file, not a
directory.
+ def gitCommonDir = "git -C ${rootDir} rev-parse
--git-common-dir".execute().text.trim()
+ hooksDirectory.set(new File(rootDir,
gitCommonDir).toPath().resolve('hooks').toFile())
hooks = ['pre-push': 'checkstyleMain codenarcMain codenarcTest']
}