]> git.ipfire.org Git - thirdparty/git.git/blob - t/t9162-git-svn-dcommit-interactive.sh
Merge branch 'wb/fsmonitor-bitmap-fix'
[thirdparty/git.git] / t / t9162-git-svn-dcommit-interactive.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2011 Frédéric Heitzmann
4
5 test_description='git svn dcommit --interactive series'
6 . ./lib-git-svn.sh
7
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
14 '
15
16 test_expect_success 'answers: y [\n] yes' '
17 (
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
22
23 y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
24 test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn)
25 )
26 '
27
28 test_expect_success 'answers: yes yes no' '
29 (
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
38 )
39 '
40
41 test_expect_success 'answers: yes quit' '
42 (
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
50 )
51 '
52
53 test_expect_success 'answers: all' '
54 (
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
61 )
62 '
63
64 test_done