int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *name) { assert(out && spec && name); git_buf_sanitize(out); if (!git_refspec_dst_matches(spec, name)) { giterr_set(GITERR_INVALID, "ref '%s' doesn't match the destination", name); return -1; } if (!spec->pattern) return git_buf_puts(out, spec->src); return refspec_transform(out, spec->dst, spec->src, name); }
PyObject * Refspec_dst_matches(Refspec *self, PyObject *py_str) { char *str; int res; str = py_str_to_c_str(py_str, NULL); if (!str) return NULL; res = git_refspec_dst_matches(self->refspec, str); free(str); if (res) Py_RETURN_TRUE; Py_RETURN_FALSE; }