File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,17 @@ PyTypeObject DiffIterType = {
505
505
PyObject *
506
506
diff_get_delta_byindex (git_diff * diff , size_t idx )
507
507
{
508
+ git_patch * patch = NULL ;
509
+ int err ;
510
+
511
+ /* create a git_patch in order to store delta->flags */
512
+ err = git_patch_from_diff (& patch , diff , idx );
513
+ if (err < 0 ) {
514
+ PyErr_SetObject (PyExc_IndexError , PyLong_FromSize_t (idx ));
515
+ return NULL ;
516
+ }
517
+ git_patch_free (patch );
518
+
508
519
const git_diff_delta * delta = git_diff_get_delta (diff , idx );
509
520
if (delta == NULL ) {
510
521
PyErr_SetObject (PyExc_IndexError , PyLong_FromSize_t (idx ));
Original file line number Diff line number Diff line change @@ -319,9 +319,7 @@ def test_deltas(barerepo):
319
319
assert delta .nfiles == patch_delta .nfiles
320
320
assert delta .old_file .id == patch_delta .old_file .id
321
321
assert delta .new_file .id == patch_delta .new_file .id
322
-
323
- # As explained in the libgit2 documentation, flags are not set
324
- #assert delta.flags == patch_delta.flags
322
+ assert delta .flags == patch_delta .flags
325
323
326
324
def test_diff_parse (barerepo ):
327
325
diff = pygit2 .Diff .parse_diff (PATCH )
You can’t perform that action at this time.
0 commit comments