The scan fails if the source code of a git branch is checked out in a worktree. In that case “.git” is a file containing the location of the actual “.git” directory for that worktree.
SonarQube Scanner MSBuild 22.214.171.1247
Git plugin 126.96.36.1998
Scanner log error of Jenkins job:
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to open Git repository
ERROR: Caused by: repository not found: F:\Sources\repositories\tools.git\worktrees\worktree-name
Content of “F:\Sources\worktrees\worktree-name.git” file inside the worktree directory:
The scanner has to resolve the content of the “.git” file to the actual “.git” directory.
We want to analyze multiple branches on the same machine, with worktrees we can checkout multiple branches at the same time from the same repository.
The workaround of having multiple clones of the same Git repository is not an option because our source code is too large.