Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indra-git: fails to discover repository when project is not at repository root #165

Open
cbs228 opened this issue Jan 7, 2024 · 0 comments

Comments

@cbs228
Copy link

cbs228 commented Jan 7, 2024

The indra-git plugin fails to discover the containing repository if the gradle project does not reside at the repository root. This is not the case for monorepos, git-subtrees, and other repository structures that contain multiple projects.

From IndraGitService.java:115, it appears that the plugin discovers the repository like this:

final Repository repo = new RepositoryBuilder().setWorkTree(targetDir).setGitDir(realGit).setMustExist(true).build();

The upstream JGit documentation recommends using an approach like this:

new RepositoryBuilder()
                .setGitDir(gitDirArgument) // --git-dir if supplied, no-op if null
                .readEnviroment() // scan environment GIT_* variables
                .findGitDir() // scan up the file system tree
                .build()

where findGitDir() traverses up the filesystem like the git executable does.

If indra-git performed a filesystem traversal with findGitDir(), it would probably be compatible with monorepo layouts.

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

No branches or pull requests

1 participant