@@ -415,13 +415,14 @@ def _index_from_patch_format(cls, repo, proc):
415
415
text = b'' .join (text )
416
416
index = DiffIndex ()
417
417
previous_header = None
418
- for header in cls .re_header .finditer (text ):
418
+ header = None
419
+ for _header in cls .re_header .finditer (text ):
419
420
a_path_fallback , b_path_fallback , \
420
421
old_mode , new_mode , \
421
422
rename_from , rename_to , \
422
423
new_file_mode , deleted_file_mode , \
423
424
a_blob_id , b_blob_id , b_mode , \
424
- a_path , b_path = header .groups ()
425
+ a_path , b_path = _header .groups ()
425
426
426
427
new_file , deleted_file = bool (new_file_mode ), bool (deleted_file_mode )
427
428
@@ -431,7 +432,7 @@ def _index_from_patch_format(cls, repo, proc):
431
432
# Our only means to find the actual text is to see what has not been matched by our regex,
432
433
# and then retro-actively assign it to our index
433
434
if previous_header is not None :
434
- index [- 1 ].diff = text [previous_header .end ():header .start ()]
435
+ index [- 1 ].diff = text [previous_header .end ():_header .start ()]
435
436
# end assign actual diff
436
437
437
438
# Make sure the mode is set if the path is set. Otherwise the resulting blob is invalid
@@ -450,7 +451,8 @@ def _index_from_patch_format(cls, repo, proc):
450
451
rename_to ,
451
452
None , None , None ))
452
453
453
- previous_header = header
454
+ previous_header = _header
455
+ header = _header
454
456
# end for each header we parse
455
457
if index :
456
458
index [- 1 ].diff = text [header .end ():]
0 commit comments