Skip to content

build: support running in a git worktree (RAT, git-status) - #5165

Open
dsmiley wants to merge 2 commits into
apache:mainfrom
dsmiley:rat-git-worktree
Open

dsmiley wants to merge 2 commits into
apache:mainfrom
dsmiley:rat-git-worktree

Conversation

@dsmiley

@dsmiley dsmiley commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

In a git worktree .git is a file, not a directory, and JGit's FileRepositoryBuilder.setWorkTree(...) alone doesn't resolve it.

  • rat: treated the checkout as a source release and scanned files that are normally excluded (dev-docs, .github, AGENTS.md, dotfiles), failing with ~100 "Unknown license" files.
  • gitStatus / checkWorkingCopyClean: reported "(not a git checkout)" and skipped the dirty-files check with a "worktrees are not supported by jgit" warning.

Both now call findGitDir(projectDir), which follows the worktree's .git file. The now-unreachable worktree warning is removed.

Tested: rat passes from a worktree, and checkWorkingCopyClean detects modified files there without the warning. rat, checkWorkingCopyClean and gitStatus also pass from a normal clone.

🤖 AI generated with Claude Code

In a worktree .git is a file, not a directory, so RAT mistook it for a
source release and scanned files that are normally excluded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dsmiley dsmiley changed the title build: RAT: support running in a git worktree build: support running in a git worktree (RAT, git-status) Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant