Git-Raw

 view release on metacpan or  search on metacpan

Raw.xs  view on Meta::CPAN


	OUTPUT: RETVAL

void
features(class)
	SV *class

	PREINIT:
		int ctx = GIMME_V;

	PPCODE:
		if (ctx != G_VOID) {
			if (ctx == G_ARRAY) {
				int features = git_libgit2_features();

				mXPUSHs(newSVpv("threads", 0));
				mXPUSHs(newSViv((features & GIT_FEATURE_THREADS) ? 1 : 0));
				mXPUSHs(newSVpv("https", 0));
				mXPUSHs(newSViv((features & GIT_FEATURE_HTTPS) ? 1 : 0));
				mXPUSHs(newSVpv("ssh", 0));
				mXPUSHs(newSViv((features & GIT_FEATURE_SSH) ? 1 : 0));

xs/Blame.xs  view on Meta::CPAN


void
hunks(self, ...)
	SV *self

	PROTOTYPE: $;$

	PREINIT:
		size_t start = 0, end, num_hunks;

	PPCODE:
		num_hunks = git_blame_get_hunk_count(GIT_SV_TO_PTR(Blame, self));

		if (items == 2) {
			SV *index = ST(1);

			if (!SvIOK(index) || SvIV(index) < 0)
				croak_usage("Invalid type for 'index'");

			start = SvUV(index);
			if (start >= num_hunks)

xs/Cert/HostKey.xs  view on Meta::CPAN


void
ssh_types(self)
	Cert_HostKey self

	PREINIT:
		int ctx;

		git_cert_ssh_t type;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int count = 0;

			type = self -> type;

			if (type & GIT_CERT_SSH_MD5) {
				if (ctx == G_ARRAY)
					mXPUSHs(newSVpv("md5", 0));

xs/Commit.xs  view on Meta::CPAN


	OUTPUT: RETVAL

void
parents(self)
	SV *self

	PREINIT:
		int ctx;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int rc, count;
			Commit child;
			SV *repo = GIT_SV_TO_MAGIC(self);

			child = GIT_SV_TO_PTR(Commit, self);
			count = git_commit_parentcount(child);

xs/Diff.xs  view on Meta::CPAN

void
deltas(self, ...)
	SV *self

	PROTOTYPE: $;$

	PREINIT:
		int ctx;
		size_t start = 0, end, num_deltas;

	PPCODE:
		ctx = GIMME_V;

		if (ctx == G_VOID)
			XSRETURN_EMPTY;

		num_deltas = git_diff_num_deltas(GIT_SV_TO_PTR(Diff, self));

		if (items == 2) {
			SV *index = ST(1);

xs/Diff.xs  view on Meta::CPAN


	OUTPUT: RETVAL

void
patches(self)
	SV *self

	PREINIT:
		int ctx;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int rc;
			size_t count;
			Diff diff_ptr;
			diff_ptr = GIT_SV_TO_PTR(Diff, self);

			count = git_diff_num_deltas(diff_ptr);
			if (ctx == G_ARRAY) {

xs/Graph.xs  view on Meta::CPAN

	SV *upstream

	PREINIT:
		int ctx;

		Repository repo_ptr;

		size_t ahead, behind;
		git_oid local_id, upstream_id;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int rc;

			repo_ptr = GIT_SV_TO_PTR(Repository, repo);
			if (git_sv_to_commitish(repo_ptr -> repository, local, &local_id) == NULL)
				croak_resolve("Could not resolve 'local' to a commit id");

			if (git_sv_to_commitish(repo_ptr -> repository, upstream, &upstream_id) == NULL)

xs/Graph.xs  view on Meta::CPAN

	SV *upstream

	PREINIT:
		int ctx;

		Repository repo_ptr;

		size_t ahead, behind;
		git_oid local_id, upstream_id;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int rc;

			repo_ptr = GIT_SV_TO_PTR(Repository, repo);
			if (git_sv_to_commitish(repo_ptr -> repository, local, &local_id) == NULL)
				croak_resolve("Could not resolve 'local' to a commit id");

			if (git_sv_to_commitish(repo_ptr -> repository, upstream, &upstream_id) == NULL)

xs/Index.xs  view on Meta::CPAN


void
entries(self)
	SV *self

	PREINIT:
		size_t i, count;

		Index index_ptr = NULL;

	PPCODE:
		index_ptr = GIT_SV_TO_PTR(Index, self);
		count = git_index_entrycount(index_ptr);

		if (count > 0) {
			SV *repo = GIT_SV_TO_MAGIC(self);

			for (i = 0; i < count; ++i) {
				SV *entry = git_index_entry_to_sv(
					git_index_get_byindex(index_ptr, i), NULL, repo);
				mXPUSHs(entry);

xs/Index.xs  view on Meta::CPAN

	PREINIT:
		int rc;

		SV *repo;

		git_index_conflict_iterator *iter;
		const git_index_entry *ancestor, *ours, *theirs;

		size_t num_conflicts = 0;

	PPCODE:
		rc = git_index_conflict_iterator_new(
			&iter, GIT_SV_TO_PTR(Index, self)
		);
		git_check_error(rc);

		repo = GIT_SV_TO_MAGIC(self);

		while ((rc = git_index_conflict_next(
			&ancestor, &ours, &theirs, iter)) == GIT_OK) {
			SV *c = NULL;

xs/Index.xs  view on Meta::CPAN

		Safefree(paths.strings);
		git_check_error(rc);

void
capabilities(self)
	Index self

	PREINIT:
		int ctx = GIMME_V;

	PPCODE:
		if (ctx != G_VOID) {
			if (ctx == G_ARRAY) {
				int caps = git_index_caps(self);

				mXPUSHs(newSVpv("ignore_case", 0));
				mXPUSHs(newSViv((caps & GIT_INDEXCAP_IGNORE_CASE) ? 1 : 0));
				mXPUSHs(newSVpv("no_filemode", 0));
				mXPUSHs(newSViv((caps & GIT_INDEXCAP_NO_FILEMODE) ? 1 : 0));
				mXPUSHs(newSVpv("no_symlinks", 0));
				mXPUSHs(newSViv((caps & GIT_INDEXCAP_NO_SYMLINKS) ? 1 : 0));

xs/Patch.xs  view on Meta::CPAN


void
hunks(self, ...)
	SV *self

	PROTOTYPE: $;$

	PREINIT:
		size_t start = 0, end, num_hunks;

	PPCODE:
		num_hunks = git_patch_num_hunks(GIT_SV_TO_PTR(Patch, self));

		if (items == 2) {
			SV *index = ST(1);

			if (!SvIOK(index) || SvIV(index) < 0)
				croak_usage("Invalid type for 'index'");

			start = SvUV(index);
			if (start >= num_hunks)

xs/PathSpec/MatchList.xs  view on Meta::CPAN


	OUTPUT: RETVAL

void
entries(self)
	PathSpec_MatchList self;

	PREINIT:
		size_t i, count;

	PPCODE:
		count = git_pathspec_match_list_entrycount(self);

		for (i = 0; i < count; ++i) {
			SV *path = newSVpv(git_pathspec_match_list_entry(self, i), 0);
			mXPUSHs(path);
		}

		XSRETURN(count);

SV *

xs/PathSpec/MatchList.xs  view on Meta::CPAN


	OUTPUT: RETVAL

void
failed_entries(self)
	PathSpec_MatchList self;

	PREINIT:
		size_t i, count;

	PPCODE:
		count = git_pathspec_match_list_failed_entrycount(self);

		for (i = 0; i < count; ++i) {
			SV *path = newSVpv(git_pathspec_match_list_failed_entry(self, i), 0);
			mXPUSHs(path);
		}

		XSRETURN(count);

void

xs/Rebase.xs  view on Meta::CPAN

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);

xs/Reflog.xs  view on Meta::CPAN


void
entries(self, ...)
	SV *self

	PROTOTYPE: $;$$
	PREINIT:
		Reflog reflog;
		size_t start = 0, end, entry_count;

	PPCODE:
		reflog = GIT_SV_TO_PTR(Reflog, self);
		entry_count = git_reflog_entrycount (reflog);

		if (items >= 2) {
			SV *index = ST(1);

			if (!SvIOK(index) || SvIV(index) < 0)
				croak_usage("Invalid type for 'index'");

			start = SvUV(index);

xs/Remote.xs  view on Meta::CPAN


void
refspecs(self)
	SV *self

	PREINIT:
		size_t i, count;

		Remote remote_ptr;

	PPCODE:
		remote_ptr = GIT_SV_TO_PTR(Remote, self);

		count = git_remote_refspec_count(remote_ptr -> remote);

		for (i = 0; i < count; ++i) {
			RefSpec spec;
			const git_refspec *s;
			SV *tmp;

			s = git_remote_get_refspec(

xs/Remote.xs  view on Meta::CPAN

push(self, refspecs, ...)
	Remote self
	SV *refspecs

	PREINIT:
		int rc;

		git_push_options push_opts = GIT_PUSH_OPTIONS_INIT;
		git_strarray specs = {NULL, 0};

	PPCODE:
		git_list_to_paths(
			git_ensure_av(refspecs, "refspecs"),
			&specs
		);

		if (items >= 3) {
			HV *opts = git_ensure_hv(ST(2), "push_opts");
			git_hv_to_push_opts(opts, &push_opts);
		}

xs/Remote.xs  view on Meta::CPAN

void
upload(self, refspecs, ...)
	Remote self
	SV *refspecs

	PREINIT:
		int rc;
		git_push_options push_opts = GIT_PUSH_OPTIONS_INIT;
		git_strarray specs = {NULL, 0};

	PPCODE:
		git_list_to_paths(
			git_ensure_av(refspecs, "refspecs"),
			&specs
		);

		if (items >= 3) {
			HV *opts = git_ensure_hv(ST(2), "push_opts");
			git_hv_to_push_opts(opts, &push_opts);
		}

xs/Repository.xs  view on Meta::CPAN

		git_status_list_free(list);

		RETVAL = status_hv;

	OUTPUT: RETVAL

void
is_worktree(self)
	Repository self

	PPCODE:
		if (git_repository_is_worktree (self -> repository))
			XSRETURN_YES;

		XSRETURN_NO;

SV *
path_is_ignored(self, path)
	Repository self
	const char *path

xs/Repository.xs  view on Meta::CPAN

		int rc;

		Branch branch;
		int num_branches = 0;

		git_branch_t type;
		git_branch_iterator *itr;

		Repository repo;

	PPCODE:
		type = GIT_BRANCH_ALL;

		if (items == 2) {
			const char *type_str = git_ensure_pv(ST(1), "type");

			if (strcmp(type_str, "local") == 0)
				type = GIT_BRANCH_LOCAL;
			else if (strcmp(type_str, "remote") == 0)
				type = GIT_BRANCH_REMOTE;
			else if (strcmp(type_str, "all") == 0)

xs/Repository.xs  view on Meta::CPAN


	PREINIT:
		int rc;
		size_t i;

		int num_remotes = 0;
		git_strarray remotes;

		Repository repo;

	PPCODE:
		repo = GIT_SV_TO_PTR(Repository, self);

		rc = git_remote_list(&remotes, repo -> repository);
		git_check_error(rc);

		for (i = 0; i < remotes.count; i++) {
			SV *perl_ref;
			git_remote *r = NULL;
			Remote remote = NULL;

xs/Repository.xs  view on Meta::CPAN

	PREINIT:
		int rc;

		Reference ref;
		int num_refs = 0;

		git_reference_iterator *itr;

		Repository repo = NULL;

	PPCODE:
		repo = GIT_SV_TO_PTR(Repository, self);
		rc = git_reference_iterator_new(&itr, repo -> repository);
		git_check_error(rc);

		while ((rc = git_reference_next(&ref, itr)) == 0) {
			SV *perl_ref;

			GIT_NEW_OBJ_WITH_MAGIC(
				perl_ref, "Git::Raw::Reference", ref, SvRV(self)
			);

xs/Repository.xs  view on Meta::CPAN

void
revparse(self, spec)
	SV *self
	SV *spec

	PREINIT:
		int rc;
		int ctx, count = 0;
		git_revspec rs = {NULL, NULL, 0};

	PPCODE:
		ctx = GIMME_V;

		Repository repo = GIT_SV_TO_PTR(Repository, self);
		rc = git_revparse(&rs, repo -> repository,
			git_ensure_pv(spec, "spec"));
		git_check_error(rc);

		if (ctx != G_VOID) {
			if (ctx == G_ARRAY) {
				mXPUSHs(git_obj_to_sv(rs.from, SvRV(self)));

xs/Tree.xs  view on Meta::CPAN


void
entries(self)
	SV *self

	PREINIT:
		int ctx;

		Tree self_ptr;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int rc, count;

			self_ptr = GIT_SV_TO_PTR(Tree, self);
			count = git_tree_entrycount(self_ptr);

			if (ctx == G_ARRAY) {
				int i;

xs/Tree/Builder.xs  view on Meta::CPAN


	PREINIT:
		int rc;

		const git_oid *oid;
		const Tree_Entry tmp_entry;
		Tree_Entry entry;

		int is_returning = GIMME_V != G_VOID;

	PPCODE:
		if (sv_isobject(object) && sv_derived_from(object, "Git::Raw::Blob"))
			oid = git_blob_id(GIT_SV_TO_PTR(Blob, object));
		else
			oid = git_tree_id(GIT_SV_TO_PTR(Tree, object));

		rc = git_treebuilder_insert(
			is_returning ? (const git_tree_entry **) &tmp_entry : NULL,
			GIT_SV_TO_PTR(Tree::Builder, self),
			filename, oid, mode
		);

xs/Tree/Builder.xs  view on Meta::CPAN

		int rc;

		Tree tree;
		git_oid oid;

		SV *repo;
		Repository repo_ptr;

		int is_returning = GIMME_V != G_VOID;

	PPCODE:
		repo     = GIT_SV_TO_MAGIC(self);
		repo_ptr = INT2PTR(Repository, SvIV((SV *) repo));

		rc = git_treebuilder_write(
			&oid, GIT_SV_TO_PTR(Tree::Builder, self)
		);
		git_check_error(rc);

		if (is_returning) {
			rc = git_tree_lookup(&tree, repo_ptr -> repository, &oid);

xs/Walker.xs  view on Meta::CPAN


	OUTPUT: RETVAL

void
all(self)
	SV *self

	PREINIT:
		int ctx;

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			int rc;
			git_oid oid;
			size_t count = 0;
			SV *repo = GIT_SV_TO_MAGIC(self);
			Walker walk = GIT_SV_TO_PTR(Walker, self);

			while ((rc = git_revwalk_next(&oid, walk)) != GIT_ITEROVER) {

xs/Worktree.xs  view on Meta::CPAN

list(class, repo)
	SV *class
	Repository repo

	PREINIT:
		int rc, ctx;

		int i, num_worktrees = 0;
		git_strarray worktrees = {0, 0};

	PPCODE:
		ctx = GIMME_V;

		if (ctx != G_VOID) {
			rc = git_worktree_list(&worktrees, repo -> repository);
			git_check_error(rc);

			for (i = 0; i < worktrees.count; ++i) {
				if (ctx == G_ARRAY)
					mXPUSHs(newSVpv(worktrees.strings[i], 0));
				++num_worktrees;

xs/Worktree.xs  view on Meta::CPAN

			XSRETURN_EMPTY;

void
is_locked(self)
	Worktree self

	PREINIT:
		int rc;
		git_buf buf = GIT_BUF_INIT_CONST(NULL, 0);

	PPCODE:
		rc = git_worktree_is_locked(&buf, self);
		if (rc < 0) {
			git_buf_dispose(&buf);
			git_check_error(rc);
		}

		if (rc > 0)
			mXPUSHp (buf.ptr, buf.size);
		else
			mXPUSHi (0);

xs/Worktree.xs  view on Meta::CPAN


void
is_prunable(self, opts)
	Worktree self
	HV *opts

	PREINIT:
		int rc;
		git_worktree_prune_options prune_options = GIT_WORKTREE_PRUNE_OPTIONS_INIT;

	PPCODE:
		git_hv_to_worktree_prune_opts(opts, &prune_options);
		rc = git_worktree_is_prunable(self, &prune_options);
		XSRETURN_IV(rc);

void
lock(self, reason)
	Worktree self
	SV *reason

	PREINIT:
		int rc;

	PPCODE:
		rc = git_worktree_lock(self, git_ensure_pv(reason, "reason"));
		git_check_error(rc);

		XSRETURN_YES;

void
unlock(self)
	Worktree self

	PREINIT:

xs/Worktree.xs  view on Meta::CPAN

		rc = git_worktree_unlock(self);
		git_check_error(rc);

void
validate(self)
	Worktree self

	PREINIT:
		int rc;

	PPCODE:
		rc = git_worktree_validate(self);
		if (rc == 0)
			XSRETURN_YES;

		XSRETURN_NO;

void
prune(self, opts)
	Worktree self
	HV *opts



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