From 7a112380dee4f9165fa622265d35ec23af07f436 Mon Sep 17 00:00:00 2001 From: Pascal Breuninger Date: Tue, 14 Jan 2025 16:56:53 +0100 Subject: [PATCH] chore(git): ignore git config exit code --- pkg/gitcredentials/gitcredentials.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/gitcredentials/gitcredentials.go b/pkg/gitcredentials/gitcredentials.go index 23e7cc073..bbfe7e2be 100644 --- a/pkg/gitcredentials/gitcredentials.go +++ b/pkg/gitcredentials/gitcredentials.go @@ -242,11 +242,9 @@ func GetHTTPPath(ctx context.Context, params GetHttpPathParameters) (string, err // Check if we need to respect gits `credential.useHttpPath` // The actual format for the key is `credential.$PROTOCOL://$HOST.useHttpPath`, i.e. `credential.https://github.com.useHttpPath` + // We need to ignore the error as git will always exit with 1 if the key doesn't exist configKey := fmt.Sprintf("credential.%s://%s.useHttpPath", params.Protocol, params.Host) - out, err := git.CommandContext(ctx, "config", "--get", configKey).Output() - if err != nil { - return "", fmt.Errorf("inspect useHttpPath for host %s: %w", params.Host, err) - } + out, _ := git.CommandContext(ctx, "config", "--get", configKey).Output() if strings.TrimSpace(string(out)) != "true" { return "", nil }