]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t6022-merge-rename.sh
Merge branch 'jk/test-fail-prereqs-fix'
[thirdparty/git.git] / t / t6022-merge-rename.sh
index 1e34e1f48bb36b7c35fe007ef0129d8a81fac181..bbbba3dcbf0de73a65f0c7258c6b5c5b3278e542 100755 (executable)
@@ -242,12 +242,24 @@ test_expect_success 'merge of identical changes in a renamed file' '
        rm -f A M N &&
        git reset --hard &&
        git checkout change+rename &&
+
+       test-tool chmtime --get -3600 B >old-mtime &&
        GIT_MERGE_VERBOSITY=3 git merge change >out &&
-       test_i18ngrep "^Skipped B" out &&
+
+       test-tool chmtime --get B >new-mtime &&
+       test_cmp old-mtime new-mtime &&
+
        git reset --hard HEAD^ &&
        git checkout change &&
+
+       # A will be renamed to B; we check mtimes and file presence
+       test_path_is_missing B &&
+       test-tool chmtime --get -3600 A >old-mtime &&
        GIT_MERGE_VERBOSITY=3 git merge change+rename >out &&
-       test_i18ngrep ! "^Skipped B" out
+
+       test_path_is_missing A &&
+       test-tool chmtime --get B >new-mtime &&
+       test $(cat old-mtime) -lt $(cat new-mtime)
 '
 
 test_expect_success 'setup for rename + d/f conflicts' '
@@ -295,8 +307,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way'
        git merge --strategy=recursive dir-not-in-way &&
 
        git diff --quiet &&
-       test -f dir &&
-       printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected &&
+       test_path_is_file dir &&
+       test_write_lines 1 2 3 4 5555 6 7 8 9 10 11 >expected &&
        test_cmp expected dir
 '
 
@@ -316,8 +328,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
        test_must_fail git diff --quiet &&
        test_must_fail git diff --cached --quiet &&
 
-       test -f dir/file-in-the-way &&
-       test -f dir~HEAD &&
+       test_path_is_file dir/file-in-the-way &&
+       test_path_is_file dir~HEAD &&
        test_cmp expected dir~HEAD
 '
 
@@ -338,8 +350,8 @@ test_expect_success 'Same as previous, but merged other way' '
        test_must_fail git diff --quiet &&
        test_must_fail git diff --cached --quiet &&
 
-       test -f dir/file-in-the-way &&
-       test -f dir~renamed-file-has-no-conflicts &&
+       test_path_is_file dir/file-in-the-way &&
+       test_path_is_file dir~renamed-file-has-no-conflicts &&
        test_cmp expected dir~renamed-file-has-no-conflicts
 '
 
@@ -355,7 +367,7 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in
        test_must_fail git diff --quiet &&
        test_must_fail git diff --cached --quiet &&
 
-       test -f dir &&
+       test_path_is_file dir &&
        cat >expected <<-\EOF &&
        1
        2
@@ -391,8 +403,8 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
        test_must_fail git diff --quiet &&
        test_must_fail git diff --cached --quiet &&
 
-       test -f dir/file-in-the-way &&
-       test -f dir~HEAD &&
+       test_path_is_file dir/file-in-the-way &&
+       test_path_is_file dir~HEAD &&
        test_cmp expected dir~HEAD
 '
 
@@ -409,8 +421,8 @@ test_expect_success 'Same as previous, but merged other way' '
        test_must_fail git diff --quiet &&
        test_must_fail git diff --cached --quiet &&
 
-       test -f dir/file-in-the-way &&
-       test -f dir~renamed-file-has-conflicts &&
+       test_path_is_file dir/file-in-the-way &&
+       test_path_is_file dir~renamed-file-has-conflicts &&
        cat >expected <<-\EOF &&
        1
        2
@@ -463,9 +475,9 @@ test_expect_success 'both rename source and destination involved in D/F conflict
 
        test_must_fail git diff --quiet &&
 
