pull clones or pulls from the remote Git repository.
(ctx context.Context, userTriggered, force bool)
| 36 | |
| 37 | // pull clones or pulls from the remote Git repository. |
| 38 | func (r *gitRepo) pull(ctx context.Context, userTriggered, force bool) error { |
| 39 | // Call pullInner with retries |
| 40 | var err error |
| 41 | for i := 0; i < gitRetryN; i++ { |
| 42 | err = r.pullInner(ctx, userTriggered, force) |
| 43 | if err == nil { |
| 44 | break |
| 45 | } |
| 46 | if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { |
| 47 | break |
| 48 | } |
| 49 | select { |
| 50 | case <-time.After(gitRetryWait): |
| 51 | case <-ctx.Done(): |
| 52 | return ctx.Err() |
| 53 | } |
| 54 | } |
| 55 | return err |
| 56 | } |
| 57 | |
| 58 | // pullInner contains the actual logic of r.pull without retries. |
| 59 | func (r *gitRepo) pullInner(ctx context.Context, userTriggered, force bool) error { |