MCPcopy Create free account
hub / github.com/libgit2/pygit2 / Repository_merge_base

Function Repository_merge_base

src/repository.c:556–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554 "Returns None if there is no merge base between the commits");
555
556PyObject *
557Repository_merge_base(Repository *self, PyObject *args)
558{
559 PyObject *value1;
560 PyObject *value2;
561 git_oid oid;
562 git_oid oid1;
563 git_oid oid2;
564 int err;
565
566 if (!PyArg_ParseTuple(args, "OO", &value1, &value2))
567 return NULL;
568
569 err = py_oid_to_git_oid_expand(self->repo, value1, &oid1);
570 if (err < 0)
571 return NULL;
572
573 err = py_oid_to_git_oid_expand(self->repo, value2, &oid2);
574 if (err < 0)
575 return NULL;
576
577 err = git_merge_base(&oid, self->repo, &oid1, &oid2);
578
579 if (err == GIT_ENOTFOUND)
580 Py_RETURN_NONE;
581
582 if (err < 0)
583 return Error_set(err);
584
585 return git_oid_to_python(&oid);
586}
587
588typedef int (*git_merge_base_xxx_t)(git_oid *out, git_repository *repo, size_t length, const git_oid input_array[]);
589

Callers

nothing calls this directly

Calls 3

py_oid_to_git_oid_expandFunction · 0.85
Error_setFunction · 0.85
git_oid_to_pythonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…