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

Support git worktrees #81

Open
danhaywood opened this issue Oct 17, 2023 · 2 comments
Open

Support git worktrees #81

danhaywood opened this issue Oct 17, 2023 · 2 comments

Comments

@danhaywood
Copy link

I found that running mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0-M1:htmlReport from an alternative git worktree resulted in no output.

git checkout prod
mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0-M1:htmlReport   # works fine here

git branch temp                    # create a new branch at the same git commit
git worktree add ../other temp     # checkout 'temp' branch in other worktree
cd ../other
mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0-M1:htmlReport   # no output if run here
@jimbethancourt
Copy link
Collaborator

Hi @danhaywood,
Thanks so much for the idea and steps to reproduce. 😁 Although this isn't my top priority at the moment, I know worktrees are definitely used. Looking through the jgit javadocs, it looks like jgit does support worktrees.

It may not require much change in the code to support worktrees - the biggest issue will be finding the right calls to make to jgit! Would you be up for creating a PR?

Thanks,
Jim

@jimbethancourt
Copy link
Collaborator

@danhaywood Looks like this is possible now with the 7.0 stream of JGit, but it would also require that projects use Java 17. Check out https://projects.eclipse.org/projects/technology.jgit/releases/7.0.0

With as many projects that are still using Java 11, I'm hesitant to move to JGit 7 at this time. NewRelic provided statistics earlier this year in https://newrelic.com/sites/default/files/2024-05/new-relic-state-of-the-java-ecosystem-2024-05-29.pdf on the graph on page 5.

However, once I'm able to create a native binary, then I could easily remove the language level requirement and point folks who use older versions of Java in their project to the native executable.

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

2 participants