Skip to content

Commit 89ee07a

Browse files
committed
repository - diff blobs: consider the values of context_lines and interhunk_lines
1 parent 212cae3 commit 89ee07a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pygit2/repository.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ def diff(
541541

542542
# Case 4: Diff blob to blob
543543
if isinstance(a, Blob) and isinstance(b, Blob):
544-
return a.diff(b)
544+
opt_values.insert(1, '')
545+
opt_values.insert(1, '')
546+
return a.diff(b, *opt_values)
545547

546548
raise ValueError('Only blobs and treeish can be diffed')
547549

src/blob.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ Blob_diff(Blob *self, PyObject *args, PyObject *kwds)
7070
char *old_as_path = NULL, *new_as_path = NULL;
7171
Blob *other = NULL;
7272
int err;
73-
char *keywords[] = {"blob", "flag", "old_as_path", "new_as_path", NULL};
73+
char *keywords[] = {"blob", "flag", "old_as_path", "new_as_path", "context_lines", "interhunk_lines", NULL};
7474

75-
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!Iss", keywords,
75+
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!IssHH", keywords,
7676
&BlobType, &other, &opts.flags,
77-
&old_as_path, &new_as_path))
77+
&old_as_path, &new_as_path,
78+
&opts.context_lines, &opts.interhunk_lines))
7879
return NULL;
7980

8081
if (Object__load((Object*)self) == NULL) { return NULL; } // Lazy load

0 commit comments

Comments
 (0)