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