### Method

# Ggit Repository get_ahead_behind

#### Declaration [src]

    void
    ggit_repository_get_ahead_behind (
      GgitRepository* repository,
      GgitOId* local,
      GgitOId* upstream,
      gsize* ahead,
      gsize* behind,
      GError** error
    )

#### Description [src]

Count the number of unique commits between two commit objects.

There is no need for branches containing the commits to have any upstream relationship, but it helps to think of one as a branch and the other as its upstream, the `ahead` and `behind` values will be what git would report for the branches.

#### Parameters

`local`

  Type: `GgitOId`

  The commit for local.

  The data is owned by the caller of the method.

`upstream`

  Type: `GgitOId`

  The commit for upstream.

  The data is owned by the caller of the method.

`ahead`

  Type: `gsize*`

  Number of unique from commits in `upstream`.

  The argument will be set by the function.

`behind`

  Type: `gsize*`

  Number of unique from commits in `local`.

  The argument will be set by the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.