Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t3503-cherry-pick-root.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t3503-cherry-pick-root.sh` 81 lines ยท 1553 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test cherry-picking (and reverting) a root commit' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 test_expect_success setup ' 11 12 echo first > file1 && 13 git add file1 && 14 test_tick && 15 git commit -m "first" && 16 17 git symbolic-ref HEAD refs/heads/second && 18 rm .git/index file1 && 19 echo second > file2 && 20 git add file2 && 21 test_tick && 22 git commit -m "second" && 23 24 git symbolic-ref HEAD refs/heads/third && 25 rm .git/index file2 && 26 echo third > file3 && 27 git add file3 && 28 test_tick && 29 git commit -m "third" 30 31 ' 32 33 test_expect_success 'cherry-pick a root commit' ' 34 35 git checkout second^0 && 36 git cherry-pick main && 37 echo first >expect && 38 test_cmp expect file1 39 40 ' 41 42 test_expect_success 'revert a root commit' ' 43 44 git revert main && 45 test_path_is_missing file1 46 47 ' 48 49 test_expect_success 'cherry-pick a root commit with an external strategy' ' 50 51 git cherry-pick --strategy=resolve main && 52 echo first >expect && 53 test_cmp expect file1 54 55 ' 56 57 test_expect_success 'revert a root commit with an external strategy' ' 58 59 git revert --strategy=resolve main && 60 test_path_is_missing file1 61 62 ' 63 64 test_expect_success 'cherry-pick two root commits' ' 65 66 echo first >expect.file1 && 67 echo second >expect.file2 && 68 echo third >expect.file3 && 69 70 git checkout second^0 && 71 git cherry-pick main third && 72 73 test_cmp expect.file1 file1 && 74 test_cmp expect.file2 file2 && 75 test_cmp expect.file3 file3 && 76 git rev-parse --verify HEAD^^ && 77 test_must_fail git rev-parse --verify HEAD^^^ 78 79 ' 80 81 test_done