Example #1
0
static GgitRemoteHead *
_ggit_remote_head_wrap (const git_remote_head *remote_head)
{
	GgitRemoteHead *ret;

	ret = g_slice_new (GgitRemoteHead);
	ret->ref_count = 1;
	ret->is_local = remote_head->local;
	ret->oid = _ggit_oid_wrap (&remote_head->oid);
	ret->local_oid = _ggit_oid_wrap (&remote_head->loid);
	ret->name = g_strdup (remote_head->name);

	return ret;
}
Example #2
0
/**
 * ggit_index_entry_get_id:
 * @entry: a #GgitIndexEntry.
 *
 * Get the oid of the index entry.
 *
 * Returns: the oid.
 *
 **/
GgitOId *
ggit_index_entry_get_id (GgitIndexEntry *entry)
{
	g_return_val_if_fail (entry != NULL, NULL);

	return _ggit_oid_wrap (&entry->entry->id);
}
Example #3
0
/**
 * ggit_rebase_operation_get_id:
 * @rebase_operation: a #GgitRebaseOperation.
 *
 * Gets the commit ID being cherry-picked. This will be populated for
 * all operations except those of type @GGIT_REBASE_OPERATION_EXEC.
 *
 * Returns: (transfer full): the commit ID being cherry-picked.
 */
GgitOId *
ggit_rebase_operation_get_id (GgitRebaseOperation *rebase_operation)
{
	g_return_val_if_fail (rebase_operation != NULL, NULL);

	return _ggit_oid_wrap ((git_oid *)&rebase_operation->rebase_operation->id);
}
Example #4
0
/**
 * ggit_reflog_entry_get_old_id:
 * @reflog_entry: a #GgitReflogEntry.
 *
 * Gets the old #GgitOId.
 *
 * Returns: (transfer full) (nullable): the old oid or %NULL.
 */
GgitOId *
ggit_reflog_entry_get_old_id (GgitReflogEntry *reflog_entry)
{
	const git_oid *oid;

	g_return_val_if_fail (reflog_entry != NULL, NULL);

	oid = git_reflog_entry_id_old (reflog_entry->reflog_entry);

	return _ggit_oid_wrap (oid);
}
Example #5
0
/**
 * ggit_annotated_commit_get_id:
 * @annotated_commit: a #GgitAnnotatedCommit.
 *
 * Gets the commit ID that the given @annotated_commit refs to.
 *
 * Returns: (transfer full): the commit ID that the given @annotated_commit refs to.
 */
GgitOId *
ggit_annotated_commit_get_id (GgitAnnotatedCommit *annotated_commit)
{
	const git_oid *oid;

	g_return_val_if_fail (annotated_commit != NULL, NULL);

	oid = git_annotated_commit_id (annotated_commit->annotated_commit);

	return _ggit_oid_wrap ((git_oid *)oid);
}
Example #6
0
/**
 * ggit_tag_get_target_id:
 * @tag: a #GgitTag.
 *
 * Gets the target #GgitOId of @tag.
 *
 * Returns: (transfer full): the target #GgitOId of the tag.
 */
GgitOId *
ggit_tag_get_target_id (GgitTag *tag)
{
	const git_oid *oid;
	git_tag *t;

	g_return_val_if_fail (GGIT_IS_TAG (tag), NULL);

	t = _ggit_native_get (tag);
	oid = git_tag_target_id (t);

	return _ggit_oid_wrap ((git_oid *)oid);
}
Example #7
0
/**
 * ggit_tree_get_id:
 * @tree: a #GgitTree.
 *
 * Get the #GgitOId of the tree.
 *
 * Returns: (transfer full): a #GgitOId.
 *
 **/
GgitOId *
ggit_tree_get_id (GgitTree *tree)
{
	git_tree *t;
	const git_oid *oid;

	g_return_val_if_fail (GGIT_IS_TREE (tree), NULL);

	t = _ggit_native_get (tree);

	oid = git_tree_id (t);

	return _ggit_oid_wrap (oid);
}
Example #8
0
/**
 * ggit_ref_get_target:
 * @ref: a #GgitRef.
 *
 * 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).
 *
 * Returns: (transfer full): a new oid if available, %NULL otherwise.
 */
GgitOId *
ggit_ref_get_target (GgitRef *ref)
{
	GgitOId *goid = NULL;
	const git_oid *oid;

	g_return_val_if_fail (ref != NULL, NULL);

	oid = git_reference_target (_ggit_native_get (ref));

	if (oid != NULL)
	{
		goid = _ggit_oid_wrap ((git_oid *)oid);
	}

	return goid;
}