Git-Raw

 view release on metacpan or  search on metacpan

xs/Rebase.xs  view on Meta::CPAN

		repo_ptr = GIT_SV_TO_PTR(Repository, repo);

		rc = git_rebase_open(&rebase, repo_ptr -> repository,
			&rebase_options
		);
		git_check_error(rc);

		GIT_NEW_OBJ_WITH_MAGIC(
			RETVAL, SvPVbyte_nolen(class), rebase, SvRV(repo)
		);

	OUTPUT: RETVAL

SV *
current_operation(self)
	SV *self

	PREINIT:
		Rebase rebase;
		Rebase_Operation op;

	CODE:
		rebase = GIT_SV_TO_PTR(Rebase, self);

		if (!git_rebase_operation_entrycount(rebase))
			croak_usage("Rebase has no operations");

		op = git_rebase_operation_byindex(rebase,
			git_rebase_operation_current(rebase)
		);

		if (op == NULL)
			XSRETURN_UNDEF;

		GIT_NEW_OBJ_WITH_MAGIC(
			RETVAL, "Git::Raw::Rebase::Operation",
			op, GIT_SV_TO_MAGIC(self)
		);

	OUTPUT: RETVAL

unsigned int
operation_count(self)
	Rebase self

	CODE:
		RETVAL = git_rebase_operation_entrycount(self);

	OUTPUT: RETVAL

void
operations(self)
	SV *self

	PREINIT:
		int ctx;
		size_t i, count;

		Rebase rebase;

	PPCODE:
		ctx = GIMME_V;
		if (ctx == G_VOID)
			XSRETURN_EMPTY;

		rebase = GIT_SV_TO_PTR(Rebase, self);
		count = git_rebase_operation_entrycount(rebase);

		if (ctx == G_SCALAR)
			XSRETURN_IV((int) count);

		for (i = 0; i < count; ++i) {
			SV *tmp;

			Rebase_Operation op =
				git_rebase_operation_byindex(rebase, i);

			GIT_NEW_OBJ_WITH_MAGIC(
				tmp, "Git::Raw::Rebase::Operation",
				op, SvRV(self)
			);
			mXPUSHs(tmp);
		}

		XSRETURN((int) count);

SV *
orig_head_name(self)
	Rebase self

	CODE:
		const char *head_name = git_rebase_orig_head_name(self);
		if (head_name == NULL)
			XSRETURN_UNDEF;

		RETVAL = newSVpv (head_name, 0);

	OUTPUT: RETVAL

SV *
orig_head_id(self)
	Rebase self

	CODE:
		const git_oid *oid = git_rebase_orig_head_id(self);
		if (oid == NULL)
			XSRETURN_UNDEF;

		RETVAL = git_oid_to_sv(oid);

	OUTPUT: RETVAL

SV *
onto_name(self)
	Rebase self

	CODE:
		const char *onto_name = git_rebase_onto_name(self);
		if (onto_name == NULL)
			XSRETURN_UNDEF;



( run in 1.796 second using v1.01-cache-2.11-cpan-5511b514fd6 )