GgitRemote: libgit2-glib Reference Manual

## GgitRemote GgitRemote |

## Functions

gint | (*GgitRemoteListCallback) ()
GgitRemote * | ggit_remote_new ()
const gchar * | ggit_remote_get_name ()
const gchar * | ggit_remote_get_url ()
void | ggit_remote_connect ()
gboolean | ggit_remote_get_connected ()
void | ggit_remote_disconnect ()
GgitRemoteHead ** | ggit_remote_list ()
GgitOId * | ggit_remote_head_get_local_oid ()
const gchar * | ggit_remote_head_get_name ()
GgitOId * | ggit_remote_head_get_oid ()
GType | ggit_remote_head_get_type ()
gboolean | ggit_remote_head_is_local ()
GgitRemoteHead * | ggit_remote_head_ref ()
void | ggit_remote_head_unref ()

## Types and Values

| GgitRemote
| GgitRemoteHead
enum | GgitRemoteDownloadTagsType

## Object Hierarchy

        GBoxed
        ╰── GgitRemoteHead
        GEnum
        ╰── GgitRemoteDownloadTagsType
        GObject
        ╰── GgitObjectFactoryBase
            ╰── GgitNative
                ╰── GgitRemote

## Description

## Functions

### 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()`.

#### Parameters

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 *name,
                     const gchar *url,
                     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.

#### Parameters

repository | a GgitRepository. |
name | the remote's name. |
url | the remote repository's URL. |
error | a GError for error reporting, or `NULL`. |

#### Returns

a newly allocated GgitRemote.

[transfer full]

### ggit_remote_get_name ()

    const gchar *
    ggit_remote_get_name (GgitRemote *remote);

Gets the remote's name.

#### Parameters

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.

#### Parameters

remote | GgitRemote. |

#### Returns

the url of `remote` .

### ggit_remote_connect ()

    void
    ggit_remote_connect (GgitRemote *remote,
                         GgitDirection direction,
                         GgitRemoteCallbacks *callbacks,
                         const gchar * const *custom_headers,
                         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.

#### Parameters

remote | a GgitRemote. |
direction | whether you want to receive or send data. |
callbacks | the callbacks to use for this connection. |
custom_headers | extra HTTP headers to use in this connection. | [allow-none]
error | a GError for error reporting, or `NULL`. |

### ggit_remote_get_connected ()

    gboolean
    ggit_remote_get_connected (GgitRemote *remote);

Check whether `remote` is connected.

#### Parameters

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.

#### Parameters

remote | a GgitRemote. |

### ggit_remote_list ()

    GgitRemoteHead **
    ggit_remote_list (GgitRemote *remote,
                      GError **error);

Get a list of refs at the remote.

#### Parameters

remote | a GgitRemote. |
error | a GError for error reporting, or `NULL`. |

#### Returns

the remote heads.

[array zero-terminated=1]

### ggit_remote_head_get_local_oid ()

    GgitOId *
    ggit_remote_head_get_local_oid (GgitRemoteHead *remote_head);

Get the local oid of the remote head.

#### Parameters

remote_head | a GgitRemoteHead. |

#### Returns

the local oid.

[transfer none]

### ggit_remote_head_get_name ()

    const gchar *
    ggit_remote_head_get_name (GgitRemoteHead *remote_head);

Get the remote head name.

#### Parameters

remote_head | a GgitRemoteHead. |

#### Returns

the remote head name.

### ggit_remote_head_get_oid ()

    GgitOId *
    ggit_remote_head_get_oid (GgitRemoteHead *remote_head);

Get the remote oid of the remote head.

#### Parameters

remote_head | a GgitRemoteHead. |

#### Returns

the remote oid.

[transfer none]

### ggit_remote_head_get_type ()

    GType
    ggit_remote_head_get_type (void);

### ggit_remote_head_is_local ()

    gboolean
    ggit_remote_head_is_local (GgitRemoteHead *remote_head);

Get whether the remote head is local.

#### Parameters

remote_head | a GgitRemoteHead. |

#### Returns

whether the remote head is local.

### ggit_remote_head_ref ()

    GgitRemoteHead *
    ggit_remote_head_ref (GgitRemoteHead *remote_head);

### ggit_remote_head_unref ()

    void
    ggit_remote_head_unref (GgitRemoteHead *remote_head);

## Types and Values

### GgitRemote

    typedef struct _GgitRemote GgitRemote;

Represents a git remote.

### GgitRemoteHead

    typedef struct _GgitRemoteHead GgitRemoteHead;

Represents a git remote head.

### enum GgitRemoteDownloadTagsType

Automatic tag following option

Lets us select the --tags option to use.

#### Members

GGIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED | Use the setting from the configuration. |
GGIT_REMOTE_DOWNLOAD_TAGS_AUTO | Ask the server for tags pointing to objects we're already downloading. |
GGIT_REMOTE_DOWNLOAD_TAGS_NONE | Don't ask for any tags beyond the refspecs. |
GGIT_REMOTE_DOWNLOAD_TAGS_ALL | Ask for the all the tags. |