Fetch performs a `git fetch` call. The number of new CLs locally and remotely for the current branch is returned.
(ctx context.Context)
| 22 | // Fetch performs a `git fetch` call. |
| 23 | // The number of new CLs locally and remotely for the current branch is returned. |
| 24 | func (g Git) Fetch(ctx context.Context) (localNew, remoteNew int, err error) { |
| 25 | if _, _, err := g.run(ctx, "fetch"); err != nil { |
| 26 | return -1, -1, err |
| 27 | } |
| 28 | str, _, err := g.run(ctx, "rev-list", "--count", "--left-right", Head+"..."+FetchHead) |
| 29 | if err != nil { |
| 30 | return -1, -1, err |
| 31 | } |
| 32 | fmt.Sscanf(str, "%d %d", &localNew, &remoteNew) |
| 33 | return localNew, remoteNew, nil |
| 34 | } |