Merge branch 'ml/doc-merge-updates' into maint-2.43
[alt-git.git] / t / t9162-git-svn-dcommit-interactive.sh
blobb3ce033a0d3dec9c27b3a5e9114e07f18f20f04d
1 #!/bin/sh
3 # Copyright (c) 2011 Frédéric Heitzmann
5 test_description='git svn dcommit --interactive series'
7 . ./lib-git-svn.sh
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
17 test_expect_success 'answers: y [\n] yes' '
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
24 y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
25 test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn)
29 test_expect_success 'answers: yes yes no' '
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
42 test_expect_success 'answers: yes quit' '
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
54 test_expect_success 'answers: all' '
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
65 test_done