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

Function wrap_diff_hunk

src/diff.c:116–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116PyObject *
117wrap_diff_hunk(Patch *patch, size_t idx)
118{
119 DiffHunk *py_hunk;
120 const git_diff_hunk *hunk;
121 size_t lines_in_hunk;
122 int err;
123
124 err = git_patch_get_hunk(&hunk, &lines_in_hunk, patch->patch, idx);
125 if (err < 0)
126 return Error_set(err);
127
128 py_hunk = PyObject_New(DiffHunk, &DiffHunkType);
129 if (py_hunk) {
130 Py_INCREF(patch);
131 py_hunk->patch = patch;
132 py_hunk->hunk = hunk;
133 py_hunk->idx = idx;
134 py_hunk->n_lines = lines_in_hunk;
135 }
136
137 return (PyObject *) py_hunk;
138}
139
140PyObject *
141wrap_diff_stats(git_diff *diff)

Callers 1

Patch_hunks__get__Function · 0.85

Calls 1

Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…