Skip to content

Commit

Permalink
Remove the outer escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
keithduncan committed Aug 31, 2021
1 parent 922b375 commit 867eadf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions s3secrets-helper/secrets/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,21 @@ func handleGitCredentials(conf Config, results <-chan getResult) error {
}
log.Printf("Adding git-credentials in %s/%s as a credential helper", r.bucket, r.key)
helpers = append(helpers, fmt.Sprintf(
"'credential.helper=%s %s %s'",
"credential.helper=%s %s %s",
conf.GitCredentialHelper, r.bucket, r.key,
))
}
if len(helpers) == 0 {
return nil
}
env := "GIT_CONFIG_PARAMETERS=\"" + strings.Join(helpers, " ") + "\"\n"

var singleQuotedHelpers []string
for helper := range helpers {
singleQuotedHelpers = append(singleQuotedHelpers, "'" + helper + "'")
}

env := "GIT_CONFIG_PARAMETERS=\"" + strings.Join(singleQuotedHelpers, " ") + "\"\n"

if _, err := io.WriteString(conf.EnvSink, env); err != nil {
return fmt.Errorf("writing GIT_CONFIG_PARAMETERS env: %w", err)
}
Expand Down

0 comments on commit 867eadf

Please sign in to comment.