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

Function Blob_diff_to_buffer

src/blob.c:124–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 " Treat buffer as if it had this filename.\n");
123
124PyObject *
125Blob_diff_to_buffer(Blob *self, PyObject *args, PyObject *kwds)
126{
127 git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
128 git_patch *patch;
129 char *old_as_path = NULL, *buffer_as_path = NULL;
130 const char *buffer = NULL;
131 Py_ssize_t buffer_len;
132 int err;
133 char *keywords[] = {"buffer", "flags", "old_as_path", "buffer_as_path", NULL};
134
135 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|z#Iss", keywords,
136 &buffer, &buffer_len, &opts.flags,
137 &old_as_path, &buffer_as_path))
138 return NULL;
139
140 if (Object__load((Object*)self) == NULL) { return NULL; } // Lazy load
141
142 err = git_patch_from_blob_and_buffer(&patch, self->blob, old_as_path,
143 buffer, buffer_len, buffer_as_path,
144 &opts);
145 if (err < 0)
146 return Error_set(err);
147
148 return wrap_patch(patch, self, NULL);
149}
150
151
152struct blob_filter_stream {

Callers

nothing calls this directly

Calls 3

Object__loadFunction · 0.85
Error_setFunction · 0.85
wrap_patchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…