Skip to content

Commit 4209fc0

Browse files
authored
fix #76 (#80)
1 parent c3d5e60 commit 4209fc0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

watcher/git.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func (w *GitWatcher) __waitpoint__watch_targets(errs chan error) (err error) {
220220
}
221221

222222
func (w *GitWatcher) handle(e gitwatch.Event) (err error) {
223-
target, exists := w.getTarget(e.URL)
223+
target, exists := w.getTarget(e.Path)
224224
if !exists {
225225
return errors.Errorf("attempt to handle event for unknown target %s at %s", e.URL, e.Path)
226226
}
@@ -233,10 +233,10 @@ func (w *GitWatcher) handle(e gitwatch.Event) (err error) {
233233
}
234234

235235
func getTargetPath(t task.Target) string {
236-
if t.Branch != "" {
237-
return fmt.Sprintf("%s_%s", t.Name, t.Branch)
238-
}
239-
return t.Name
236+
if t.Branch != "" {
237+
return fmt.Sprintf("%s_%s", t.Name, t.Branch)
238+
}
239+
return t.Name
240240
}
241241

242242
func (w GitWatcher) getAuthForTarget(t task.Target) (transport.AuthMethod, error) {
@@ -274,9 +274,10 @@ func (w GitWatcher) executeTargets(targets []task.Target, shutdown bool) {
274274
}
275275
}
276276

277-
func (w GitWatcher) getTarget(url string) (target task.Target, exists bool) {
277+
func (w GitWatcher) getTarget(path string) (target task.Target, exists bool) {
278278
for _, t := range w.state.Targets {
279-
if t.RepoURL == url {
279+
targetPath := filepath.Join(w.directory, getTargetPath(t))
280+
if targetPath == path {
280281
return t, true
281282
}
282283
}

0 commit comments

Comments
 (0)