MCPcopy Index your code
hub / github.com/coder/coder / NewHandler

Function NewHandler

agent/agentgit/agentgit.go:80–99  ·  view source on GitHub ↗

NewHandler creates a new git watch handler.

(logger slog.Logger, opts ...Option)

Source from the content-addressed store, hash-verified

78
79// NewHandler creates a new git watch handler.
80func NewHandler(logger slog.Logger, opts ...Option) *Handler {
81 h := &Handler{
82 logger: logger,
83 clock: quartz.NewReal(),
84 gitBin: "git",
85 repoRoots: make(map[string]struct{}),
86 lastSnapshots: make(map[string]repoSnapshot),
87 scanTrigger: make(chan struct{}, 1),
88 }
89 for _, opt := range opts {
90 opt(h)
91 }
92
93 // Check if git is available.
94 if _, err := exec.LookPath(h.gitBin); err != nil {
95 h.logger.Warn(context.Background(), "git binary not found, git scanning disabled")
96 }
97
98 return h
99}
100
101// gitAvailable returns true if the configured git binary can be found
102// in PATH.

Calls

no outgoing calls