Skip to content

Commit 0712aea

Browse files
committed
Move hook setup back inside configureGit
1 parent a9290d7 commit 0712aea

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

components/supervisor/pkg/supervisor/supervisor.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,7 @@ func Run(options ...RunOption) {
220220
}
221221
symlinkBinaries(cfg)
222222

223-
configureGit(cfg)
224-
go func() {
225-
<-cstate.ContentReady()
226-
if cfg.CommitAnnotationEnabled && !cfg.isHeadless() {
227-
if err := setupGitMessageHook(filepath.Join(cfg.RepoRoot, ".git", "hooks")); err != nil {
228-
log.WithError(err).Error("cannot setup git message hook")
229-
}
230-
}
231-
}()
223+
configureGit(cfg, cstate.ContentReady())
232224

233225
telemetry := analytics.NewFromEnvironment()
234226
defer telemetry.Close()
@@ -812,7 +804,7 @@ func symlinkBinaries(cfg *Config) {
812804
}
813805
}
814806

815-
func configureGit(cfg *Config) {
807+
func configureGit(cfg *Config, contentReady <-chan struct{}) {
816808
settings := [][]string{
817809
{"push.default", "simple"},
818810
{"alias.lg", "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"},
@@ -836,6 +828,15 @@ func configureGit(cfg *Config) {
836828
log.WithError(err).WithField("args", s).Warn("git config error")
837829
}
838830
}
831+
832+
go func() {
833+
<-contentReady
834+
if cfg.CommitAnnotationEnabled && !cfg.isHeadless() {
835+
if err := setupGitMessageHook(filepath.Join(cfg.RepoRoot, ".git", "hooks")); err != nil {
836+
log.WithError(err).Error("cannot setup git message hook")
837+
}
838+
}
839+
}()
839840
}
840841

841842
const hookContent = `#!/bin/sh

0 commit comments

Comments
 (0)