Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sagor999 committed Oct 21, 2022
1 parent 351fe35 commit f17f6ea
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions components/content-service/pkg/initializer/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,21 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping)
}

// make sure that folder itself is owned by gitpod user prior to doing git clone
//args := []string{"gitpod", ws.Location}
//cmd := exec.Command("chown", args...)
//res, cerr := cmd.CombinedOutput()
//if cerr != nil && !process.IsNotChildProcess(cerr) {
// err = git.OpFailedError{
// Args: args,
// ExecErr: cerr,
// Output: string(res),
// Subcommand: "chown",
// }
// return err
//}
// this is needed as otherwise git clone will fail if the folder is owned by root
if ws.RunAsGitpodUser {
args := []string{"gitpod", ws.Location}
cmd := exec.Command("chown", args...)
res, cerr := cmd.CombinedOutput()
if cerr != nil && !process.IsNotChildProcess(cerr) {
err = git.OpFailedError{
Args: args,
ExecErr: cerr,
Output: string(res),
Subcommand: "chown",
}
return err
}
}

log.WithField("stage", "init").WithField("location", ws.Location).Debug("Running git clone on workspace")
err = ws.Clone(ctx)
Expand Down

0 comments on commit f17f6ea

Please sign in to comment.