@@ -479,55 +479,55 @@ def _index_from_raw_format(cls, repo, proc):
479479
480480index = DiffIndex ()
481481
482- def handle_diff_line (line ):
483- line = line .decode (defenc )
484- if not line . startswith ( ":" ):
485- return
486-
487- meta , _ , path = line [ 1 :]. partition ('\x00 ' )
488- old_mode ,new_mode ,a_blob_id ,b_blob_id ,_change_type = meta .split (None ,4 )
489- # Change type can be R100
490- # R: status letter
491- # 100: score (in case of copy and rename)
492- change_type = _change_type [0 ]
493- score_str = '' .join (_change_type [1 :])
494- score = int (score_str )if score_str .isdigit ()else None
495- path = path .strip ()
496- a_path = path .encode (defenc )
497- b_path = path .encode (defenc )
498- deleted_file = False
499- new_file = False
500- copied_file = False
501- rename_from = None
502- rename_to = None
503-
504- # NOTE: We cannot conclude from the existence of a blob to change type
505- # as diffs with the working do not have blobs yet
506- if change_type == 'D' :
507- b_blob_id = None
508- deleted_file = True
509- elif change_type == 'A' :
510- a_blob_id = None
511- new_file = True
512- elif change_type == 'C' :
513- copied_file = True
514- a_path ,b_path = path .split ('\x00 ' ,1 )
515- a_path = a_path .encode (defenc )
516- b_path = b_path .encode (defenc )
517- elif change_type == 'R' :
518- a_path ,b_path = path .split ('\x00 ' ,1 )
519- a_path = a_path .encode (defenc )
520- b_path = b_path .encode (defenc )
521- rename_from ,rename_to = a_path ,b_path
522- elif change_type == 'T' :
523- # Nothing to do
524- pass
525- # END add/remove handling
526-
527- diff = Diff (repo ,a_path ,b_path ,a_blob_id ,b_blob_id ,old_mode ,new_mode ,
528- new_file ,deleted_file ,copied_file ,rename_from ,rename_to ,
529- '' ,change_type ,score )
530- index .append (diff )
482+ def handle_diff_line (lines ):
483+ lines = lines .decode (defenc )
484+
485+ for line in lines . split ( ':' )[ 1 :]:
486+ meta , _ , path = line . partition ( ' \x00 ' )
487+ path = path . rstrip ('\x00 ' )
488+ old_mode ,new_mode ,a_blob_id ,b_blob_id ,_change_type = meta .split (None ,4 )
489+ # Change type can be R100
490+ # R: status letter
491+ # 100: score (in case of copy and rename)
492+ change_type = _change_type [0 ]
493+ score_str = '' .join (_change_type [1 :])
494+ score = int (score_str )if score_str .isdigit ()else None
495+ path = path .strip ()
496+ a_path = path .encode (defenc )
497+ b_path = path .encode (defenc )
498+ deleted_file = False
499+ new_file = False
500+ copied_file = False
501+ rename_from = None
502+ rename_to = None
503+
504+ # NOTE: We cannot conclude from the existence of a blob to change type
505+ # as diffs with the working do not have blobs yet
506+ if change_type == 'D' :
507+ b_blob_id = None
508+ deleted_file = True
509+ elif change_type == 'A' :
510+ a_blob_id = None
511+ new_file = True
512+ elif change_type == 'C' :
513+ copied_file = True
514+ a_path ,b_path = path .split ('\x00 ' ,1 )
515+ a_path = a_path .encode (defenc )
516+ b_path = b_path .encode (defenc )
517+ elif change_type == 'R' :
518+ a_path ,b_path = path .split ('\x00 ' ,1 )
519+ a_path = a_path .encode (defenc )
520+ b_path = b_path .encode (defenc )
521+ rename_from ,rename_to = a_path ,b_path
522+ elif change_type == 'T' :
523+ # Nothing to do
524+ pass
525+ # END add/remove handling
526+
527+ diff = Diff (repo ,a_path ,b_path ,a_blob_id ,b_blob_id ,old_mode ,new_mode ,
528+ new_file ,deleted_file ,copied_file ,rename_from ,rename_to ,
529+ '' ,change_type ,score )
530+ index .append (diff )
531531
532532handle_process_output (proc ,handle_diff_line ,None ,finalize_process ,decode_streams = False )
533533