Skip to content

Fix revision metadata in Git worktrees - #758

Merged
ar merged 1 commit into
mainfrom
fix/issue-757
Aug 30, 2026
Merged

Fix revision metadata in Git worktrees#758
ar merged 1 commit into
mainfrom
fix/issue-757

Conversation

@ar-agt

@ar-agt ar-agt commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Any Gradle build invoked from a linked Git worktree fails during task input fingerprinting because the revision task assumes .git is a directory and dereferences a missing .git/HEAD.

Why This Change Was Made

  • resolve .git when it is either a directory or a worktree gitdir: pointer
  • resolve symbolic branch refs through the worktree's commondir
  • make the optional ref input null-safe
  • preserve detached-HEAD metadata and the existing unknown/unknown fallback for exported source

This uses Git's metadata files directly, without requiring the git executable or adding a dependency.

User Impact

jPOS can be built normally from linked Git worktrees, and generated revision.properties contains the correct branch/revision metadata. Builds from source exports without .git continue to work with unknown revision metadata.

Evidence

  • ./gradlew :jpos:compileJava --no-daemon from a linked worktree
  • ./gradlew jpos:check --no-daemon
  • verified createRevisionPropertyFile in an ordinary checkout, a branch worktree, a detached worktree, and a source export without .git

Fixes #757

@ar
ar merged commit 738cb1d into main Aug 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createRevisionPropertyFile fails in git worktrees: 'Cannot get property parent on null object' during input fingerprinting

2 participants