From 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 26 May 2020 00:06:52 +0100 Subject: revert(3p/git): Revert merge of git upstream at v2.26.2 This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3. --- third_party/git/t/t6022-merge-rename.sh | 393 ++++++++++++++++---------------- 1 file changed, 191 insertions(+), 202 deletions(-) (limited to 'third_party/git/t/t6022-merge-rename.sh') diff --git a/third_party/git/t/t6022-merge-rename.sh b/third_party/git/t/t6022-merge-rename.sh index bbbba3dcbf0d..53cc9b2ffbdb 100755 --- a/third_party/git/t/t6022-merge-rename.sh +++ b/third_party/git/t/t6022-merge-rename.sh @@ -8,94 +8,94 @@ modify () { mv "$2.x" "$2" } -test_expect_success 'setup' ' - cat >A <<-\EOF && - a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - c cccccccccccccccccccccccccccccccccccccccccccccccc - d dddddddddddddddddddddddddddddddddddddddddddddddd - e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - f ffffffffffffffffffffffffffffffffffffffffffffffff - g gggggggggggggggggggggggggggggggggggggggggggggggg - h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh - i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii - j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj - k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk - l llllllllllllllllllllllllllllllllllllllllllllllll - m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - o oooooooooooooooooooooooooooooooooooooooooooooooo - EOF - - cat >M <<-\EOF && - A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB - C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC - D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD - E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE - F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG - H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH - I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII - J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ - K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK - L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL - M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM - N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN - O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO - EOF - - git add A M && - git commit -m "initial has A and M" && - git branch white && - git branch red && - git branch blue && - git branch yellow && - git branch change && - git branch change+rename && - - sed -e "/^g /s/.*/g : master changes a line/" A+ && - mv A+ A && - git commit -a -m "master updates A" && - - git checkout yellow && - rm -f M && - git commit -a -m "yellow removes M" && - - git checkout white && - sed -e "/^g /s/.*/g : white changes a line/" B && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A B M N && - git commit -m "white renames A->B, M->N" && - - git checkout red && - sed -e "/^g /s/.*/g : red changes a line/" B && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A B M N && - git commit -m "red renames A->B, M->N" && - - git checkout blue && - sed -e "/^g /s/.*/g : blue changes a line/" C && - sed -e "/^G /s/.*/G : colored branch changes a line/" N && - rm -f A M && - git update-index --add --remove A C M N && - git commit -m "blue renames A->C, M->N" && - - git checkout change && - sed -e "/^g /s/.*/g : changed line/" A+ && - mv A+ A && - git commit -q -a -m "changed" && - - git checkout change+rename && - sed -e "/^g /s/.*/g : changed line/" B && - rm A && - git update-index --add B && - git commit -q -a -m "changed and renamed" && - - git checkout master -' +test_expect_success setup \ +' +cat >A <<\EOF && +a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +c cccccccccccccccccccccccccccccccccccccccccccccccc +d dddddddddddddddddddddddddddddddddddddddddddddddd +e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +f ffffffffffffffffffffffffffffffffffffffffffffffff +g gggggggggggggggggggggggggggggggggggggggggggggggg +h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh +i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii +j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj +k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk +l llllllllllllllllllllllllllllllllllllllllllllllll +m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm +n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +o oooooooooooooooooooooooooooooooooooooooooooooooo +EOF + +cat >M <<\EOF && +A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG +H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH +I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII +J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ +K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK +L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL +M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN +O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO +EOF + +git add A M && +git commit -m "initial has A and M" && +git branch white && +git branch red && +git branch blue && +git branch yellow && +git branch change && +git branch change+rename && + +sed -e "/^g /s/.*/g : master changes a line/" A+ && +mv A+ A && +git commit -a -m "master updates A" && + +git checkout yellow && +rm -f M && +git commit -a -m "yellow removes M" && + +git checkout white && +sed -e "/^g /s/.*/g : white changes a line/" B && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A B M N && +git commit -m "white renames A->B, M->N" && + +git checkout red && +sed -e "/^g /s/.*/g : red changes a line/" B && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A B M N && +git commit -m "red renames A->B, M->N" && + +git checkout blue && +sed -e "/^g /s/.*/g : blue changes a line/" C && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A C M N && +git commit -m "blue renames A->C, M->N" && + +git checkout change && +sed -e "/^g /s/.*/g : changed line/" A+ && +mv A+ A && +git commit -q -a -m "changed" && + +git checkout change+rename && +sed -e "/^g /s/.*/g : changed line/" B && +rm A && +git update-index --add B && +git commit -q -a -m "changed and renamed" && + +git checkout master' test_expect_success 'pull renaming branch into unrenaming one' \ ' @@ -242,24 +242,12 @@ 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-tool chmtime --get B >new-mtime && - test_cmp old-mtime new-mtime && - + test_i18ngrep "^Skipped B" out && 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_path_is_missing A && - test-tool chmtime --get B >new-mtime && - test $(cat old-mtime) -lt $(cat new-mtime) + test_i18ngrep ! "^Skipped B" out ' test_expect_success 'setup for rename + d/f conflicts' ' @@ -300,15 +288,14 @@ test_expect_success 'setup for rename + d/f conflicts' ' git commit -m "Conflicting change" ' +printf "1\n2\n3\n4\n5555\n6\n7\n8\n9\n10\n11\n" >expected + test_expect_success 'Rename+D/F conflict; renamed file merges + dir not in way' ' git reset --hard && git checkout -q renamed-file-has-no-conflicts^0 && - git merge --strategy=recursive dir-not-in-way && - git diff --quiet && - test_path_is_file dir && - test_write_lines 1 2 3 4 5555 6 7 8 9 10 11 >expected && + test -f dir && test_cmp expected dir ' @@ -328,8 +315,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_path_is_file dir/file-in-the-way && - test_path_is_file dir~HEAD && + test -f dir/file-in-the-way && + test -f dir~HEAD && test_cmp expected dir~HEAD ' @@ -350,11 +337,29 @@ test_expect_success 'Same as previous, but merged other way' ' test_must_fail git diff --quiet && test_must_fail git diff --cached --quiet && - test_path_is_file dir/file-in-the-way && - test_path_is_file dir~renamed-file-has-no-conflicts && + test -f dir/file-in-the-way && + test -f dir~renamed-file-has-no-conflicts && test_cmp expected dir~renamed-file-has-no-conflicts ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +<<<<<<< HEAD:dir +12 +======= +11 +>>>>>>> dir-not-in-way:sub/file +EOF + test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in way' ' git reset --hard && rm -rf dir~* && @@ -367,24 +372,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_path_is_file dir && - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - <<<<<<< HEAD:dir - 12 - ======= - 11 - >>>>>>> dir-not-in-way:sub/file - EOF + test -f dir && test_cmp expected dir ' @@ -403,11 +391,29 @@ 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_path_is_file dir/file-in-the-way && - test_path_is_file dir~HEAD && + test -f dir/file-in-the-way && + test -f dir~HEAD && test_cmp expected dir~HEAD ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +<<<<<<< HEAD:sub/file +11 +======= +12 +>>>>>>> renamed-file-has-conflicts:dir +EOF + test_expect_success 'Same as previous, but merged other way' ' git reset --hard && rm -rf dir~* && @@ -421,25 +427,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_path_is_file dir/file-in-the-way && - test_path_is_file dir~renamed-file-has-conflicts && - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - <<<<<<< HEAD:sub/file - 11 - ======= - 12 - >>>>>>> renamed-file-has-conflicts:dir - EOF + test -f dir/file-in-the-way && + test -f dir~renamed-file-has-conflicts && test_cmp expected dir~renamed-file-has-conflicts ' @@ -475,9 +464,9 @@ test_expect_success 'both rename source and destination involved in D/F conflict test_must_fail git diff --quiet && - test_path_is_file destdir/foo && - test_path_is_file one && - test_path_is_file destdir~HEAD && + test -f destdir/foo && + test -f one && + test -f destdir~HEAD && test "stuff" = "$(cat destdir~HEAD)" ' @@ -518,9 +507,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_path_is_dir one && - test_path_is_file one~rename-two && - test_path_is_file two && + test -d one && + test -f one~rename-two && + test -f two && test "other" = $(cat one~rename-two) && test "stuff" = $(cat two) ' @@ -538,8 +527,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_path_is_file one && - test_path_is_file two && + test -f one && + test -f two && test "other" = $(cat one) && test "stuff" = $(cat two) ' @@ -579,11 +568,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_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 -f one/file && + test -f two/file && + test -f one~HEAD && + test -f two~second-rename && + ! test -f original ' test_expect_success 'setup rename one file to two; directories moving out of the way' ' @@ -618,9 +607,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_path_is_file one && - test_path_is_file two && - test_path_is_missing original + test -f one && + test -f two && + ! test -f original ' test_expect_success 'setup avoid unnecessary update, normal rename' ' @@ -646,7 +635,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 -3600 rename >expect && + test-tool chmtime --get =1000000000 rename >expect && git merge merge-branch-1 && test-tool chmtime --get rename >actual && test_cmp expect actual # "rename" should have stayed intact @@ -678,7 +667,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 -3600 df >expect && + test-tool chmtime --get =1000000000 df >expect && git merge merge-branch-2 && test-tool chmtime --get df >actual && test_cmp expect actual # "df" should have stayed intact @@ -709,7 +698,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 -3600 df >expect && + test-tool chmtime --get =1000000000 df >expect && git merge side && test-tool chmtime --get df >actual && test_cmp expect actual # "df" should have stayed intact @@ -738,7 +727,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 -3600 file >expect && + test-tool chmtime --get =1000000000 file >expect && test_must_fail git merge side && test-tool chmtime --get file >actual && test_cmp expect actual # "file" should have stayed intact @@ -766,7 +755,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 -3600 newfile >expect && + test-tool chmtime --get =1000000000 newfile >expect && git merge side && test-tool chmtime --get newfile >actual && test_cmp expect actual # "file" should have stayed intact @@ -821,48 +810,48 @@ test_expect_success 'setup for use of extended merge markers' ' git commit -mC ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +<<<<<<< HEAD:renamed_file +9 +======= +8.5 +>>>>>>> master^0:original_file +EOF + test_expect_success 'merge master into rename has correct extended markers' ' git checkout rename^0 && test_must_fail git merge -s recursive master^0 && - - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - <<<<<<< HEAD:renamed_file - 9 - ======= - 8.5 - >>>>>>> master^0:original_file - EOF test_cmp expected renamed_file ' +cat >expected <<\EOF && +1 +2 +3 +4 +5 +6 +7 +8 +<<<<<<< HEAD:original_file +8.5 +======= +9 +>>>>>>> rename^0:renamed_file +EOF + test_expect_success 'merge rename into master has correct extended markers' ' git reset --hard && git checkout master^0 && test_must_fail git merge -s recursive rename^0 && - - cat >expected <<-\EOF && - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - <<<<<<< HEAD:original_file - 8.5 - ======= - 9 - >>>>>>> rename^0:renamed_file - EOF test_cmp expected renamed_file ' -- cgit 1.4.1