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

Method Subscribe

agent/agentgit/agentgit.go:111–138  ·  view source on GitHub ↗

Subscribe processes a subscribe message, resolving paths to git repo roots and adding new repos to the watch set. Returns true if any new repo roots were added.

(paths []string)

Source from the content-addressed store, hash-verified

109// roots and adding new repos to the watch set. Returns true if any new
110// repo roots were added.
111func (h *Handler) Subscribe(paths []string) bool {
112 if !h.gitAvailable() {
113 return false
114 }
115
116 h.mu.Lock()
117 defer h.mu.Unlock()
118
119 added := false
120 for _, p := range paths {
121 if !filepath.IsAbs(p) {
122 continue
123 }
124 p = filepath.Clean(p)
125
126 root, err := findRepoRoot(h.gitBin, p)
127 if err != nil {
128 // Not a git path — silently ignore.
129 continue
130 }
131 if _, ok := h.repoRoots[root]; ok {
132 continue
133 }
134 h.repoRoots[root] = struct{}{}
135 added = true
136 }
137 return added
138}
139
140// RequestScan pokes the scan trigger so the run loop performs a scan.
141func (h *Handler) RequestScan() {

Implementers 8

dispatchInterceptorcoderd/notifications/utils_test.go
chanHandlercoderd/notifications/utils_test.go
barrierHandlercoderd/notifications/metrics_test.go
fakeHandlercoderd/notifications/notifications_tes
santaHandlercoderd/notifications/manager_test.go
InboxHandlercoderd/notifications/dispatch/inbox.go
SMTPHandlercoderd/notifications/dispatch/smtp.go
WebhookHandlercoderd/notifications/dispatch/webhook.

Calls 4

gitAvailableMethod · 0.95
findRepoRootFunction · 0.85
LockMethod · 0.45
UnlockMethod · 0.45