| test_description='test cherry-pick and revert with renames |
| + rename2: renames oops to opos |
| + rename1: renames oops to spoo |
| + added: adds extra line to oops |
| ++ initial: has lines in oops |
| test_expect_success setup ' |
| for l in a b c d e f g h i j k l m n o |
| echo "Add extra line at the end" >>oops && |
| git commit -a -m added && |
| git checkout -b side initial && |
| test_expect_success 'cherry-pick after renaming branch' ' |
| test $(git rev-parse HEAD^) = $(git rev-parse rename2) && |
| grep "Add extra line at the end" opos |
| test_expect_success 'revert after renaming branch' ' |
| test $(git rev-parse HEAD^) = $(git rev-parse rename1) && |
| ! grep "Add extra line at the end" spoo |
| test_expect_success 'revert forbidden on dirty working tree' ' |
| echo content >extra_file && |
| test_must_fail git revert HEAD 2>errors && |
| grep "Dirty index" errors |