File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -707,4 +707,34 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
707707 ! test -f original
708708'
709709
710+ test_expect_success ' setup avoid unnecessary update, normal rename' '
711+ git reset --hard &&
712+ git checkout --orphan avoid-unnecessary-update-1 &&
713+ git rm -rf . &&
714+ git clean -fdqx &&
715+
716+ printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >original &&
717+ git add -A &&
718+ git commit -m "Common commmit" &&
719+
720+ git mv original rename &&
721+ echo 11 >>rename &&
722+ git add -u &&
723+ git commit -m "Renamed and modified" &&
724+
725+ git checkout -b merge-branch-1 HEAD~1 &&
726+ echo "random content" >random-file &&
727+ git add -A &&
728+ git commit -m "Random, unrelated changes"
729+ '
730+
731+ test_expect_failure ' avoid unnecessary update, normal rename' '
732+ git checkout -q avoid-unnecessary-update-1^0 &&
733+ test-chmtime =1000000000 rename &&
734+ test-chmtime -v +0 rename >expect &&
735+ git merge merge-branch-1 &&
736+ test-chmtime -v +0 rename >actual &&
737+ test_cmp expect actual # "rename" should have stayed intact
738+ '
739+
710740test_done
You can’t perform that action at this time.
0 commit comments