]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t0021-conversion.sh
Sync with 2.26.3
[thirdparty/git.git] / t / t0021-conversion.sh
index 4bfffa9c314bf8236c9c7d74fca166ed86d5952a..38cd6bc5f73f7d525811dc8598684e6116e57853 100755 (executable)
@@ -957,4 +957,85 @@ test_expect_success PERL 'invalid file in delayed checkout' '
        grep "error: external filter .* signaled that .unfiltered. is now available although it has not been delayed earlier" git-stderr.log
 '
 
+for mode in 'case' 'utf-8'
+do
+       case "$mode" in
+       case)   dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;;
+       utf-8)
+               dir=$(printf "\141\314\210") symlink=$(printf "\303\244")
+               mode_prereq='UTF8_NFD_TO_NFC' ;;
+       esac
+
+       test_expect_success PERL,SYMLINKS,$mode_prereq \
+       "delayed checkout with $mode-collision don't write to the wrong place" '
+               test_config_global filter.delay.process \
+                       "\"$TEST_ROOT/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" &&
+               test_config_global filter.delay.required true &&
+
+               git init $mode-collision &&
+               (
+                       cd $mode-collision &&
+                       mkdir target-dir &&
+
+                       empty_oid=$(printf "" | git hash-object -w --stdin) &&
+                       symlink_oid=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) &&
+                       attr_oid=$(echo "$dir/z filter=delay" | git hash-object -w --stdin) &&
+
+                       cat >objs <<-EOF &&
+                       100644 blob $empty_oid  $dir/x
+                       100644 blob $empty_oid  $dir/y
+                       100644 blob $empty_oid  $dir/z
+                       120000 blob $symlink_oid        $symlink
+                       100644 blob $attr_oid   .gitattributes
+                       EOF
+
+                       git update-index --index-info <objs &&
+                       git commit -m "test commit"
+               ) &&
+
+               git clone $mode-collision $mode-collision-cloned &&
+               # Make sure z was really delayed
+               grep "IN: smudge $dir/z .* \\[DELAYED\\]" $mode-collision-cloned/delayed.log &&
+
+               # Should not create $dir/z at $symlink/z
+               test_path_is_missing $mode-collision/target-dir/z
+       '
+done
+
+test_expect_success PERL,SYMLINKS,CASE_INSENSITIVE_FS \
+"delayed checkout with submodule collision don't write to the wrong place" '
+       git init collision-with-submodule &&
+       (
+               cd collision-with-submodule &&
+               git config filter.delay.process "\"$TEST_ROOT/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" &&
+               git config filter.delay.required true &&
+
+               # We need Git to treat the submodule "a" and the
+               # leading dir "A" as different paths in the index.
+               git config --local core.ignoreCase false &&
+
+               empty_oid=$(printf "" | git hash-object -w --stdin) &&
+               attr_oid=$(echo "A/B/y filter=delay" | git hash-object -w --stdin) &&
+               cat >objs <<-EOF &&
+               100644 blob $empty_oid  A/B/x
+               100644 blob $empty_oid  A/B/y
+               100644 blob $attr_oid   .gitattributes
+               EOF
+               git update-index --index-info <objs &&
+
+               git init a &&
+               mkdir target-dir &&
+               symlink_oid=$(printf "%s" "$PWD/target-dir" | git -C a hash-object -w --stdin) &&
+               echo "120000 blob $symlink_oid  b" >objs &&
+               git -C a update-index --index-info <objs &&
+               git -C a commit -m sub &&
+               git submodule add ./a &&
+               git commit -m super &&
+
+               git checkout --recurse-submodules . &&
+               grep "IN: smudge A/B/y .* \\[DELAYED\\]" delayed.log &&
+               test_path_is_missing target-dir/y
+       )
+'
+
 test_done