fix:honor gpg.program in LoadPublicKeyFromGitConfig#1265
Conversation
4fcf6b4 to
087cc10
Compare
patzielinski
left a comment
There was a problem hiding this comment.
Thanks for reporting the issue and sending this PR in, @ayuxsh009.
The solution to this is simpler than the code in the PR, we just need to have the GPG case in LoadPublicKey inspect the Git config. We also want to mirror the behavior of signerverifier, where the Git config is always inspected for the preferred GPG program.
Please make the changes I've suggested, squash commits when done, and we should get this merged soon. Thanks!
087cc10 to
b0056d6
Compare
Implemented. I moved the fix into LoadPublicKey so the GPG path now checks Git config for gpg.program (with fallback to gpg), matching signer behavior. I also squashed this PR to one commit. |
b0056d6 to
566c3e4
Compare
566c3e4 to
1ffc75f
Compare
1ffc75f to
9d0da60
Compare
Signed-off-by: ayuxsh009 <1raj.aayush@gmail.com>
9d0da60 to
05f1868
Compare
|
@adityasaky I've reworked this to now support using the user's chosen |
| return nil, fmt.Errorf("unable to read Git config: %w", err) | ||
| } | ||
| } else { | ||
| output, err := exec.Command("config", "--global", "--get-regexp", `.*`).Output() |
There was a problem hiding this comment.
Missing git? Guessing this is not tested then? 😄
There was a problem hiding this comment.
Also do we need --global here?
| func GetGitConfig(repo *Repository) (map[string]string, error) { | ||
| var stdOut string | ||
| var err error | ||
|
|
||
| if repo != nil { | ||
| stdOut, err = repo.executor("config", "--get-regexp", `.*`).executeString() |
There was a problem hiding this comment.
given this is part of the now public gitinterface package, I wonder if this should be part of (r *Repository) still. If we're anyway going to use exec.Command, that can happen in exp/gittuf which wraps this. We're not benefiting from the repo.executor pattern anyway.
Description
Fixes #1261.
LoadPublicKeyFromGitConfig previously ignored gpg.program and always executed gpg from PATH.
LoadSignerFromGitConfig already honored gpg.program, which caused inconsistent behavior in minimal PATH environments.
This PR:
Testing performed:
AI Usage
Contributor Checklist