ref-filter: rename the 'strip' option to 'lstrip'
[gitweb.git] / t / t6022-merge-rename.sh
index c2993fcafec657a63ccbc46c2b07f9bd57c2d652..05ebba7afa29977196370d178af728ec1d0d9a81 100755 (executable)
@@ -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 &&
 
@@ -696,7 +696,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
        git commit -m "Add a newfile"
 '
 
-test_expect_failure 'avoid unnecessary update, dir->(file,nothing)' '
+test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
        git checkout -q master^0 &&
        test-chmtime =1000000000 df &&
        test-chmtime -v +0 df >expect &&
@@ -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" &&
 
@@ -726,7 +726,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
        git commit -m "Modify file"
 '
 
-test_expect_failure 'avoid unnecessary update, modify/delete' '
+test_expect_success 'avoid unnecessary update, modify/delete' '
        git checkout -q master^0 &&
        test-chmtime =1000000000 file &&
        test-chmtime -v +0 file >expect &&
@@ -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" &&
@@ -755,7 +755,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
        git commit -m "Rename file"
 '
 
-test_expect_failure 'avoid unnecessary update, rename/add-dest' '
+test_expect_success 'avoid unnecessary update, rename/add-dest' '
        git checkout -q master^0 &&
        test-chmtime =1000000000 newfile &&
        test-chmtime -v +0 newfile >expect &&
@@ -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