t-migrate-import: Add a test case for duplicated files

Duplicated files = same name and same content.

This reproduce issue git-lfs/git-lfs#4628
This commit is contained in:
Yoann Congal 2021-09-22 18:31:20 +02:00
parent 1a4431a2e9
commit c459782315
2 changed files with 37 additions and 0 deletions

@ -652,6 +652,28 @@ setup_local_branch_with_dirty_copy() {
printf "2" >> a.txt printf "2" >> a.txt
} }
# setup_local_branch_with_copied_file creates a repository as follows:
#
# A
# \
# refs/heads/main
#
# - Commit 'A' has the contents "a.txt" in a.txt, and anoter identical file
# (same name and content) in another directory.
setup_local_branch_with_copied_file() {
set -e
reponame="migrate-single-local-branch-with-copied-file"
remove_and_create_local_repo "$reponame"
printf "a.txt" > a.txt
mkdir dir
cp a.txt dir/
git add a.txt dir/a.txt
git commit -m "initial commit"
}
# make_bare converts the existing full checkout of a repository into a bare one, # make_bare converts the existing full checkout of a repository into a bare one,
# and then `cd`'s into it. # and then `cd`'s into it.
make_bare() { make_bare() {

@ -1001,3 +1001,18 @@ begin_test "migrate import (non-standard refs)"
assert_local_object "$md_feature_oid" "30" assert_local_object "$md_feature_oid" "30"
) )
end_test end_test
begin_test "migrate import (copied file)"
(
set -e
setup_local_branch_with_copied_file
git lfs migrate import --above=1b
# Expect attributes for "/dir/a" and "/a"
if ! grep -q "^/dir/a.txt" ./.gitattributes || ! grep -q "^/a.txt" ./.gitattributes; then
exit 1
fi
)
end_test