## GgitRemote GgitRemote |

## Synopsis

                        GgitRemote;
    enum                GgitRemoteDownloadTagsType;
    gint                (*GgitRemoteListCallback)           (const gchar *name,
                                                             GgitOId *oid,
                                                             GgitOId *loid,
                                                             gboolean local,
                                                             gpointer user_data);
    GgitRemote *        ggit_remote_new                     (GgitRepository *repository,
                                                             const gchar *url,
                                                             const gchar *fetch_spec,
                                                             GError **error);
    GgitRemote *        ggit_remote_ref                     (GgitRemote *remote);
    void                ggit_remote_unref                   (GgitRemote *remote);
    void                ggit_remote_save                    (GgitRemote *remote,
                                                             GError **error);
    const gchar *       ggit_remote_get_name                (GgitRemote *remote);
    const gchar *       ggit_remote_get_url                 (GgitRemote *remote);
    void                ggit_remote_connect                 (GgitRemote *remote,
                                                             gboolean direction,
                                                             GError **error);
    gboolean            ggit_remote_get_connected           (GgitRemote *remote);
    void                ggit_remote_disconnect              (GgitRemote *remote);
    void                ggit_remote_add_fetch_spec          (GgitRemote *remote,
                                                             const gchar *fetch_spec,
                                                             GError **error);
    void                ggit_remote_add_push_spec           (GgitRemote *remote,
                                                             const gchar *push_spec,
                                                             GError **error);
    void                ggit_remote_list                    (GgitRemote *remote,
                                                             GgitRemoteListCallback callback,
                                                             gpointer user_data,
                                                             GError **error);
    gboolean            ggit_remote_is_valid_url            (const gchar *url);
    gboolean            ggit_remote_is_supported_url        (const gchar *url);

## Object Hierarchy

      GBoxed
       +----GgitRemote

      GEnum
       +----GgitRemoteDownloadTagsType

## Description

## Details

### GgitRemote

    typedef struct _GgitRemote GgitRemote;

Represents a git remote.

### enum GgitRemoteDownloadTagsType

    typedef enum {
    	GGIT_REMOTE_DOWNLOAD_TAGS_AUTO = 0,
    	GGIT_REMOTE_DOWNLOAD_TAGS_NONE = 1,
    	GGIT_REMOTE_DOWNLOAD_TAGS_ALL  = 2
    } GgitRemoteDownloadTagsType;

`GGIT_REMOTE_DOWNLOAD_TAGS_AUTO` |
`GGIT_REMOTE_DOWNLOAD_TAGS_NONE` |
`GGIT_REMOTE_DOWNLOAD_TAGS_ALL` |

### GgitRemoteListCallback ()

    gint                (*GgitRemoteListCallback)           (const gchar *name,
                                                             GgitOId *oid,
                                                             GgitOId *loid,
                                                             gboolean local,
                                                             gpointer user_data);

The type of the callback functions for listing the references of a GgitRemote. See `ggit_remote_list()`.

`name` : | the name of the reference.
`oid` : | the reference's oid.
`loid` : | the reference's loid.
`local` : | if available locally.
`user_data` : | user-supplied data. [closure]
Returns : | 0 to go continue or a GgitError in case there was an error.

### ggit_remote_new ()

    GgitRemote *        ggit_remote_new                     (GgitRepository *repository,
                                                             const gchar *url,
                                                             const gchar *fetch_spec,
                                                             GError **error);

Creates a remote with the default refspecs in memory. You can use this when you have a URL instead of a remote's name.

`repository` : | a GgitRepository.
`url` : | the remote repository's URL.
`fetch_spec` : | the fetch refspec to use for this remote.
`error` : | a GError for error reporting, or `NULL`.
Returns : | a newly allocated GgitRemote. [transfer full]

### ggit_remote_ref ()

    GgitRemote *        ggit_remote_ref                     (GgitRemote *remote);

Atomically increments the reference count of `remote` by one. This function is MT-safe and may be called from any thread.

`remote` : | a GgitRemote.
Returns : | the passed in GgitRemote. [transfer none]

### ggit_remote_unref ()

    void                ggit_remote_unref                   (GgitRemote *remote);

Atomically decrements the reference count of `remote` by one. If the reference count drops to 0, `remote` is freed.

`remote` : | a GgitRemote.

### ggit_remote_save ()

    void                ggit_remote_save                    (GgitRemote *remote,
                                                             GError **error);

Saves a remote to its repository's configuration.

`remote` : | a GgitRemote.
`error` : | a GError or `NULL`.

### ggit_remote_get_name ()

    const gchar *       ggit_remote_get_name                (GgitRemote *remote);

Gets the remote's name.

`remote` : | a GgitRemote.
Returns : | the name of `remote`.

### ggit_remote_get_url ()

    const gchar *       ggit_remote_get_url                 (GgitRemote *remote);

Gets the remote's url.

`remote` : | GgitRemote.
Returns : | the url of `remote`.

### ggit_remote_connect ()

    void                ggit_remote_connect                 (GgitRemote *remote,
                                                             gboolean direction,
                                                             GError **error);

Opens a connection to a remote. The transport is selected based on the URL. The direction argument is due to a limitation of the git protocol (over TCP or SSH) which starts up a specific binary which can only do the one or the other.

`remote` : | a GgitRemote.
`direction` : | whether you want to receive or send data.
`error` : | a GError for error reporting, or `NULL`.

### ggit_remote_get_connected ()

    gboolean            ggit_remote_get_connected           (GgitRemote *remote);

Check whether `remote` is connected.

`remote` : | a GgitRemote.
Returns : | `TRUE` if it is connected.

### ggit_remote_disconnect ()

    void                ggit_remote_disconnect              (GgitRemote *remote);

Closes the connection to the remote and frees the underlying transport.

`remote` : | a GgitRemote.

### ggit_remote_add_fetch_spec ()

    void                ggit_remote_add_fetch_spec          (GgitRemote *remote,
                                                             const gchar *fetch_spec,
                                                             GError **error);

Sets `remote`'s fetch spec to `fetch_spec`.

`remote` : | a GgitRemote.
`fetch_spec` : | the fetch refspec.
`error` : | a GError for error reporting, or `NULL`.

### ggit_remote_add_push_spec ()

    void                ggit_remote_add_push_spec           (GgitRemote *remote,
                                                             const gchar *push_spec,
                                                             GError **error);

Sets `remote`'s push spec to `fetch_spec`.

`remote` : | a GgitRemote.
`push_spec` : | the push refspec.
`error` : | a GError for error reporting, or `NULL`.

### ggit_remote_list ()

    void                ggit_remote_list                    (GgitRemote *remote,
                                                             GgitRemoteListCallback callback,
                                                             gpointer user_data,
                                                             GError **error);

Calls `callback` for each ref at `remote`.

`remote` : | a GgitRemote.
`callback` : | a GgitRemoteListCallback. [scope call][closure user_data]
`user_data` : | callback user data.
`error` : | a GError for error reporting, or `NULL`.

### ggit_remote_is_valid_url ()

    gboolean            ggit_remote_is_valid_url            (const gchar *url);

Checks if `url` is a valid remote URL.

`url` : | a url string.
Returns : | whether a string is a valid remote URL.

### ggit_remote_is_supported_url ()

    gboolean            ggit_remote_is_supported_url        (const gchar *url);

Checks if `url` is a supported remote URL.

`url` : | a url string.
Returns : | whether a string is a supported remote URL.