GgitRepository

GgitRepository

Synopsis

                    GgitRepository;
struct              GgitRepositoryClass;
gint                (*GgitReferencesCallback)           (const gchar *name,
                                                         gpointer user_data);
gint                (*GgitStashCallback)                (gsize index,
                                                         const gchar *message,
                                                         GgitOId *stash_oid,
                                                         gpointer *user_data);
enum                GgitStashFlags;
gint                (*GgitStatusCallback)               (const gchar *path,
                                                         GgitStatusFlags status_flags,
                                                         gpointer user_data);
enum                GgitStatusFlags;
GgitRepository *    ggit_repository_open                (GFile *location,
                                                         GError **error);
GgitRepository *    ggit_repository_init_repository     (GFile *location,
                                                         gboolean is_bare,
                                                         GError **error);
GgitRepository *    ggit_repository_clone               (const gchar *url,
                                                         GFile *location,
                                                         GgitCloneOptions *options,
                                                         GError **error);
GgitObject *        ggit_repository_lookup              (GgitRepository *repository,
                                                         GgitOId *oid,
                                                         GType gtype,
                                                         GError **error);
GgitRef *           ggit_repository_lookup_reference    (GgitRepository *repository,
                                                         const gchar *name,
                                                         GError **error);
GgitRef *           ggit_repository_create_reference    (GgitRepository *repository,
                                                         const gchar *name,
                                                         GgitOId *oid,
                                                         GError **error);
GgitRef *           ggit_repository_create_symbolic_reference
                                                        (GgitRepository *repository,
                                                         const gchar *name,
                                                         const gchar *target,
                                                         GError **error);
GgitOId *           ggit_repository_create_tag          (GgitRepository *repository,
                                                         const gchar *tag_name,
                                                         GgitObject *target,
                                                         GgitSignature *tagger,
                                                         const gchar *message,
                                                         GgitCreateFlags flags,
                                                         GError **error);
GgitOId *           ggit_repository_create_tag_from_buffer
                                                        (GgitRepository *repository,
                                                         const gchar *tag,
                                                         GgitCreateFlags flags,
                                                         GError **error);
GgitOId *           ggit_repository_create_tag_lightweight
                                                        (GgitRepository *repository,
                                                         const gchar *tag_name,
                                                         GgitObject *target,
                                                         GgitCreateFlags flags,
                                                         GError **error);
gchar **            ggit_repository_list_tags           (GgitRepository *repository,
                                                         GError **error);
GgitBranch *        ggit_repository_create_branch       (GgitRepository *repository,
                                                         const gchar *branch_name,
                                                         GgitObject *target,
                                                         GgitCreateFlags flags,
                                                         GError **error);
