Skip to content

Commit

Permalink
Unshallow repo after workspace is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 authored and roboquat committed Nov 26, 2021
1 parent 915cd41 commit 19b6154
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions components/supervisor/pkg/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,24 +310,26 @@ func Run(options ...RunOption) {
}()
}

go func() {
<-cstate.ContentReady()
if !cfg.isHeadless() {
go func() {
<-cstate.ContentReady()

start := time.Now()
defer func() {
log.Debugf("unshallow of local repository took %v", time.Since(start))
start := time.Now()
defer func() {
log.Debugf("unshallow of local repository took %v", time.Since(start))
}()

cmd := runAsGitpodUser(exec.Command("git", "fetch", "--unshallow", "--tags"))
cmd.Env = buildChildProcEnv(cfg, nil)
cmd.Dir = cfg.RepoRoot
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil && !(err.Error() == "wait: no child processes" || err.Error() == "waitid: no child processes") {
log.WithError(err).Error("git fetch error")
}
}()

cmd := runAsGitpodUser(exec.Command("git", "fetch", "--depth", "20"))
cmd.Env = buildChildProcEnv(cfg, nil)
cmd.Dir = cfg.RepoRoot
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil && !(err.Error() == "wait: no child processes" || err.Error() == "waitid: no child processes") {
log.WithError(err).Error("git fetch error")
}
}()
}

sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
Expand Down

0 comments on commit 19b6154

Please sign in to comment.