| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2011 Frédéric Heitzmann |
| 4 | |
| 5 | test_description='git svn dcommit --interactive series' |
| 6 | |
| 7 | . ./lib-git-svn.sh |
| 8 | |
| 9 | test_expect_success 'initialize repo' ' |
| 10 | svn_cmd mkdir -m"mkdir test-interactive" "$svnrepo/test-interactive" && |
| 11 | git svn clone "$svnrepo/test-interactive" test-interactive && |
| 12 | cd test-interactive && |
| 13 | touch foo && git add foo && git commit -m"foo: first commit" && |
| 14 | git svn dcommit |
| 15 | ' |
| 16 | |
| 17 | test_expect_success 'answers: y [\n] yes' ' |
| 18 | ( |
| 19 | echo "change #1" >> foo && git commit -a -m"change #1" && |
| 20 | echo "change #2" >> foo && git commit -a -m"change #2" && |
| 21 | echo "change #3" >> foo && git commit -a -m"change #3" && |
| 22 | ( echo "y |
| 23 | |
| 24 | y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && |
| 25 | test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) |
| 26 | ) |
| 27 | ' |
| 28 | |
| 29 | test_expect_success 'answers: yes yes no' ' |
| 30 | ( |
| 31 | echo "change #1" >> foo && git commit -a -m"change #1" && |
| 32 | echo "change #2" >> foo && git commit -a -m"change #2" && |
| 33 | echo "change #3" >> foo && git commit -a -m"change #3" && |
| 34 | ( echo "yes |
| 35 | yes |
| 36 | no" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && |
| 37 | test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) && |
| 38 | git reset --hard remotes/git-svn |
| 39 | ) |
| 40 | ' |
| 41 | |
| 42 | test_expect_success 'answers: yes quit' ' |
| 43 | ( |
| 44 | echo "change #1" >> foo && git commit -a -m"change #1" && |
| 45 | echo "change #2" >> foo && git commit -a -m"change #2" && |
| 46 | echo "change #3" >> foo && git commit -a -m"change #3" && |
| 47 | ( echo "yes |
| 48 | quit" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && |
| 49 | test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) && |
| 50 | git reset --hard remotes/git-svn |
| 51 | ) |
| 52 | ' |
| 53 | |
| 54 | test_expect_success 'answers: all' ' |
| 55 | ( |
| 56 | echo "change #1" >> foo && git commit -a -m"change #1" && |
| 57 | echo "change #2" >> foo && git commit -a -m"change #2" && |
| 58 | echo "change #3" >> foo && git commit -a -m"change #3" && |
| 59 | ( echo "all" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && |
| 60 | test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) && |
| 61 | git reset --hard remotes/git-svn |
| 62 | ) |
| 63 | ' |
| 64 | |
| 65 | test_done |