@@ -165,10 +165,7 @@ func (w *GitWatcher) GetState() config.State {
165
165
func (w * GitWatcher ) watchTargets () (err error ) {
166
166
targetRepos := make ([]gitwatch.Repository , len (w .state .Targets ))
167
167
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 )
172
169
auth , err := w .getAuthForTarget (t )
173
170
if err != nil {
174
171
return err
@@ -235,6 +232,13 @@ func (w *GitWatcher) handle(e gitwatch.Event) (err error) {
235
232
return nil
236
233
}
237
234
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
+
238
242
func (w GitWatcher ) getAuthForTarget (t task.Target ) (transport.AuthMethod , error ) {
239
243
for _ , a := range w .state .AuthMethods {
240
244
if a .Name == t .Auth {
@@ -266,7 +270,7 @@ func (w GitWatcher) executeTargets(targets []task.Target, shutdown bool) {
266
270
zap .Int ("targets" , len (targets )))
267
271
268
272
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 )
270
274
}
271
275
}
272
276
0 commit comments