Skip to content

Commit 51511a6

Browse files
committed
runner/v3: make observing git changes opt-in
1 parent 2e429ca commit 51511a6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

internal/runner/runner.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,16 @@ func (r *Runner) deleteServiceState(svc string) {
483483
}
484484

485485
func (s *Runner) monitorWorkDir(ctx context.Context) <-chan string {
486-
if isValidGitDir(s.WorkDir) {
487-
log.Println("observing git directory for changes")
488-
return s.monitorGitDir(ctx, s.WorkDir)
486+
if slices.Contains(s.Observables, ".git") {
487+
s.Observables = slices.DeleteFunc(s.Observables, func(observable string) bool {
488+
return observable == ".git"
489+
})
490+
if isValidGitDir(s.WorkDir) {
491+
log.Println("observing git directory for changes")
492+
return s.monitorGitDir(ctx, s.WorkDir)
493+
} else {
494+
log.Println("cannot detect git directory, falling back to file system watcher")
495+
}
489496
}
490497
return s.monitorWorkDirScanner(ctx)
491498
}

0 commit comments

Comments
 (0)