Top |
Functions
gboolean | ggit_ref_is_valid_name () |
GgitOId * | ggit_ref_get_target () |
const gchar * | ggit_ref_get_symbolic_target () |
GgitRefType | ggit_ref_get_reference_type () |
const gchar * | ggit_ref_get_name () |
const gchar * | ggit_ref_get_shorthand () |
const gchar * | ggit_ref_to_string () |
GgitRef * | ggit_ref_resolve () |
GgitRepository * | ggit_ref_get_owner () |
GgitRef * | ggit_ref_set_symbolic_target () |
GgitRef * | ggit_ref_set_target () |
GgitRef * | ggit_ref_rename () |
void | ggit_ref_delete () |
GgitObject * | ggit_ref_lookup () |
gboolean | ggit_ref_has_log () |
GgitReflog * | ggit_ref_get_log () |
void | ggit_ref_delete_log () |
gboolean | ggit_ref_is_branch () |
gboolean | ggit_ref_is_note () |
gboolean | ggit_ref_is_remote () |
gboolean | ggit_ref_is_tag () |
Functions
ggit_ref_is_valid_name ()
gboolean
ggit_ref_is_valid_name (const gchar *name
);
Check if the given name
is a valid name for a reference. Note that name
should be the full ref name (including prefixes).
Valid toplevel names can contain only capital letters and underscores and must start and end with a letter (e.g. HEAD, ORIG_HEAD).
Valid refs/ names may contain any characters, except '~', '^', ':', '\', '?', '[', '*', ".." and "@{", because they are interpreted by revparse.
ggit_ref_get_target ()
GgitOId *
ggit_ref_get_target (GgitRef *ref
);
Get the OID pointed to by a direct reference. Only available if the reference is direct (i.e. an object id reference, not a symbolic one).
ggit_ref_get_symbolic_target ()
const gchar *
ggit_ref_get_symbolic_target (GgitRef *ref
);
Get full name to the reference pointed to by a symbolic reference. Only available if the reference is symbolic.
ggit_ref_get_reference_type ()
GgitRefType
ggit_ref_get_reference_type (GgitRef *ref
);
Gets the type of ref
. Either direct (GGIT_REF_OID) or
symbolic (GGIT_REF_SYMBOLIC).
ggit_ref_get_shorthand ()
const gchar *
ggit_ref_get_shorthand (GgitRef *ref
);
Gets the shorthand name of ref
.
ggit_ref_to_string ()
const gchar *
ggit_ref_to_string (GgitRef *ref
);
Get a string representation of the ref.
ggit_ref_resolve ()
GgitRef * ggit_ref_resolve (GgitRef *ref
,GError **error
);
Resolves a symbolic reference.
This method iteratively peels a symbolic reference until it resolves to a direct reference to an OID.
If a direct reference is passed as an argument, that reference is returned immediately.
ggit_ref_get_owner ()
GgitRepository *
ggit_ref_get_owner (GgitRef *ref
);
Gets the repository where ref
resides.
ggit_ref_set_symbolic_target ()
GgitRef * ggit_ref_set_symbolic_target (GgitRef *ref
,const gchar *target
,const gchar *log_message
,GError **error
);
Create a new reference with the same name as the given reference but a different symbolic target. The reference must be a symbolic reference, otherwise this will fail.
The new reference will be written to disk, overwriting the given reference.
The target name will be checked for validity.
See
for rules about valid names.ggit_ref_create_symbolic()
Parameters
ref |
a GgitRef. |
|
target |
The new target for the reference. |
|
log_message |
The one line long message to be appended to the reflog. |
|
error |
a GError for error reporting, or |
ggit_ref_set_target ()
GgitRef * ggit_ref_set_target (GgitRef *ref
,GgitOId *oid
,const gchar *log_message
,GError **error
);
Create a new reference with the same name as the given reference but a different OID target. The reference must be a direct reference, otherwise this will fail.
The new reference will be written to disk, overwriting the given reference.
ggit_ref_rename ()
GgitRef * ggit_ref_rename (GgitRef *ref
,const gchar *new_name
,gboolean force
,const gchar *log_message
,GError **error
);
Rename an existing reference.
This method works for both direct and symbolic references.
The new name will be checked for validity.
See
for rules about valid names.ggit_ref_create_symbolic()
If not error, ref
will be deleted from disk and a
new GgitRef will be returned.
The reference will be immediately renamed in-memory and on disk.
If the force
flag is not enabled, and there's already
a reference with the given name, the renaming will fail.
IMPORTANT: The user needs to write a proper reflog entry if the reflog is enabled for the repository. We only rename the reflog if it exists.
Parameters
ref |
a GgitRef. |
|
new_name |
the new name. |
|
force |
|
|
log_message |
The one line long message to be appended to the reflog. |
|
error |
a GError for error reporting, or |
ggit_ref_delete ()
void ggit_ref_delete (GgitRef *ref
,GError **error
);
Deletes ref
.
This method works for both direct and symbolic references.
The reference will be immediately removed on disk and from memory. The given reference pointer will no longer be valid.
ggit_ref_lookup ()
GgitObject * ggit_ref_lookup (GgitRef *ref
,GError **error
);
Convenient method to resolve a reference to an object.
ggit_ref_get_log ()
GgitReflog * ggit_ref_get_log (GgitRef *ref
,GError **error
);
Gets the GgitReflog for ref
. The reflog will be created if it doesn't exist
yet.
ggit_ref_delete_log ()
void ggit_ref_delete_log (GgitRef *ref
,GError **error
);
Deletes the log for ref
, on error error
is set.
ggit_ref_is_branch ()
gboolean
ggit_ref_is_branch (GgitRef *ref
);
Check whether the reference is a branch.
ggit_ref_is_note ()
gboolean
ggit_ref_is_note (GgitRef *ref
);
Check whether the reference is a note.
ggit_ref_is_remote ()
gboolean
ggit_ref_is_remote (GgitRef *ref
);
Check whether the reference is a remote.