@@ -697,4 +697,71 @@ test_expect_success 'caching renames only on upstream side, part 2' '
697
697
)
698
698
'
699
699
700
+ #
701
+ # The following testcase just creates two simple renames (slightly modified
702
+ # on both sides but without conflicting changes), and a directory full of
703
+ # files that are otherwise uninteresting. The setup is as follows:
704
+ #
705
+ # base: unrelated/<BUNCH OF FILES>
706
+ # numbers
707
+ # values
708
+ # upstream: modify: numbers
709
+ # modify: values
710
+ # topic: add: unrelated/foo
711
+ # modify: numbers
712
+ # modify: values
713
+ # rename: numbers -> sequence
714
+ # rename: values -> progression
715
+ #
716
+ # This is a trivial rename case, but we're curious what happens with a very
717
+ # low renameLimit interacting with the restart optimization trying to notice
718
+ # that unrelated/ looks like a trivial merge candidate.
719
+ #
720
+ test_expect_success ' avoid assuming we detected renames' '
721
+ git init redo-weirdness &&
722
+ (
723
+ cd redo-weirdness &&
724
+
725
+ mkdir unrelated &&
726
+ for i in $(test_seq 1 10)
727
+ do
728
+ >unrelated/$i
729
+ done &&
730
+ test_seq 2 10 >numbers &&
731
+ test_seq 12 20 >values &&
732
+ git add numbers values unrelated/ &&
733
+ git commit -m orig &&
734
+
735
+ git branch upstream &&
736
+ git branch topic &&
737
+
738
+ git switch upstream &&
739
+ test_seq 1 10 >numbers &&
740
+ test_seq 11 20 >values &&
741
+ git add numbers &&
742
+ git commit -m "Some tweaks" &&
743
+
744
+ git switch topic &&
745
+
746
+ >unrelated/foo &&
747
+ test_seq 2 12 >numbers &&
748
+ test_seq 12 22 >values &&
749
+ git add numbers values unrelated/ &&
750
+ git mv numbers sequence &&
751
+ git mv values progression &&
752
+ git commit -m A &&
753
+
754
+ #
755
+ # Actual testing
756
+ #
757
+
758
+ git switch --detach topic^0 &&
759
+
760
+ test_must_fail git -c merge.renameLimit=1 rebase upstream &&
761
+
762
+ git ls-files -u >actual &&
763
+ ! test_file_is_empty actual
764
+ )
765
+ '
766
+
700
767
test_done
0 commit comments