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

Function Stash_richcompare

src/stash.c:83–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83PyObject *
84Stash_richcompare(PyObject *o1, PyObject *o2, int op)
85{
86 int eq = 0;
87 Stash *s1, *s2;
88 git_oid *oid1, *oid2;
89
90 /* We only support comparing to another stash */
91 if (!PyObject_TypeCheck(o2, &StashType)) {
92 Py_INCREF(Py_NotImplemented);
93 return Py_NotImplemented;
94 }
95
96 s1 = (Stash *)o1;
97 s2 = (Stash *)o2;
98
99 oid1 = &((Oid *)s1->commit_id)->oid;
100 oid2 = &((Oid *)s2->commit_id)->oid;
101
102 eq = git_oid_equal(oid1, oid2) &&
103 (0 == strcmp(s1->message, s2->message));
104
105 switch (op) {
106 case Py_EQ:
107 if (eq) {
108 Py_RETURN_TRUE;
109 } else {
110 Py_RETURN_FALSE;
111 }
112 case Py_NE:
113 if (eq) {
114 Py_RETURN_FALSE;
115 } else {
116 Py_RETURN_TRUE;
117 }
118 default:
119 Py_INCREF(Py_NotImplemented);
120 return Py_NotImplemented;
121 }
122}
123
124
125PyGetSetDef Stash_getseters[] = {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…