]> git.ipfire.org Git - thirdparty/git.git/blob - t/t9162-git-svn-dcommit-interactive.sh
Sync with 2.36.3
[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
7 TEST_FAILS_SANITIZE_LEAK=true
8 . ./lib-git-svn.sh
9
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
16 '
17
18 test_expect_success 'answers: y [\n] yes' '
19 (
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
24
25 y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
26 test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn)
27 )
28 '
29
30 test_expect_success 'answers: yes yes no' '
31 (
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
40 )
41 '
42
43 test_expect_success 'answers: yes quit' '
44 (
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
52 )
53 '
54
55 test_expect_success 'answers: all' '
56 (
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
63 )
64 '
65
66 test_done