-       test -f destdir/foo &&
-       test -f one &&
-       test -f destdir~HEAD &&
+       test_path_is_file destdir/foo &&
+       test_path_is_file one &&
+       test_path_is_file destdir~HEAD &&
        test "stuff" = "$(cat destdir~HEAD)"
 '
 
@@ -506,9 +518,9 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked
 
        test 4 -eq $(find . | grep -v .git | wc -l) &&
 
-       test -d one &&
-       test -f one~rename-two &&
-       test -f two &&
+       test_path_is_dir one &&
+       test_path_is_file one~rename-two &&
+       test_path_is_file two &&
        test "other" = $(cat one~rename-two) &&
        test "stuff" = $(cat two)
 '
@@ -526,8 +538,8 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean sta
 
        test 3 -eq $(find . | grep -v .git | wc -l) &&
 
-       test -f one &&
-       test -f two &&
+       test_path_is_file one &&
+       test_path_is_file two &&
        test "other" = $(cat one) &&
        test "stuff" = $(cat two)
 '
@@ -567,11 +579,11 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
        test 1 -eq "$(git ls-files -u original | wc -l)" &&
        test 2 -eq "$(git ls-files -o | wc -l)" &&
 
-       test -f one/file &&
-       test -f two/file &&
-       test -f one~HEAD &&
-       test -f two~second-rename &&
-       ! test -f original
+       test_path_is_file one/file &&
+       test_path_is_file two/file &&
+       test_path_is_file one~HEAD &&
+       test_path_is_file two~second-rename &&
+       test_path_is_missing original
 '
 
 test_expect_success 'setup rename one file to two; directories moving out of the way' '
@@ -606,9 +618,9 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
        test 1 -eq "$(git ls-files -u original | wc -l)" &&
        test 0 -eq "$(git ls-files -o | wc -l)" &&
 
-       test -f one &&
-       test -f two &&
-       ! test -f original
+       test_path_is_file one &&
+       test_path_is_file two &&
+       test_path_is_missing original
 '
 
 test_expect_success 'setup avoid unnecessary update, normal rename' '
@@ -634,7 +646,7 @@ test_expect_success 'setup avoid unnecessary update, normal rename' '
 
 test_expect_success 'avoid unnecessary update, normal rename' '
        git checkout -q avoid-unnecessary-update-1^0 &&
-       test-tool chmtime --get =1000000000 rename >expect &&
+       test-tool chmtime --get -3600 rename >expect &&
        git merge merge-branch-1 &&
        test-tool chmtime --get rename >actual &&
        test_cmp expect actual # "rename" should have stayed intact
@@ -666,7 +678,7 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic
 
 test_expect_success 'avoid unnecessary update, with D/F conflict' '
        git checkout -q avoid-unnecessary-update-2^0 &&
-       test-tool chmtime --get =1000000000 df >expect &&
+       test-tool chmtime --get -3600 df >expect &&
        git merge merge-branch-2 &&
        test-tool chmtime --get df >actual &&
        test_cmp expect actual # "df" should have stayed intact
@@ -697,7 +709,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
 
 test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
        git checkout -q master^0 &&
-       test-tool chmtime --get =1000000000 df >expect &&
+       test-tool chmtime --get -3600 df >expect &&
        git merge side &&
        test-tool chmtime --get df >actual &&
        test_cmp expect actual # "df" should have stayed intact
@@ -726,7 +738,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
 
 test_expect_success 'avoid unnecessary update, modify/delete' '
        git checkout -q master^0 &&
-       test-tool chmtime --get =1000000000 file >expect &&
+       test-tool chmtime --get -3600 file >expect &&
        test_must_fail git merge side &&
        test-tool chmtime --get file >actual &&
        test_cmp expect actual # "file" should have stayed intact
@@ -754,7 +766,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
 
 test_expect_success 'avoid unnecessary update, rename/add-dest' '
        git checkout -q master^0 &&
-       test-tool chmtime --get =1000000000 newfile >expect &&
+       test-tool chmtime --get -3600 newfile >expect &&
        git merge side &&
        test-tool chmtime --get newfile >actual &&
        test_cmp expect actual # "file" should have stayed intact