@@ -817,4 +817,85 @@ test_expect_success PERL 'invalid file in delayed checkout' '
817817 grep "error: external filter .* signaled that .unfiltered. is now available although it has not been delayed earlier" git-stderr.log
818818'
819819
820+ for mode in ' case' ' utf-8'
821+ do
822+ case " $mode " in
823+ case) dir=' A' symlink=' a' mode_prereq=' CASE_INSENSITIVE_FS' ;;
824+ utf-8)
825+ dir=$( printf " \141\314\210" ) symlink=$( printf " \303\244" )
826+ mode_prereq=' UTF8_NFD_TO_NFC' ;;
827+ esac
828+
829+ test_expect_success PERL,SYMLINKS,$mode_prereq \
830+ " delayed checkout with $mode -collision don't write to the wrong place" '
831+ test_config_global filter.delay.process \
832+ "\"$TEST_ROOT/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" &&
833+ test_config_global filter.delay.required true &&
834+
835+ git init $mode-collision &&
836+ (
837+ cd $mode-collision &&
838+ mkdir target-dir &&
839+
840+ empty_oid=$(printf "" | git hash-object -w --stdin) &&
841+ symlink_oid=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) &&
842+ attr_oid=$(echo "$dir/z filter=delay" | git hash-object -w --stdin) &&
843+
844+ cat >objs <<-EOF &&
845+ 100644 blob $empty_oid $dir/x
846+ 100644 blob $empty_oid $dir/y
847+ 100644 blob $empty_oid $dir/z
848+ 120000 blob $symlink_oid $symlink
849+ 100644 blob $attr_oid .gitattributes
850+ EOF
851+
852+ git update-index --index-info <objs &&
853+ git commit -m "test commit"
854+ ) &&
855+
856+ git clone $mode-collision $mode-collision-cloned &&
857+ # Make sure z was really delayed
858+ grep "IN: smudge $dir/z .* \\[DELAYED\\]" $mode-collision-cloned/delayed.log &&
859+
860+ # Should not create $dir/z at $symlink/z
861+ test_path_is_missing $mode-collision/target-dir/z
862+ '
863+ done
864+
865+ test_expect_success PERL,SYMLINKS,CASE_INSENSITIVE_FS \
866+ " delayed checkout with submodule collision don't write to the wrong place" '
867+ git init collision-with-submodule &&
868+ (
869+ cd collision-with-submodule &&
870+ git config filter.delay.process "\"$TEST_ROOT/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" &&
871+ git config filter.delay.required true &&
872+
873+ # We need Git to treat the submodule "a" and the
874+ # leading dir "A" as different paths in the index.
875+ git config --local core.ignoreCase false &&
876+
877+ empty_oid=$(printf "" | git hash-object -w --stdin) &&
878+ attr_oid=$(echo "A/B/y filter=delay" | git hash-object -w --stdin) &&
879+ cat >objs <<-EOF &&
880+ 100644 blob $empty_oid A/B/x
881+ 100644 blob $empty_oid A/B/y
882+ 100644 blob $attr_oid .gitattributes
883+ EOF
884+ git update-index --index-info <objs &&
885+
886+ git init a &&
887+ mkdir target-dir &&
888+ symlink_oid=$(printf "%s" "$PWD/target-dir" | git -C a hash-object -w --stdin) &&
889+ echo "120000 blob $symlink_oid b" >objs &&
890+ git -C a update-index --index-info <objs &&
891+ git -C a commit -m sub &&
892+ git submodule add ./a &&
893+ git commit -m super &&
894+
895+ git checkout --recurse-submodules . &&
896+ grep "IN: smudge A/B/y .* \\[DELAYED\\]" delayed.log &&
897+ test_path_is_missing target-dir/y
898+ )
899+ '
900+
820901test_done
0 commit comments