@@ -625,3 +625,28 @@ void test_apply_both__two_deltas_one_new_file(void)
625625
626626 git_diff_free (diff );
627627}
628+
629+ void test_apply_both__rename_and_modify_deltas (void )
630+ {
631+ git_diff * diff ;
632+
633+ struct merge_index_entry both_expected [] = {
634+ { 0100644 , "61c686bed39684eee8a2757ceb1291004a21333f" , 0 , "asdf.txt" },
635+ { 0100644 , "f51658077d85f2264fa179b4d0848268cb3475c3" , 0 , "asparagus.txt" },
636+ { 0100644 , "68f6182f4c85d39e1309d97c7e456156dc9c0096" , 0 , "beef.txt" },
637+ { 0100644 , "4b7c5650008b2e747fe1809eeb5a1dde0e80850a" , 0 , "bouilli.txt" },
638+ { 0100644 , "c4e6cca3ec6ae0148ed231f97257df8c311e015f" , 0 , "gravy.txt" },
639+ { 0100644 , "68af1fc7407fd9addf1701a87eb1c95c7494c598" , 0 , "oyster.txt" },
640+ };
641+ size_t both_expected_cnt = sizeof (both_expected ) /
642+ sizeof (struct merge_index_entry );
643+
644+ cl_git_pass (git_diff_from_buffer (& diff , DIFF_RENAME_AND_MODIFY_DELTAS ,
645+ strlen (DIFF_RENAME_AND_MODIFY_DELTAS )));
646+ cl_git_pass (git_apply (repo , diff , GIT_APPLY_LOCATION_BOTH , NULL ));
647+
648+ validate_apply_index (repo , both_expected , both_expected_cnt );
649+ validate_apply_workdir (repo , both_expected , both_expected_cnt );
650+
651+ git_diff_free (diff );
652+ }
0 commit comments