Skip to content

Commit

Permalink
feat: add user git config props
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpuljak committed Feb 23, 2024
1 parent a765314 commit 1e4d399
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module provisioner_plugin
go 1.21.6

require (
github.com/daytonaio/daytona v0.0.1-alpha.25
github.com/daytonaio/daytona v0.0.1-alpha.26
github.com/docker/docker v24.0.7+incompatible
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-plugin v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/daytonaio/daytona v0.0.1-alpha.25 h1:46tbr6vvES7ky+CoxhQqQMC23G8ZZf0jF8leN+DMLzU=
github.com/daytonaio/daytona v0.0.1-alpha.25/go.mod h1:JlzUaxEItwtgYgeGwPdwGCbGzsj2MGauAQVeqaaYGso=
github.com/daytonaio/daytona v0.0.1-alpha.26 h1:e6cj6JNqae++ae73aOOOJGPWdc2CNkYczDFnnhi1SEo=
github.com/daytonaio/daytona v0.0.1-alpha.26/go.mod h1:/ihpsJ/i4PpVEyKkZenyq+PcnFSXonpTQHxQ0ucPUaY=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
Expand Down
9 changes: 9 additions & 0 deletions plugin/util/git_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ func SetGitConfig(project *types.Project, user string) error {

cfg.Section("credential").NewKey("helper", "/usr/local/bin/daytona git-cred")

if project.Repository != nil && project.Repository.GitUserData != nil {
if !cfg.HasSection("user") {
cfg.NewSection("user")
}

cfg.Section("user").NewKey("name", project.Repository.GitUserData.Name)
cfg.Section("user").NewKey("email", project.Repository.GitUserData.Email)
}

var buf bytes.Buffer
_, err = cfg.WriteTo(&buf)
if err != nil {
Expand Down

0 comments on commit 1e4d399

Please sign in to comment.