void                ggit_repository_branches_foreach    (GgitRepository *repository,
                                                         GgitBranchType branch_type,
                                                         GgitBranchesCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
GgitBranch *        ggit_repository_lookup_branch       (GgitRepository *repository,
                                                         const gchar *branch_name,
                                                         GgitBranchType branch_type,
                                                         GError **error);
GgitRemote *        ggit_repository_get_remote          (GgitRepository *repository,
                                                         const gchar *name,
                                                         GError **error);
GgitRemote *        ggit_repository_create_remote       (GgitRepository *repository,
                                                         const gchar *name,
                                                         const gchar *url,
                                                         GError **error);
gchar **            ggit_repository_list_remotes        (GgitRepository *repository,
                                                         GError **error);
GgitRef *           ggit_repository_get_head            (GgitRepository *repository,
                                                         GError **error);
GFile *             ggit_repository_discover            (GFile *location,
                                                         GError **error);
gboolean            ggit_repository_is_head_detached    (GgitRepository *repository,
                                                         GError **error);
gboolean            ggit_repository_is_head_orphan      (GgitRepository *repository,
                                                         GError **error);
gboolean            ggit_repository_is_empty            (GgitRepository *repository,
                                                         GError **error);
GFile *             ggit_repository_get_location        (GgitRepository *repository);
GFile *             ggit_repository_get_workdir         (GgitRepository *repository);
void                ggit_repository_set_workdir         (GgitRepository *repository,
                                                         GFile *workdir,
                                                         gboolean update_gitlink);
gboolean            ggit_repository_is_bare             (GgitRepository *repository);
GgitStatusFlags     ggit_repository_file_status         (GgitRepository *repository,
                                                         GFile *location,
                                                         GError **error);
gboolean            ggit_repository_file_status_foreach (GgitRepository *repository,
                                                         GgitStatusCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
gboolean            ggit_repository_references_foreach  (GgitRepository *repository,
                                                         GgitRefType reftype,
                                                         GgitReferencesCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
GgitConfig *        ggit_repository_get_config          (GgitRepository *repository,
                                                         GError **error);
GgitIndex *         ggit_repository_get_index           (GgitRepository *repository,
                                                         GError **error);
GgitSubmodule *     ggit_repository_lookup_submodule    (GgitRepository *repository,
                                                         const gchar *name,
                                                         GError **error);
gboolean            ggit_repository_submodule_foreach   (GgitRepository *repository,
                                                         GgitSubmoduleCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
void                ggit_repository_reset               (GgitRepository *repository,
                                                         GgitObject *target,
                                                         GgitResetType reset_type,
                                                         GError **error);
GgitObject *        ggit_repository_revparse            (GgitRepository *repository,
                                                         const gchar *spec,
                                                         GError **error);
GgitOId *           ggit_repository_save_stash          (GgitRepository *repository,
                                                         GgitSignature *stasher,
                                                         const gchar *message,
                                                         GgitStashFlags flags,
                                                         GError **error);
void                ggit_repository_drop_stash          (GgitRepository *repository,
                                                         gsize index,
                                                         GError **error);
gboolean            ggit_repository_stash_foreach       (GgitRepository *repository,
                                                         GgitStashCallback callback,
                                                         gpointer user_data,
                                                         GError **error);
void                ggit_repository_get_ahead_behind    (GgitRepository *repository,
                                                         GgitOId *local,
                                                         GgitOId *upstream,
                                                         gsize *ahead,
                                                         gsize *behind,
                                                         GError **error);

Object Hierarchy

  GObject
   +----GgitObjectFactoryBase
         +----GgitNative
               +----GgitRepository
  GFlags
   +----GgitStashFlags
  GFlags
   +----GgitStatusFlags

Implemented Interfaces

GgitRepository implements GInitable.

Properties

  "clone-options"            GgitCloneOptions*     : Read / Write / Construct Only
  "head"                     GgitRef*              : Read
  "init"                     gboolean              : Read / Write / Construct Only
  "is-bare"                  gboolean              : Read / Write / Construct Only
  "location"                 GFile*                : Read / Write / Construct Only
  "url"                      gchar*                : Read / Write / Construct Only
  "workdir"                  GFile*                : Read / Write / Construct

Description

Details

GgitRepository

typedef struct _GgitRepository GgitRepository;

Represents an existing git repository including all of it's object contents.


struct GgitRepositoryClass

struct GgitRepositoryClass {
};

The class structure for GgitRepositoryClass.


GgitReferencesCallback ()

gint                (*GgitReferencesCallback)           (const gchar *name,
                                                         gpointer user_data);

The type of the callback functions for retrieving the references in a GgitRepository. See ggit_repository_references_foreach().

name :

the name of the reference

user_data :

user-supplied data. [closure]

Returns :

0 to go for the next references or a GgitError in case there was an error.

GgitStashCallback ()

gint                (*GgitStashCallback)                (gsize index,
                                                         const gchar *message,
                                                         GgitOId *stash_oid,
                                                         gpointer *user_data);

When iterating over all the stashed states, callback that will be issued per entry. See ggit_repository_stash_foreach().

index :

the position within the stash list. 0 points to the most recent stashed state.

message :

the stash message.

stash_oid :

the commit oid of the stashed state.

user_data :

user-suplied data. [closure]

Returns :

0 to go continue or a GgitError in case there was an error.

enum GgitStashFlags

typedef enum {
	GGIT_STASH_DEFAULT           = 0,
	GGIT_STASH_KEEP_INDEX        = 1 << 0,
	GGIT_STASH_INCLUDE_UNTRACKED = 1 << 1,
	GGIT_STASH_INCLUDE_IGNORED   = 1 << 2
} GgitStashFlags;

Describes how a stash should be applied.

GGIT_STASH_DEFAULT

default stash.

GGIT_STASH_KEEP_INDEX

All changes already added to the index are left intact in the working directory.

GGIT_STASH_INCLUDE_UNTRACKED

All untracked files are also stashed and then cleaned up from the working directory.

GGIT_STASH_INCLUDE_IGNORED

All ignored files are also stashed and then cleaned up from the working directory.

GgitStatusCallback ()

gint                (*GgitStatusCallback)               (const gchar *path,
                                                         GgitStatusFlags status_flags,
                                                         gpointer user_data);

The type of the callback functions for retrieving the status of the files in a GgitRepository. See ggit_repository_file_status_foreach().

path :

the file to retrieve status for, rooted at the repository working dir.

status_flags :

the status value.

user_data :

user-supplied data. [closure]

Returns :

0 to go for the next file or a GgitError in case there was an error.

enum GgitStatusFlags

typedef enum {
	GGIT_STATUS_CURRENT                 = 0,
	GGIT_STATUS_INDEX_NEW               = 1 << 0,
	GGIT_STATUS_INDEX_MODIFIED          = 1 << 1,
	GGIT_STATUS_INDEX_DELETED           = 1 << 2,
	GGIT_STATUS_INDEX_RENAMED           = 1 << 3,
	GGIT_STATUS_INDEX_TYPECHANGE        = 1 << 4,
	GGIT_STATUS_WORKING_TREE_NEW        = 1 << 7,
	GGIT_STATUS_WORKING_TREE_MODIFIED   = 1 << 8,
	GGIT_STATUS_WORKING_TREE_DELETED    = 1 << 9,
	GGIT_STATUS_WORKING_TREE_TYPECHANGE = 1 << 10,
	GGIT_STATUS_IGNORED                 = 1 << 14
} GgitStatusFlags;

Describes a file's status.

GGIT_STATUS_CURRENT

file is current.

GGIT_STATUS_INDEX_NEW

file in index is new.

GGIT_STATUS_INDEX_MODIFIED

file in index is modified.

GGIT_STATUS_INDEX_DELETED

file in index is deleted.

GGIT_STATUS_INDEX_RENAMED

GGIT_STATUS_INDEX_TYPECHANGE

GGIT_STATUS_WORKING_TREE_NEW

file in working tree is new.

GGIT_STATUS_WORKING_TREE_MODIFIED

file in working tree is modified.

GGIT_STATUS_WORKING_TREE_DELETED

file in working tree is deleted.

GGIT_STATUS_WORKING_TREE_TYPECHANGE

GGIT_STATUS_IGNORED

file is ignored.

ggit_repository_open ()

GgitRepository *    ggit_repository_open                (GFile *location,
                                                         GError **error);

Open a git repository.

The path must point to an existing git repository folder, e.g.

/path/to/my_repo/.git/ (normal repository) objects/ index HEAD

/path/to/bare_repo/ (bare repository) objects/ index HEAD

The method will automatically detect if path is a normal or bare repository or fail if it is neither.

location :

the location of the repository.

error :

a GError for error reporting, or NULL.

Returns :

a newly created GgitRepository. [transfer full]

ggit_repository_init_repository ()

GgitRepository *    ggit_repository_init_repository     (GFile *location,
                                                         gboolean is_bare,
                                                         GError **error);

Creates a new git repository in the given folder.

location :

the location of the repository.

is_bare :

if TRUE, a git repository without a working directory is created at the pointed path. If FALSE, provided path will be considered as the working directory into which the .git directory will be created.

error :

a GError for error reporting, or NULL.

Returns :

a newly created GgitRepository. [transfer full]

ggit_repository_clone ()

GgitRepository *    ggit_repository_clone               (const gchar *url,
                                                         GFile *location,
                                                         GgitCloneOptions *options,
                                                         GError **error);

Clones a new git repository in the given folder.

url :

url to fetch the repository from.

location :

the location of the repository.

options :

a GgitCloneOptions. [allow-none]

error :

a GError for error reporting, or NULL.

Returns :

a newly created GgitRepository. [transfer full]

ggit_repository_lookup ()

GgitObject *        ggit_repository_lookup              (GgitRepository *repository,
                                                         GgitOId *oid,
                                                         GType gtype,
                                                         GError **error);

Lookups a reference to one of the objects in the repository.

The generated reference must be freed with g_object_unref().

The gtype must match the type of the object in the odb; the method will fail otherwise. The special value G_TYPE_NONE may be passed to let the method guess the object's type.

repository :

a GgitRepository.

oid :

a GgitOId.

gtype :

a GType.

error :

a GError for error reporting, or NULL.

Returns :

the found GgitObject, or NULL on error. [transfer full]

ggit_repository_lookup_reference ()

GgitRef *           ggit_repository_lookup_reference    (GgitRepository *repository,
                                                         const gchar *name,
                                                         GError **error);

Lookups a reference by its name in repository. The returned GgitRef must be freed with g_object_unref().

repository :

a GgitRepository.

name :

the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...).

error :

a GError for error reporting, or NULL.

Returns :

the searched reference. [transfer full]

ggit_repository_create_reference ()

GgitRef *           ggit_repository_create_reference    (GgitRepository *repository,
                                                         const gchar *name,
                                                         GgitOId *oid,
                                                         GError **error);

Creates a new object id reference.

The reference will be created in the repository and written to the disk. The returned value must be freed with g_object_unref().

repository :

a GgitRepository.

name :

the name for the new GgitRef.

oid :

the GgitOId pointed to by the reference.

error :

a GError for error reporting, or NULL.

Returns :

the newly created reference. [transfer full]

ggit_repository_create_symbolic_reference ()

GgitRef *           ggit_repository_create_symbolic_reference
                                                        (GgitRepository *repository,
                                                         const gchar *name,
                                                         const gchar *target,
                                                         GError **error);

Creates a new symbolic reference.

The reference will be created in the repository and written to the disk. The returned value must be freed with g_object_unref().

repository :

a GgitRepository.

name :

the name for the new GgitRef.

target :

the full name to the reference.

error :

a GError for error reporting, or NULL.

Returns :

the newly created reference. [transfer full]

ggit_repository_create_tag ()

GgitOId *           ggit_repository_create_tag          (GgitRepository *repository,
                                                         const gchar *tag_name,
                                                         GgitObject *target,
                                                         GgitSignature *tagger,
                                                         const gchar *message,
                                                         GgitCreateFlags flags,
                                                         GError **error);

Create a new tag object.

repository :

a GgitRepository.

tag_name :

the tag name.

target :

a GgitObject.

tagger :

a GgitSignature.

message :

the tag message.

flags :

a GgitCreateFlags.

error :

a GError.

Returns :

the id to which the tag points, or NULL in case of an error. [transfer full][allow-none]

ggit_repository_create_tag_from_buffer ()

GgitOId *           ggit_repository_create_tag_from_buffer
                                                        (GgitRepository *repository,
                                                         const gchar *tag,
                                                         GgitCreateFlags flags,
                                                         GError **error);

Create a new tag from a buffer describing the tag object. The buffer must be correctly formatted.

repository :

a GgitRepository.

tag :

the tag buffer.

flags :

a GgitCreateFlags.

error :

a GError.

Returns :

the id to which the tag points, or NULL in case of an error. [transfer full][allow-none]

ggit_repository_create_tag_lightweight ()

GgitOId *           ggit_repository_create_tag_lightweight
                                                        (GgitRepository *repository,
                                                         const gchar *tag_name,
                                                         GgitObject *target,
                                                         GgitCreateFlags flags,
                                                         GError **error);

Creates a new lightweight tag.

repository :

a GgitRepository.

tag_name :

the name of the tag.

target :

a GgitObject.

flags :

a GgitCreateFlags.

error :

a GError.

Returns :

the id to which the tag points, or NULL in case of an error. [transfer full][allow-none]

ggit_repository_list_tags ()

gchar **            ggit_repository_list_tags           (GgitRepository *repository,
                                                         GError **error);

Fill a list with all the tags in the repository.

repository :

a GgitRepository.

error :

a GError.

Returns :

a list with the tags in repository. [transfer full][allow-none]

ggit_repository_create_branch ()

GgitBranch *        ggit_repository_create_branch       (GgitRepository *repository,
                                                         const gchar *branch_name,
                                                         GgitObject *target,
                                                         GgitCreateFlags flags,
                                                         GError **error);

Creates a new branch pointing at a target commit.

repository :

a GgitRepository.

branch_name :

the name of the branch.

target :

a GgitObject.

flags :

a GgitCreateFlags.

error :

a GError.

Returns :

the reference to which the branch points, or NULL in case of an error. [transfer full][allow-none]

ggit_repository_branches_foreach ()

void                ggit_repository_branches_foreach    (GgitRepository *repository,
                                                         GgitBranchType branch_type,
                                                         GgitBranchesCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Foreach branch of type branch_type the callback callback is called.

repository :

a GgitRepository.

branch_type :

a GgitBranchType.

callback :

a GgitBranchesCallback. [scope call]

user_data :

callback user data.

error :

a GError.

ggit_repository_lookup_branch ()

GgitBranch *        ggit_repository_lookup_branch       (GgitRepository *repository,
                                                         const gchar *branch_name,
                                                         GgitBranchType branch_type,
                                                         GError **error);

Lookups a branch by its name in a repository.

repository :

a GgitRepository.

branch_name :

the name of the branch.

branch_type :

a GgitBranchType.

error :

a GError for error reporting, or NULL.

Returns :

a branch by its name in a repository. [transfer full][allow-none]

ggit_repository_get_remote ()

GgitRemote *        ggit_repository_get_remote          (GgitRepository *repository,
                                                         const gchar *name,
                                                         GError **error);

Gets the remote called name.

repository :

a GgitRepository.

name :

the remote's name.

error :

a GError.

Returns :

a new GgitRemote or NULL if there is an error. [transfer full][allow-none]

ggit_repository_create_remote ()

GgitRemote *        ggit_repository_create_remote       (GgitRepository *repository,
                                                         const gchar *name,
                                                         const gchar *url,
                                                         GError **error);

Adds a remote with the default fetch refspec to the repository's configuration.

repository :

a GgitRepository.

name :

the name of the new remote.

url :

the url of the remote.

error :

a GError.

Returns :

a new GgitRemote or NULL if there is an error. [transfer full][allow-none]

ggit_repository_list_remotes ()

gchar **            ggit_repository_list_remotes        (GgitRepository *repository,
                                                         GError **error);

Fill a list with all the remotes in repository.

repository :

a GgitRepository.

error :

a GError.

Returns :

a list with the remotes. [transfer full][allow-none]

ggit_repository_get_head ()

GgitRef *           ggit_repository_get_head            (GgitRepository *repository,
                                                         GError **error);

Get the current HEAD reference of the repository.

repository :

a GgitRepository.

error :

a GError for error reporting, or NULL.

Returns :

a GgitRef. [transfer full]

ggit_repository_discover ()

GFile *             ggit_repository_discover            (GFile *location,
                                                         GError **error);

Looks for a git repository.

The lookup starts from path and walks up the parent directories and stops when a repository is found.

location :

the base location where the lookup starts.

error :

a GError for error reporting, or NULL.

Returns :

the repository location. [transfer full]

ggit_repository_is_head_detached ()

gboolean            ggit_repository_is_head_detached    (GgitRepository *repository,
                                                         GError **error);

Checks if repository's HEAD is detached.

A repository's HEAD is detached when it points directly to a commit instead of a branch.

repository :

a GgitRepository.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if HEAD is detached.

ggit_repository_is_head_orphan ()

gboolean            ggit_repository_is_head_orphan      (GgitRepository *repository,
                                                         GError **error);

Checks if repository's HEAD is an orphan.

An orphan branch is one named from HEAD but doesn't exist in the refs namespace, because it doesn't have any commit to point to.

repository :

a GgitRepository.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if the current branch is an orphan.

ggit_repository_is_empty ()

gboolean            ggit_repository_is_empty            (GgitRepository *repository,
                                                         GError **error);

Checks if repository is empty.

An empty repository has just been initialized and contains no commits.

repository :

a GgitRepository.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if the repository is empty.

ggit_repository_get_location ()

GFile *             ggit_repository_get_location        (GgitRepository *repository);

Get the gitdir location of the repository.

repository :

a GgitRepository.

Returns :

the location of the gitdir of the repository. [transfer full]

ggit_repository_get_workdir ()

GFile *             ggit_repository_get_workdir         (GgitRepository *repository);

Gets the working directory of the repository.

repository :

a GgitRepository.

Returns :

the location of the working directory of the repository. [transfer full]

ggit_repository_set_workdir ()

void                ggit_repository_set_workdir         (GgitRepository *repository,
                                                         GFile *workdir,
                                                         gboolean update_gitlink);

Sets the working directory of the repository. If update_gitlink is set to TRUE "core.worktree" will be set in the config if workdir is not the parent of the .git directory).

repository :

a GgitRepository.

workdir :

the working directory

update_gitlink :

create/update gitlink in workdir

ggit_repository_is_bare ()

gboolean            ggit_repository_is_bare             (GgitRepository *repository);

Checks if repository is bare.

repository :

a GgitRepository.

Returns :

TRUE if the repository is empty.

ggit_repository_file_status ()

GgitStatusFlags     ggit_repository_file_status         (GgitRepository *repository,
                                                         GFile *location,
                                                         GError **error);

Gets the file status for a single file.

repository :

a GgitRepository.

location :

the file to retrieve status for, rooted at the repository working dir.

error :

a GError for error reporting, or NULL.

Returns :

the status for a single file.

ggit_repository_file_status_foreach ()

gboolean            ggit_repository_file_status_foreach (GgitRepository *repository,
                                                         GgitStatusCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Gathers file statuses and run a callback for each one.

To the callback is passed the path of the file, the status and the data pointer passed to this function. If the callback returns something other than 0, the iteration will stop and error will be set.

repository :

a GgitRepository.

callback :

a GgitStatusCallback. [scope call]

user_data :

callback user data.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if there was no error, FALSE otherwise

ggit_repository_references_foreach ()

gboolean            ggit_repository_references_foreach  (GgitRepository *repository,
                                                         GgitRefType reftype,
                                                         GgitReferencesCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Gathers references and run a callback for each one.

To the callback is passed the name of the reference and the data pointer passed to this function. If the callback returns something other than 0, the iteration will stop and error will be set. The references are filtered by reftype.

repository :

a GgitRepository.

reftype :

a GgitRefType

callback :

a GgitReferencesCallback. [scope call]

user_data :

callback user data.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if there was no error, FALSE otherwise

ggit_repository_get_config ()

GgitConfig *        ggit_repository_get_config          (GgitRepository *repository,
                                                         GError **error);

Get the config for a specific repository.

repository :

a GgitRepository

error :

a GError

Returns :

a GgitConfig. [transfer full]

ggit_repository_get_index ()

GgitIndex *         ggit_repository_get_index           (GgitRepository *repository,
                                                         GError **error);

Get the index for a specific repository.

repository :

a GgitRepository.

error :

a GError.

Returns :

a GgitIndex. [transfer full]

ggit_repository_lookup_submodule ()

GgitSubmodule *     ggit_repository_lookup_submodule    (GgitRepository *repository,
                                                         const gchar *name,
                                                         GError **error);

Lookups a submodule information by name or path. If the submodule does not exist, NULL is returned and a GGIT_ERROR_NOTFOUND error set.

repository :

a GgitRepository.

name :

the name of the submodule.

error :

a GError.

Returns :

a newly-allocated GgitSubmodule. [transfer full][allow-none]

ggit_repository_submodule_foreach ()

gboolean            ggit_repository_submodule_foreach   (GgitRepository *repository,
                                                         GgitSubmoduleCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Gathers file statuses and run a callback for each one.

To the callback is passed the path of the file, the status and the data pointer passed to this function. If the callback returns something other than 0, the iteration will stop and error will be set.

repository :

a GgitRepository.

callback :

a GgitStatusCallback. [scope call]

user_data :

callback user data.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if there was no error, FALSE otherwise

ggit_repository_reset ()

void                ggit_repository_reset               (GgitRepository *repository,
                                                         GgitObject *target,
                                                         GgitResetType reset_type,
                                                         GError **error);

Performs a reset of type reset_type on repository to target, or error will be set.

repository :

a GgitRepository.

target :

the target GgitObject which is a commit or a tag.

reset_type :

the GgitResetType to perform.

error :

a GError for error reporting, or NULL.

ggit_repository_revparse ()

GgitObject *        ggit_repository_revparse            (GgitRepository *repository,
                                                         const gchar *spec,
                                                         GError **error);

Find an object, as specified by a revision string. See `man gitrevisions`, or the documentation for `git rev-parse` for information on the syntax accepted.

repository :

a GgitRepository.

spec :

the revision specification.

error :

a GError for error reporting, or NULL.

Returns :

a GgitObject or NULL if the revision could not be found. [transfer full]

ggit_repository_save_stash ()

GgitOId *           ggit_repository_save_stash          (GgitRepository *repository,
                                                         GgitSignature *stasher,
                                                         const gchar *message,
                                                         GgitStashFlags flags,
                                                         GError **error);

Saves the local modifications to a new stash. It returns the commit containing the stashed state. This commit is also the target of the direct reference refs/stash.

repository :

a GgitRepository.

stasher :

a GgitSignature.

message :

description along with the stashed state or NULL to be autogenerated.

flags :

a GgitStashFlags to control the stashing process.

error :

a GError for error reporting, GGIT_ENOTFOUND if there's nothing to stash or NULL.

Returns :

a new object id of the commit containing the stashed state. [transfer full]

ggit_repository_drop_stash ()

void                ggit_repository_drop_stash          (GgitRepository *repository,
                                                         gsize index,
                                                         GError **error);

Removes a single stashed state from the stash list.

repository :

a GgitRepository.

index :

the position within the stash list. 0 points to the most recent stashed state.

error :

a GError for error reporting, or NULL.

ggit_repository_stash_foreach ()

gboolean            ggit_repository_stash_foreach       (GgitRepository *repository,
                                                         GgitStashCallback callback,
                                                         gpointer user_data,
                                                         GError **error);

Loops over all the stashed states and issue a callback for each one. If callback returns a non-zero value, this will stop looping.

repository :

a GgitRepository.

callback :

a GgitStashCallback. [scope call]

user_data :

callback user data.

error :

a GError for error reporting, or NULL.

Returns :

TRUE if there was no error, FALSE otherwise.

ggit_repository_get_ahead_behind ()

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

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.

repository :

a GgitRepository.

local :

the commit for local.

upstream :

the commit for upstream.

ahead :

number of unique from commits in upstream.

behind :

number of unique from commits in local.

error :

a GError for error reporting, or NULL.

Property Details

The "clone-options" property

  "clone-options"            GgitCloneOptions*     : Read / Write / Construct Only

Clone options.


The "head" property

  "head"                     GgitRef*              : Read

Head.


The "init" property

  "init"                     gboolean              : Read / Write / Construct Only

Whether to initialize a repository.

Default value: FALSE


The "is-bare" property

  "is-bare"                  gboolean              : Read / Write / Construct Only

Is a bare repository.

Default value: FALSE


The "location" property

  "location"                 GFile*                : Read / Write / Construct Only

The location of the repository.


The "url" property

  "url"                      gchar*                : Read / Write / Construct Only

The URL for cloning a repository.

Default value: NULL


The "workdir" property

  "workdir"                  GFile*                : Read / Write / Construct

The path to the repository working directory.