Creates a binding between source_property
on source
and target_property
on target
.
Whenever the source_property
is changed the target_property
is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.
If flags
contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
if target_property
on target
changes then the source_property
on source
will be updated as well.
The binding will automatically be removed when either the source
or the
target
instances are finalized. To remove the binding without affecting the
source
and the target
you can just call g_object_unref() on the returned
#GBinding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source
and target
are only used from a single thread and it
is clear that both source
and target
outlive the binding. Especially it
is not safe to rely on this if the binding, source
or target
can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A #GObject can have multiple bindings.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
Creates a binding between source_property
on source
and target_property
on target,
allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
a #GClosure wrapping the transformation function from the source
to the target,
or %NULL to use the default
a #GClosure wrapping the transformation function from the target
to the source,
or %NULL to use the default
Get a blame for a single file.
the file to blame.
blame options.
Update files in the working tree to reflect the contents of current HEAD. If
options
is %NULL, then the default checkout options will be used.
If the checkout was not successfull, then error
will be set.
a #GgitCheckoutOptions or %NULL.
Update files in the working tree to reflect the contents of the index. If
index
is %NULL, then the current index of the repository will be used. If
options
is %NULL, then the default checkout options will be used.
If the checkout was not successfull, then error
will be set.
a #GgitIndex or %NULL.
a #GgitCheckoutOptions or %NULL.
Update files in the working tree to reflect the contents of the specified
commit, tag or tree object. If tree
is %NULL, then the current HEAD of the
repository will be used. If options
is %NULL, then the default checkout
options will be used.
If the checkout was not successfull, then error
will be set.
a #GgitObject or %NULL.
a #GgitCheckoutOptions or %NULL.
Cherry pick the specified commit, making changes in the index and the working directory.
a #GgitCommit.
a #GgitCherryPickOptions.
Cherry-picks the given commit
against the provided our_commit,
producing
and index that reflects the result of the cherry-pick.
a #GgitCommit to cherry-pick.
a #GgitCommit to cherry-pick on.
the parent of the commit, in case of a merge commit.
a #GgitMergeOptions.
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.
Write an in-memory buffer to the object database as a blob.
the data.
Write a path relative to the repository working directory to the object database as a blob.
the file path.
Creates a new branch pointing at a target commit.
the name of the branch.
a #GgitObject.
a #GgitCreateFlags.
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.
name of the reference to update.
author signature.
committer signature (and time of commit).
message encoding.
commit message.
the tree of objects to commit.
parent commits.
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.
name of the reference to update.
author signature.
committer signature (and time of commit).
message encoding.
commit message.
the tree of objects to commit.
parent commits.
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).
Create a new index entry. When path
is not %NULL, the path of the returned
entry (#ggit_index_entry_get_path) is set to 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 path.
a #GgitOId.
Adds a note for an object.
canonical name of the reference to use, or %NULL to use the default ref.
author signature.
committer signature.
OID of the git object to decorate.
content of the note to add for object oid.
whether to overwrite existing note.
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().
the name for the new #GgitRef.
the #GgitOId pointed to by the reference.
The one line long message to be appended to the reflog.
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().
the name for the new #GgitRef.
the full name to the reference.
The one line long message to be appended to the reflog.
Create a new tag from a buffer describing the tag object. The buffer must be correctly formatted.
the tag buffer.
a #GgitCreateFlags.
Creates a new lightweight tag.
the name of the tag.
a #GgitObject.
a #GgitCreateFlags.
Create a new tree builder.
Create a tree builder for initialized with tree
. To create an empty
tree builder, use #ggit_repository_create_tree_builder instead.
Delete an existing tag reference by name.
the name of the tag.
Removes a single stashed state from the stash list.
the position within the stash list. 0 points to the. most recent stashed state.
Get a branch enumerator to enumerate over all branches of the specified
list_type
in repository
.
a #GgitBranchType.
Gets the file status for a single file.
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.
status options, or %NULL.
a #GgitStatusCallback.
This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on object
. If the freeze count is
non-zero, the emission of "notify" signals on object
is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
#GObject::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
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.
Get the attribute value of the specified attribute for the given file.
the relative path to the file.
the name of the attribute.
a #GgitAttributeCheckFlags.
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
Gets the default notes reference for repository
. It defaults to
"refs/notes/commits".
Gets a property of an object.
The value
can be:
In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().
Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.
the name of the property to get
return location for the property value
This function gets back user data pointers stored via g_object_set_qdata().
A #GQuark, naming the user data pointer
Gets the status for a submodule.
This looks at a submodule and tries to determine the status. It
will return a combination of the %GGIT_SUBMODULE_STATUS values.
How deeply it examines the working directory to do this will depend
on ignore
.
the name of the submodule.
the ignore rules to follow.
Gets n_properties
properties for an object
.
Obtained properties will be set to values
. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.
the names of each property to get
the values of each property to get
Initializes the object implementing the interface.
This method is intended for language bindings. If writing in C, g_initable_new() should typically be used instead.
The object must be initialized before any real use after initial construction, either with this function or g_async_initable_init_async().
Implementations may also support cancellation. If cancellable
is not %NULL,
then initialization can be cancelled by triggering the cancellable object
from another thread. If the operation was cancelled, the error
%G_IO_ERROR_CANCELLED will be returned. If cancellable
is not %NULL and
the object doesn't support cancellable initialization the error
%G_IO_ERROR_NOT_SUPPORTED will be returned.
If the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. See the [introduction][ginitable] for more details.
Callers should not assume that a class which implements #GInitable can be initialized multiple times, unless the class explicitly documents itself as supporting this. Generally, a class’ implementation of init() can assume (and assert) that it will only be called once. Previously, this documentation recommended all #GInitable implementations should be idempotent; that recommendation was relaxed in GLib 2.54.
If a class explicitly supports being initialized multiple times, it is recommended that the method is idempotent: multiple calls with the same arguments should return the same results. Only the first call initializes the object; further calls return the result of the first call.
One reason why a class might need to support idempotent initialization is if it is designed to be used via the singleton pattern, with a #GObjectClass.constructor that sometimes returns an existing instance. In this pattern, a caller would expect to be able to call g_initable_init() on the result of g_object_new(), regardless of whether it is in fact a new instance.
optional #GCancellable object, %NULL to ignore.
Checks if repository
is empty.
An empty repository has just been initialized and contains no commits.
Checks whether object
has a [floating][floating-ref] reference.
Checks if repository'
s HEAD is detached.
A repository's HEAD is detached when it points directly to a commit instead of a branch.
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.
Fill a list with all the remotes in repository
.
Fill a list with all the tags in the repository
.
Fill a list with all the tags in the repository
matching the provided
pattern. The pattern can use standard fnmatch syntax.
a pattern to match.
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.
Lookups a branch by its name in a repository.
the name of the branch.
a #GgitBranchType.
Lookups a reference by its short name in repository
applying the git precendence
rules to the given shorthand to determine which reference the user is referring to.
The returned #GgitRef must be freed with g_object_unref().
the short name for the reference (e.g. master, v0.1.0, ...).
Lookups a submodule information by name or path. If the submodule does not exist, %NULL is returned and a GGIT_ERROR_NOTFOUND error set.
the name of the submodule.
Merges the given commit(s) into HEAD, writing the results into the working directory. Any changes are staged for commit and any conflicts are written to the index.
Callers should inspect the repository's index after this completes, resolve any conflicts and prepare a commit.
the heads to merge into
merge options
checkout options
Merge two trees creating a #GgitIndex reflecting the result of the merge.
the common ancestor between the trees, or %NULL.
the tree that reflects the destination tree.
the tree that reflects the source tree.
the merge options.
Loop over all the notes within a specified namespace
and issue a callback for each one.
If callback
returns a non-zero value, this will stop looping.
canonical name of the reference to use, or %NULL to use the default ref.
a #GgitNoteCallback.
Emits a "notify" signal for the property property_name
on object
.
When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.
Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.
the name of a property installed on the class of object
.
Emits a "notify" signal for the property specified by pspec
on object
.
This function omits the property name lookup, hence it is faster than g_object_notify().
One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:
enum
{
PROP_0,
PROP_FOO,
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
0, 100,
50,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
and then notify a change on the "foo" property with:
g_object_notify_by_pspec (self, properties[PROP_FOO]);
the #GParamSpec of a property installed on the class of object
.
Tests if the ignore rules apply to the path provided.
This acts similar to filtering performed when calling "git add ." on the command line.
A path within the repository.
Initializes a rebase operation to rebase the changes in branch
relative to upstream
onto another branch. To begin the rebase
process, call git_rebase_next(). When you have finished with this
object, call g_object_unref().
the terminal commit to rebase, or %NULL to rebase the current branch.
the commit to begin rebasing from, or %NULL to rebase all reachable commits.
the branch to rebase onto, or %NULL to rebase onto the given upstream.
a #GgitRebaseOptions to specify how rebase is performed, or %NULL.
Opens an existing rebase that was previously started by either an invocation of ggit_rebase_init() or by another client.
a #GgitRebaseOptions to specify how rebase is performed, or %NULL.
Increase the reference count of object,
and possibly remove the
[floating][floating-ref] reference, if object
has a floating reference.
In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.
Since GLib 2.56, the type of object
will be propagated to the return type
under the same conditions as for g_object_ref().
Gathers references and run a callback for each one.
To the callback is passed 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 #GgitReferencesCallback.
Gathers reference names 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 #GgitReferencesNameCallback.
Removes remote
from the repository
.
the remote's name.
Rename the remote of repository
from name
to new_name
.
the remote name to be renamed.
new name of the remote.
Performs a reset of type reset_type
on repository
to target,
or error
will be set.
the target #GgitObject which is a commit or a tag.
the #GgitResetType to perform.
the #GgitCheckoutOptions to be used for a HARD reset.
Update some entries in the index from the target commit tree. The scope of
the updated entries is determined by the paths specified in pathspecs
.
Passing %NULL in target
will result in removing entries in the index
matching the provided pathspecs.
the target #GgitObject which is a commit or a tag.
a list of file paths to reset.
Revert the given commit
on top of the current working directory.
a #GgitCommit.
a #GgitRevertOptions.
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
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 #GgitSignature.
description along with the stashed state or %NULL to be autogenerated.
a #GgitStashFlags to control the stashing process.
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
If the object already had an association with that name, the old association will be destroyed.
Internally, the key
is converted to a #GQuark using g_quark_from_string().
This means a copy of key
is kept permanently (even after object
has been
finalized) — so it is recommended to only use a small, bounded set of values
for key
in your program, to avoid the #GQuark storage growing unbounded.
name of the key
data to associate with that key
Sets a property on an object.
the name of the property to set
the value
Sets url for the remote
from the repository
.
the remote name who's url is to be set.
url of the remote.
Sets the submodule.'name'.fetchRecurseSubmodules value for the submodule. This setting won't affect any existing instances..
the name of the submodule.
a #GgitSubmoduleRecurse.
Sets the ignore rule for the submodule in the configuration. This does not affect any currently-loaded instances..
the name of the submodule.
a #GgitSubmoduleIgnore.
Sets the update rule for the submodule in the configuration. This setting won't affect any existing instances.
the name of the submodule.
a #GgitSubmoduleUpdate.
Sets the URL for the submodule in the configuration.
After calling this, you may wish to call ggit_submodule_sync() to write the changes to the checked out submodule repository.
the name of the submodule to configure.
URL that should be used for the submodule.
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 #GgitStashCallback.
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
This function gets back user data pointers stored via
g_object_set_qdata() and removes the data
from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrieve the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().
A #GQuark, naming the user data pointer
Gathers submodules and run a callback for each one.
To the callback is passed the submodule instance and name. If the callback
returns something other than 0, the iteration will stop and error
will be set.
NOTE: the submodule instance passed to the callback is only valid during the call to ggit_repository_submodule_foreach and may not be used after the call has finished.
a #GgitStatusCallback.
Get all the tags in the repository and run the provided callback on each. If
the callback returns something other than 0, the iteration will stop and
error
will be set.
a #GgitTagCallback.
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on object
and when it reaches zero, queued "notify" signals are emitted.
Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.
It is an error to call this function when the freeze count is zero.
Decreases the reference count of object
. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.
This function essentially limits the life time of the closure
to
the life time of the object. That is, when the object is finalized,
the closure
is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the closure,
to ensure that an extra
reference count is held on object
during invocation of the
closure
. Usually, this function will be called on closures that
use this object
as closure data.
#GClosure to watch
Clones a new git repository in the given folder.
url to fetch the repository from.
the location of the repository.
a #GgitCloneOptions.
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.
indictaes whether lookup will work across filesystem devices.
a list of absolute paths at which lookup will stop when reached, or %NULL.
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.
Find the #GParamSpec with the given name for an
interface. Generally, the interface vtable passed in as g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
name of a property to look up.
Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.
This function is meant to be called from the interface's default
vtable initialization function (the class_init
member of
#GTypeInfo.) It must not be called after after class_init
has
been called for any object types implementing this interface.
If pspec
is a floating reference, it will be consumed.
any interface vtable for the interface, or the default vtable for the interface.
the #GParamSpec for the new property
Lists the properties of an interface.Generally, the interface
vtable passed in as g_iface
will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.
the type id of the #GObject subtype to instantiate
an array of #GParameter
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.
Represents an existing git repository including all of it's object contents.