diff options
Diffstat (limited to 't/t6022-merge-rename.sh')
-rwxr-xr-x | t/t6022-merge-rename.sh | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh index 9d8584e957..05ebba7afa 100755 --- a/t/t6022-merge-rename.sh +++ b/t/t6022-merge-rename.sh @@ -242,10 +242,10 @@ test_expect_success 'merge of identical changes in a renamed file' ' rm -f A M N && git reset --hard && git checkout change+rename && - GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" && + GIT_MERGE_VERBOSITY=3 git merge change | test_i18ngrep "^Skipped B" && git reset --hard HEAD^ && git checkout change && - GIT_MERGE_VERBOSITY=3 git merge change+rename | grep "^Skipped B" + GIT_MERGE_VERBOSITY=3 git merge change+rename | test_i18ngrep "^Skipped B" ' test_expect_success 'setup for rename + d/f conflicts' ' @@ -259,7 +259,7 @@ test_expect_success 'setup for rename + d/f conflicts' ' printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >sub/file && echo foo >dir/file-in-the-way && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && echo 11 >>sub/file && echo more >>dir/file-in-the-way && @@ -303,9 +303,9 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' ' git checkout -q renamed-file-has-no-conflicts^0 && test_must_fail git merge --strategy=recursive dir-in-way >output && - grep "CONFLICT (modify/delete): dir/file-in-the-way" output && - grep "Auto-merging dir" output && - grep "Adding as dir~HEAD instead" output && + test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output && + test_i18ngrep "Auto-merging dir" output && + test_i18ngrep "Adding as dir~HEAD instead" output && test 3 -eq "$(git ls-files -u | wc -l)" && test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" && @@ -325,9 +325,9 @@ test_expect_success 'Same as previous, but merged other way' ' test_must_fail git merge --strategy=recursive renamed-file-has-no-conflicts >output 2>errors && ! grep "error: refusing to lose untracked file at" errors && - grep "CONFLICT (modify/delete): dir/file-in-the-way" output && - grep "Auto-merging dir" output && - grep "Adding as dir~renamed-file-has-no-conflicts instead" output && + test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output && + test_i18ngrep "Auto-merging dir" output && + test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output && test 3 -eq "$(git ls-files -u | wc -l)" && test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" && @@ -439,7 +439,7 @@ test_expect_success 'setup both rename source and destination involved in D/F co mkdir one && echo stuff >one/file && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && git mv one/file destdir && git commit -m "Renamed to destdir" && @@ -479,7 +479,7 @@ test_expect_success 'setup pair rename to parent of other (D/F conflicts)' ' echo stuff >one/file && echo other >two/file && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && git rm -rf one && git mv two/file one && @@ -539,7 +539,7 @@ test_expect_success 'setup rename of one file to two, with directories in the wa echo stuff >original && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && mkdir two && >two/file && @@ -583,7 +583,7 @@ test_expect_success 'setup rename one file to two; directories moving out of the mkdir one two && touch one/file two/file && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && git rm -rf one && git mv original one && @@ -618,7 +618,7 @@ test_expect_success 'setup avoid unnecessary update, normal rename' ' printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >original && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && git mv original rename && echo 11 >>rename && @@ -649,7 +649,7 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic mkdir df && printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >df/file && git add -A && - git commit -m "Common commmit" && + git commit -m "Common commit" && git mv df/file temp && rm -rf df && @@ -685,7 +685,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' ' git add -A && git commit -mA && - git checkout -b side + git checkout -b side && git rm -rf df && git commit -mB && @@ -716,7 +716,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' ' git add -A && git commit -mA && - git checkout -b side + git checkout -b side && git rm -f file && git commit -m "Delete file" && @@ -745,7 +745,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' ' git add -A && git commit -mA && - git checkout -b side + git checkout -b side && cp file newfile && git add -A && git commit -m "Add file copy" && @@ -884,4 +884,20 @@ test_expect_success 'no spurious "refusing to lose untracked" message' ' ! grep "refusing to lose untracked file" errors.txt ' +test_expect_success 'do not follow renames for empty files' ' + git checkout -f -b empty-base && + >empty1 && + git add empty1 && + git commit -m base && + echo content >empty1 && + git add empty1 && + git commit -m fill && + git checkout -b empty-topic HEAD^ && + git mv empty1 empty2 && + git commit -m rename && + test_must_fail git merge empty-base && + >expect && + test_cmp expect empty2 +' + test_done |