You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Mridul Pathak (Jira)" <ji...@apache.org> on 2026/07/31 06:55:00 UTC

[jira] [Closed] (OFBIZ-13470) Gradle build fails in a linked git worktree because the git-hooks plugin assumes .git is a directory

     [ https://issues.apache.org/jira/browse/OFBIZ-13470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mridul Pathak closed OFBIZ-13470.
---------------------------------
    Fix Version/s: Upcoming Branch
                   24.09.08
       Resolution: Fixed

> Gradle build fails in a linked git worktree because the git-hooks plugin assumes .git is a directory
> ----------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-13470
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13470
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: 24.09.07
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Minor
>             Fix For: Upcoming Branch, 24.09.08
>
>
> Running any Gradle command (e.g. ./gradlew help) inside a linked git worktree of this repo fails during project configuration with:
> {code}
> Failed to create missing parent(s) for: <worktree>/.git/hooks/pre-push
> {code}
> *Cause:* build.gradle's gitHooks block uses the com.github.jakemarsden.git-hooks plugin, which defaults its hooks directory to $rootDir/.git/hooks. In a linked worktree, .git at the worktree root is a gitlink *file* (pointing at <main-repo>/.git/worktrees/<name>), not a directory, so the plugin's Files.createDirectories() call throws.
> *Repro:*
> {code}
> git worktree add ../ofbiz-worktree-test -b test-worktree-fix
> cd ../ofbiz-worktree-test
> ./gradlew help
> {code}
> *Fix:* resolve the hooks directory via `git rev-parse --git-common-dir` instead of relying on the plugin's default — this correctly points to the shared .git/hooks whether run from the main checkout or a worktree. Verified working in both a fresh worktree and the main checkout (pre-push checkstyle/codenarc checks unchanged there).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)