t6423: add more details about direct resolution of directories

Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Oct 26, 2020 at 17:01 UTC 848a856b136c6aaeb2b7944add318485c6c6d6ae
1 file changed +23 -16
t/t6423-merge-rename-directories.sh
+23 -16
@@ -4725,20 +4725,22 @@ test_expect_success '12e: Rename/merge subdir into the root, variant 2' '
4725 # folder/subdir/newsubdir/e_Merge2
4726 # folder/subdir/tweaked/{h,Makefile_SUB_Merge1,newfile.py}
4727 # folder/unchanged/<LOTS OF FILES>
4728 -#
4729 -# Notes: This testcase happens to exercise lots of the
4730 -# optimization-specific codepaths in merge-ort, and also
4731 -# demonstrated a failing of the directory rename detection algorithm
4732 -# in merge-recursive; newfile.c should not get pushed into
4733 -# folder/subdir/newsubdir/, yet merge-recursive put it there because
4734 -# the rename of dir/subdir/{a,b,c,d} -> folder/subdir/{a,b,c,d}
4735 -# looks like
4736 -# dir/ -> folder/,
4737 -# whereas the rename of dir/subdir/e -> folder/subdir/newsubdir/e
4738 -# looks like
4739 -# dir/subdir/ -> folder/subdir/newsubdir/
4740 -# and if we note that newfile.c is found in dir/subdir/, we might
4741 -# overlook the dir/ -> folder/ rule that has more weight.
4728 +# Things being checked here:
4729 +# 1. dir/subdir/newfile.c does not get pushed into folder/subdir/newsubdir/.
4730 +# dir/subdir/{a,b,c,d} -> folder/subdir/{a,b,c,d} looks like
4731 +# dir/ -> folder/,
4732 +# whereas dir/subdir/e -> folder/subdir/newsubdir/e looks like
4733 +# dir/subdir/ -> folder/subdir/newsubdir/
4734 +# and if we note that newfile.c is found in dir/subdir/, we might overlook
4735 +# the dir/ -> folder/ rule that has more weight. Older git versions did
4736 +# this.
4737 +# 2. The code to do trivial directory resolves. Note that
4738 +# dir/subdir/unchanged/ is unchanged and can be deleted, and files in the
4739 +# new folder/subdir/unchanged/ are not needed as a target to any renames.
4740 +# Thus, in the second collect_merge_info_callback() we can just resolve
4741 +# these two directories trivially without recursing.)
4742 +# 3. Exercising the codepaths for caching renames and deletes from one cherry
4743 +# pick and re-applying them in the subsequent one.
4744
4745 test_setup_12f () {
4746 test_create_repo 12f &&
@@ -4803,7 +4805,7 @@ test_expect_merge_algorithm failure success '12f: Trivial directory resolve, cac
4805 git checkout A^0 &&
4806 git branch Bmod B &&
4807
4806 - git -c merge.directoryRenames=true rebase A Bmod &&
4808 + GIT_TRACE2_PERF="$(pwd)/trace.output" git -c merge.directoryRenames=true rebase A Bmod &&
4809
4810 echo Checking the pick of B1... &&
4811
@@ -4884,7 +4886,12 @@ test_expect_merge_algorithm failure success '12f: Trivial directory resolve, cac
4886 test_seq 2 12 >e_Merge2 &&
4887 git hash-object e_Merge2 >expect &&
4888 git rev-parse Bmod:folder/subdir/newsubdir/e >actual &&
4887 - test_cmp expect actual
4889 + test_cmp expect actual &&
4890 +
4891 + grep region_enter.*collect_merge_info trace.output >collect &&
4892 + test_line_count = 4 collect &&
4893 + grep region_enter.*process_entries$ trace.output >process &&
4894 + test_line_count = 2 process
4895 )
4896 '
4897