spotless
spotless copied to clipboard
fix(plugin-gradle): Try to locate the git system config without executing any processes
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