@@ -165,10 +165,7 @@ func (w *GitWatcher) GetState() config.State {
165165func (w * GitWatcher ) watchTargets () (err error ) {
166166 targetRepos := make ([]gitwatch.Repository , len (w .state .Targets ))
167167 for i , t := range w .state .Targets {
168- dir := t .Name
169- if t .Branch != "" {
170- dir = fmt .Sprintf ("%s_%s" , t .Name , t .Branch )
171- }
168+ dir := getTargetPath (t )
172169 auth , err := w .getAuthForTarget (t )
173170 if err != nil {
174171 return err
@@ -235,6 +232,13 @@ func (w *GitWatcher) handle(e gitwatch.Event) (err error) {
235232 return nil
236233}
237234
235+ 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
240+ }
241+
238242func (w GitWatcher ) getAuthForTarget (t task.Target ) (transport.AuthMethod , error ) {
239243 for _ , a := range w .state .AuthMethods {
240244 if a .Name == t .Auth {
@@ -266,7 +270,7 @@ func (w GitWatcher) executeTargets(targets []task.Target, shutdown bool) {
266270 zap .Int ("targets" , len (targets )))
267271
268272 for _ , t := range targets {
269- w .__waitpoint__send_target_task (t , filepath .Join (w .directory , t . Name ), shutdown )
273+ w .__waitpoint__send_target_task (t , filepath .Join (w .directory , getTargetPath ( t ) ), shutdown )
270274 }
271275}
272276
0 commit comments