![]() |
![]() |
![]() |
libgit2-glib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
GgitRepository; struct GgitRepositoryClass; gint (*GgitReferencesNameCallback) (const gchar *name
,gpointer user_data
); enum GgitCreateFlags; enum GgitResetType; 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
); GgitBlobOutputStream * ggit_repository_create_blob (GgitRepository *repository
); GgitOId * ggit_repository_create_blob_from_buffer (GgitRepository *repository
,gconstpointer buffer
,gsize size
,GError **error
); GgitOId * ggit_repository_create_blob_from_file (GgitRepository *repository
,GFile *file
,GError **error
); GgitOId * ggit_repository_create_blob_from_path (GgitRepository *repository
,const gchar *path
,GError **error
); GgitOId * ggit_repository_create_commit (GgitRepository *repository
,const gchar *update_ref
,GgitSignature *author
,GgitSignature *committer
,const gchar *message_encoding
,const gchar *message
,GgitTree *tree
,GgitCommit **parents
,gint parent_count
,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
); GgitTreeBuilder * ggit_repository_create_tree_builder (GgitRepository *repository
); GgitTreeBuilder * ggit_repository_create_tree_builder_from_tree (GgitRepository *repository
,GgitTree *tree
,GError **error
); GgitIndexEntry * ggit_repository_create_index_entry_for_file (GgitRepository *repository
,GFile *file
,GgitOId *id
,GError **error
); GgitIndexEntry * ggit_repository_create_index_entry_for_path (GgitRepository *repository
,const gchar *path
,GgitOId *id
,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
,GgitStatusOptions *options
,GgitStatusCallback callback
,gpointer user_data
,GError **error
); gboolean ggit_repository_references_foreach_name (GgitRepository *repository
,GgitReferencesNameCallback 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
);
GObject +----GgitObjectFactoryBase +----GgitNative +----GgitRepository
GFlags +----GgitCreateFlags
GEnum +----GgitResetType
GFlags +----GgitStashFlags
GFlags +----GgitStatusFlags
"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
typedef struct _GgitRepository GgitRepository;
Represents an existing git repository including all of it's object contents.
struct GgitRepositoryClass { };
The class structure for GgitRepositoryClass.
gint (*GgitReferencesNameCallback) (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-supplied data. [closure] |
Returns : |
0 to go for the next references or a GgitError in case there was an error. |
typedef enum { GGIT_CREATE_NONE = 0, GGIT_CREATE_FORCE = 1 << 0 } GgitCreateFlags;
Describes how something should be created.
typedef enum { GGIT_RESET_SOFT = 1, GGIT_RESET_MIXED = 2, GGIT_RESET_HARD = 3 } GgitResetType;
Describes the type of reset to perform.
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()
.
|
the position within the stash list. 0 points to the most recent stashed state. |
|
the stash message. |
|
the commit oid of the stashed state. |
|
user-suplied data. [closure] |
Returns : |
0 to go continue or a GgitError in case there was an error. |
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.
default stash. | |
All changes already added to the index are left intact in the working directory. | |
All untracked files are also stashed and then cleaned up from the working directory. | |
All ignored files are also stashed and then cleaned up from the working directory. |
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()
.
|
the file to retrieve status for, rooted at the repository working dir. |
|
the status value. |
|
user-supplied data. [closure] |
Returns : |
0 to go for the next file or a GgitError in case there was an error. |
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.
file is current. | |
file in index is new. | |
file in index is modified. | |
file in index is deleted. | |
file in working tree is new. | |
file in working tree is modified. | |
file in working tree is deleted. | |
file is ignored. |
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.
|
the location of the repository. |
|
a GError for error reporting, or NULL . |
Returns : |
a newly created GgitRepository. [transfer full] |
GgitRepository * ggit_repository_init_repository (GFile *location
,gboolean is_bare
,GError **error
);
Creates a new git repository in the given folder.
|
the location of the repository. |
|
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. |
|
a GError for error reporting, or NULL . |
Returns : |
a newly created GgitRepository. [transfer full] |
GgitRepository * ggit_repository_clone (const gchar *url
,GFile *location
,GgitCloneOptions *options
,GError **error
);
Clones a new git repository in the given folder.
|
url to fetch the repository from. |
|
the location of the repository. |
|
a GgitCloneOptions. [allow-none] |
|
a GError for error reporting, or NULL . |
Returns : |
a newly created GgitRepository. [transfer full] |
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.
|
a GgitRepository. |
|
a GgitOId. |
|
a GType. |
|
a GError for error reporting, or NULL . |
Returns : |
the found GgitObject, or NULL on error. [transfer full]
|
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()
.
|
a GgitRepository. |
|
the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...). |
|
a GError for error reporting, or NULL . |
Returns : |
the searched reference. [transfer full] |
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()
.
|
a GgitRepository. |
|
the name for the new GgitRef. |
|
the GgitOId pointed to by the reference. |
|
a GError for error reporting, or NULL . |
Returns : |
the newly created reference. [transfer full] |
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()
.
|
a GgitRepository. |
|
the name for the new GgitRef. |
|
the full name to the reference. |
|
a GError for error reporting, or NULL . |
Returns : |
the newly created reference. [transfer full] |
GgitBlobOutputStream * ggit_repository_create_blob (GgitRepository *repository
);
Create a new blob and return a GOutputStream to write contents to the blob. This is an efficient way to create new blobs without copying data. The blob id can be obtained from the blob output stream using ggit_blob_output_stream_get_id, after you close the stream.
|
a GgitRepository. |
Returns : |
a GgitBlobOutputStream. [transfer full] |
GgitOId * ggit_repository_create_blob_from_buffer (GgitRepository *repository
,gconstpointer buffer
,gsize size
,GError **error
);
Write an in-memory buffer to the object database as a blob.
|
a GgitRepository. |
|
the data. [array length=size][element-type guint8] |
|
the length (in bytes) of the data. |
|
a GError for error reporting, or NULL . |
Returns : |
the new GgitOid of the written blob, or NULL if writing the blob
failed. |
GgitOId * ggit_repository_create_blob_from_file (GgitRepository *repository
,GFile *file
,GError **error
);
Write a file to the object database as a blob.
|
a GgitRepository. |
|
a GFile. |
|
a GError for error reporting, or NULL . |
Returns : |
the new GgitOid of the written blob, or NULL if writing the blob
failed. |
GgitOId * ggit_repository_create_blob_from_path (GgitRepository *repository
,const gchar *path
,GError **error
);
Write a path relative to the repository working directory to the object database as a blob.
|
a GgitRepository. |
|
the file path. |
|
a GError for error reporting, or NULL . |
Returns : |
the new GgitOid of the written blob, or NULL if writing the blob
failed. |
GgitOId * ggit_repository_create_commit (GgitRepository *repository
,const gchar *update_ref
,GgitSignature *author
,GgitSignature *committer
,const gchar *message_encoding
,const gchar *message
,GgitTree *tree
,GgitCommit **parents
,gint parent_count
,GError **error
);
Create a new commit. If update_ref
is not NULL
, the given reference will
be updated to point to the newly created commit. Use "HEAD" to update the
HEAD of the current branch and make it point to this commit.
If message_encoding
is set to NULL
, "UTF-8" encoding is assumed for the
provided message
. Note that message
will not be cleaned up automatically.
You can use ggit_message_prettify to do this yourself if needed.
|
a GgitRepository. |
|
name of the reference to update. [allow-none] |
|
author signature. |
|
committer signature (and time of commit). |
|
message encoding. [allow-none] |
|
commit message. |
|
the tree of objects to commit. |
|
parent commits. [array length=parent_count] |
|
number of parent commits in parents . |
|
a GError for error reporting, or NULL . |
Returns : |
the GgitOId of the created commit object, or NULL in case of an error. |
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.
|
a GgitRepository. |
|
the tag name. |
|
a GgitObject. |
|
a GgitSignature. |
|
the tag message. |
|
a GgitCreateFlags. |
|
a GError for error reporting, or NULL . |
Returns : |
the id to which the tag points, or
NULL in case of an error. [transfer full][allow-none]
|
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.
|
a GgitRepository. |
|
the tag buffer. |
|
a GgitCreateFlags. |
|
a GError for error reporting, or NULL . |
Returns : |
the id to which the tag points, or
NULL in case of an error. [transfer full][allow-none]
|
GgitOId * ggit_repository_create_tag_lightweight (GgitRepository *repository
,const gchar *tag_name
,GgitObject *target
,GgitCreateFlags flags
,GError **error
);
Creates a new lightweight tag.
|
a GgitRepository. |
|
the name of the tag. |
|
a GgitObject. |
|
a GgitCreateFlags. |
|
a GError for error reporting, or NULL . |
Returns : |
the id to which the tag points, or
NULL in case of an error. [transfer full][allow-none]
|
GgitTreeBuilder * ggit_repository_create_tree_builder (GgitRepository *repository
);
Create a new tree builder.
|
a GgitRepository. |
Returns : |
a GgitTreeBuilder. [transfer full] |
GgitTreeBuilder * ggit_repository_create_tree_builder_from_tree (GgitRepository *repository
,GgitTree *tree
,GError **error
);
Create a tree builder for initialized with tree
. To create an empty
tree builder, use ggit_repository_create_tree_builder instead.
|
a GgitTree. |
|
a GError for error reporting, or NULL . |
Returns : |
a new GgitTreeBuilder object, or NULL if there was an error. [transfer full]
|
GgitIndexEntry * ggit_repository_create_index_entry_for_file (GgitRepository *repository
,GFile *file
,GgitOId *id
,GError **error
);
Create a new index entry. When file
is not NULL
, the path of the returned
entry (ggit_index_entry_get_path) is set to the path of file
relative to
the working directory of repository
. The file must reside in the working
directory of repository
. The file related
fields of the returned entry are also queried from this file (if the file exists).
If id
is not NULL
, then the id of the returned entry is set to id
(see ggit_index_entry_get_id) which could point to a blob (for a file)
or a tree (for a directory).
|
a GgitRepository. |
|
a GFile. [allow-none] |
|
a GgitOId. [allow-none] |
|
a GError for error reporting, or NULL . |
Returns : |
a GgitIndexEntry or NULL when an error occurred. |
GgitIndexEntry * ggit_repository_create_index_entry_for_path (GgitRepository *repository
,const gchar *path
,GgitOId *id
,GError **error
);
Create a new index entry. When path
is not NULL
, the path of the returned
entry (ggit_index_entry_get_path) is set path
. The specified path can be
either absolute or relative. In the case of
an absolute path, the path must reside within the working directory of
repository
. The file related fields of the returned entry are also queried
from this path (if the file exists).
If id
is not NULL
, then the id of the returned entry is set to id
(see ggit_index_entry_get_id) which could point to a blob (for a file)
or a tree (for a directory).
|
a GgitRepository. |
|
a path. [allow-none] |
|
a GgitOId. [allow-none] |
|
a GError for error reporting, or NULL . |
Returns : |
a GgitIndexEntry or NULL when an error occurred. |
gchar ** ggit_repository_list_tags (GgitRepository *repository
,GError **error
);
Fill a list with all the tags in the repository
.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
a list with the tags in repository . [transfer full][allow-none]
|
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.
|
a GgitRepository. |
|
the name of the branch. |
|
a GgitObject. |
|
a GgitCreateFlags. |
|
a GError for error reporting, or NULL . |
Returns : |
the reference to which the branch
points, or NULL in case of an error. [transfer full][allow-none]
|
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.
|
a GgitRepository. |
|
a GgitBranchType. |
|
a GgitBranchesCallback. [scope call] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
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.
|
a GgitRepository. |
|
the name of the branch. |
|
a GgitBranchType. |
|
a GError for error reporting, or NULL . |
Returns : |
a branch by its name in a repository. [transfer full][allow-none] |
GgitRemote * ggit_repository_get_remote (GgitRepository *repository
,const gchar *name
,GError **error
);
Gets the remote called name
.
|
a GgitRepository. |
|
the remote's name. |
|
a GError for error reporting, or NULL . |
Returns : |
a new GgitRemote or NULL if there is an error. [transfer full][allow-none]
|
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.
|
a GgitRepository. |
|
the name of the new remote. |
|
the url of the remote. |
|
a GError for error reporting, or NULL . |
Returns : |
a new GgitRemote or NULL if there is an error. [transfer full][allow-none]
|
gchar ** ggit_repository_list_remotes (GgitRepository *repository
,GError **error
);
Fill a list with all the remotes in repository
.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
a list with the remotes. [transfer full][allow-none] |
GgitRef * ggit_repository_get_head (GgitRepository *repository
,GError **error
);
Get the current HEAD reference of the repository.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
a GgitRef. [transfer full] |
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.
|
the base location where the lookup starts. |
|
a GError for error reporting, or NULL . |
Returns : |
the repository location. [transfer full] |
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.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if HEAD is detached. |
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.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if the current branch is an orphan. |
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.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if the repository is empty. |
GFile * ggit_repository_get_location (GgitRepository *repository
);
Get the gitdir location of the repository.
|
a GgitRepository. |
Returns : |
the location of the gitdir of the repository. [transfer full] |
GFile * ggit_repository_get_workdir (GgitRepository *repository
);
Gets the working directory of the repository.
|
a GgitRepository. |
Returns : |
the location of the working directory of the repository. [transfer full] |
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).
|
a GgitRepository. |
|
the working directory. |
|
create/update gitlink in workdir. |
gboolean ggit_repository_is_bare (GgitRepository *repository
);
Checks if repository
is bare.
|
a GgitRepository. |
Returns : |
TRUE if the repository is empty. |
GgitStatusFlags ggit_repository_file_status (GgitRepository *repository
,GFile *location
,GError **error
);
Gets the file status for a single file.
|
a GgitRepository. |
|
the file to retrieve status for, rooted at the repository working dir. |
|
a GError for error reporting, or NULL . |
Returns : |
the status for a single file. |
gboolean ggit_repository_file_status_foreach (GgitRepository *repository
,GgitStatusOptions *options
,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.
Set options
to NULL
to get the default status options.
|
a GgitRepository. |
|
status options, or NULL . [allow-none]
|
|
a GgitStatusCallback. [scope call] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if there was no error, FALSE otherwise |
gboolean ggit_repository_references_foreach_name (GgitRepository *repository
,GgitReferencesNameCallback 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.
|
a GgitRepository. |
|
a GgitReferencesNameCallback. [scope call] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if there was no error, FALSE otherwise |
GgitConfig * ggit_repository_get_config (GgitRepository *repository
,GError **error
);
Get the config for a specific repository.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
a GgitConfig. [transfer full] |
GgitIndex * ggit_repository_get_index (GgitRepository *repository
,GError **error
);
Get the index for a specific repository.
|
a GgitRepository. |
|
a GError for error reporting, or NULL . |
Returns : |
a GgitIndex. [transfer full] |
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.
|
a GgitRepository. |
|
the name of the submodule. |
|
a GError for error reporting, or NULL . |
Returns : |
a newly-allocated GgitSubmodule. [transfer full][allow-none] |
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.
|
a GgitRepository. |
|
a GgitStatusCallback. [scope call] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if there was no error, FALSE otherwise |
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.
|
a GgitRepository. |
|
the target GgitObject which is a commit or a tag. |
|
the GgitResetType to perform. |
|
a GError for error reporting, or NULL . |
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.
|
a GgitRepository. |
|
the revision specification. |
|
a GError for error reporting, or NULL . |
Returns : |
a GgitObject or NULL if the revision could not be found. [transfer full]
|
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.
|
a GgitRepository. |
|
a GgitSignature. |
|
description along with the stashed state or NULL to be autogenerated. |
|
a GgitStashFlags to control the stashing process. |
|
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] |
void ggit_repository_drop_stash (GgitRepository *repository
,gsize index
,GError **error
);
Removes a single stashed state from the stash list.
|
a GgitRepository. |
|
the position within the stash list. 0 points to the. most recent stashed state. |
|
a GError for error reporting, or NULL . |
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.
|
a GgitRepository. |
|
a GgitStashCallback. [scope call] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
Returns : |
TRUE if there was no error, FALSE otherwise. |
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.
|
a GgitRepository. |
|
the commit for local. |
|
the commit for upstream. |
|
number of unique from commits in upstream . |
|
number of unique from commits in local . |
|
a GError for error reporting, or NULL . |
"clone-options"
property"clone-options" GgitCloneOptions* : Read / Write / Construct Only
Clone options.
"init"
property "init" gboolean : Read / Write / Construct Only
Whether to initialize a repository.
Default value: FALSE
"is-bare"
property "is-bare" gboolean : Read / Write / Construct Only
Is a bare repository.
Default value: FALSE
"location"
property "location" GFile* : Read / Write / Construct Only
The location of the repository.
"url"
property "url" gchar* : Read / Write / Construct Only
The URL for cloning a repository.
Default value: NULL