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

Function Blob_diff

src/blob.c:73–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 " before the hunks will be merged into one.\n");
72
73PyObject *
74Blob_diff(Blob *self, PyObject *args, PyObject *kwds)
75{
76 git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
77 git_patch *patch;
78 char *old_as_path = NULL, *new_as_path = NULL;
79 Blob *other = NULL;
80 int err;
81 char *keywords[] = {"blob", "flags", "old_as_path", "new_as_path", "context_lines", "interhunk_lines", NULL};
82
83 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!IssHH", keywords,
84 &BlobType, &other, &opts.flags,
85 &old_as_path, &new_as_path,
86 &opts.context_lines, &opts.interhunk_lines))
87 return NULL;
88
89 if (Object__load((Object*)self) == NULL) { return NULL; } // Lazy load
90 if (other && Object__load((Object*)other) == NULL) { return NULL; } // Lazy load
91
92 err = git_patch_from_blobs(&patch, self->blob, old_as_path,
93 other ? other->blob : NULL, new_as_path,
94 &opts);
95 if (err < 0)
96 return Error_set(err);
97
98 return wrap_patch(patch, self, other);
99}
100
101
102PyDoc_STRVAR(Blob_diff_to_buffer__doc__,

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…