Skip to content

fix(plugin-gradle): Try to locate the git system config without executing any processes #2514

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

Merged
merged 3 commits into from
Jul 22, 2025

Conversation

zml2008
Copy link
Contributor

@zml2008 zml2008 commented Jun 16, 2025

While it's not possible to match git's behavior exactly, this attempts to read the system gitconfig correcting a regression from 6.21.0 to 6.22.0.

This is a pretty ugly "fix" for the issue -- I came to this approach after trying to use Gradle's ExecOperations to wrap calls out to git, which failed since the subprocess creation happens at configuration time. Looking at git's logic to locate a system config file, this implementation is close-ish -- git's behaviour is determined by some compile-time flags, so to get exact behaviour we would have to call out to the actual git implementation. I'd love to see a better approach, but this is where I got after an afternoon of poking around so I thought I'd toss it up.

Fixes #2404

…ting any processes

While it's not possible to match cgit's behavior exactly, this
attempts to read the system gitconfig correcting a regression from 6.21.0 to 6.22.0.

Fixes diffplug#2404
@nedtwigg
Copy link
Member

  • Sorry this has been stuck. We are about to bump our minimums Bump the min Gradle and Java requirements to 7.3 and 17 #2540
  • This will allow us to bump our JGit from its current 6.10.1.202505221210-r to its latest 7.3.0.202506031305-r
  • I think this might make the fix in this PR unnecessary
  • If I'm wrong about that then I'll look at this more carefully and merge it

@nedtwigg
Copy link
Member

I was wrong, updating to JGit 7.3 did not solve our problems. Assuming that CI passes I'll merge this in.

@zml2008
Copy link
Contributor Author

zml2008 commented Jul 22, 2025

thanks!

@nedtwigg nedtwigg merged commit 9bc702f into diffplug:main Jul 22, 2025
19 checks 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.

Investigate git-diff windows line ending issues in Spotless 7.0+
2 participants