Sync with 2.36.6
[git/debian.git] / t / t9162-git-svn-dcommit-interactive.sh
blobe2aa8ed88a96ec0b50fb33f31e2e6d232895067c
1 #!/bin/sh
3 # Copyright (c) 2011 Frédéric Heitzmann
5 test_description='git svn dcommit --interactive series'
7 TEST_FAILS_SANITIZE_LEAK=true
8 . ./lib-git-svn.sh
10 test_expect_success 'initialize repo' '
11 svn_cmd mkdir -m"mkdir test-interactive" "$svnrepo/test-interactive" &&
12 git svn clone "$svnrepo/test-interactive" test-interactive &&
13 cd test-interactive &&
14 touch foo && git add foo && git commit -m"foo: first commit" &&
15 git svn dcommit
18 test_expect_success 'answers: y [\n] yes' '
20 echo "change #1" >> foo && git commit -a -m"change #1" &&
21 echo "change #2" >> foo && git commit -a -m"change #2" &&
22 echo "change #3" >> foo && git commit -a -m"change #3" &&
23 ( echo "y
25 y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
26 test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn)
30 test_expect_success 'answers: yes yes no' '
32 echo "change #1" >> foo && git commit -a -m"change #1" &&
33 echo "change #2" >> foo && git commit -a -m"change #2" &&
34 echo "change #3" >> foo && git commit -a -m"change #3" &&
35 ( echo "yes
36 yes
37 no" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
38 test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) &&
39 git reset --hard remotes/git-svn
43 test_expect_success 'answers: yes quit' '
45 echo "change #1" >> foo && git commit -a -m"change #1" &&
46 echo "change #2" >> foo && git commit -a -m"change #2" &&
47 echo "change #3" >> foo && git commit -a -m"change #3" &&
48 ( echo "yes
49 quit" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
50 test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) &&
51 git reset --hard remotes/git-svn
55 test_expect_success 'answers: all' '
57 echo "change #1" >> foo && git commit -a -m"change #1" &&
58 echo "change #2" >> foo && git commit -a -m"change #2" &&
59 echo "change #3" >> foo && git commit -a -m"change #3" &&
60 ( echo "all" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
61 test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) &&
62 git reset --hard remotes/git-svn
66 test_done