Skip to content

Commit 4ecb793

Browse files
jrnEric Wong
authored andcommitted
t9118 (git-svn): prevent early failure from taking down later tests
When test #2 fails, the cwd is project/, causing all the remaining tests in the same script to get confused and fail. So in the spirit of v1.7.1.1~53^2~10 (t5550-http-fetch: Use subshell for repository operations, 2010-04-17), use a subshell for svn working copy operations. This way, the cwd will reliably return to the top of the trash directory and later tests can still be run when a command has failed. Reported-by: A Large Angry SCM <gitzilla@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
1 parent 08fd28b commit 4ecb793

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

t/t9118-git-svn-funky-branch-names.sh

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,46 @@ test_expect_success 'setup svnrepo' '
3434

3535
test_expect_success 'test clone with funky branch names' '
3636
git svn clone -s "$svnrepo/pr ject" project &&
37-
cd project &&
37+
(
38+
cd project &&
3839
git rev-parse "refs/remotes/fun%20plugin" &&
3940
git rev-parse "refs/remotes/more%20fun%20plugin!" &&
4041
git rev-parse "refs/remotes/$scary_ref" &&
4142
git rev-parse "refs/remotes/%2Eleading_dot" &&
4243
git rev-parse "refs/remotes/trailing_dot%2E" &&
4344
git rev-parse "refs/remotes/trailing_dotlock%2Elock" &&
44-
git rev-parse "refs/remotes/not-a%40{0}reflog" &&
45-
cd ..
45+
git rev-parse "refs/remotes/not-a%40{0}reflog"
46+
)
4647
'
4748

4849
test_expect_success 'test dcommit to funky branch' "
49-
cd project &&
50-
git reset --hard 'refs/remotes/more%20fun%20plugin!' &&
51-
echo hello >> foo &&
52-
git commit -m 'hello' -- foo &&
53-
git svn dcommit &&
54-
cd ..
50+
(
51+
cd project &&
52+
git reset --hard 'refs/remotes/more%20fun%20plugin!' &&
53+
echo hello >> foo &&
54+
git commit -m 'hello' -- foo &&
55+
git svn dcommit
56+
)
5557
"
5658

5759
test_expect_success 'test dcommit to scary branch' '
58-
cd project &&
59-
git reset --hard "refs/remotes/$scary_ref" &&
60-
echo urls are scary >> foo &&
61-
git commit -m "eep" -- foo &&
62-
git svn dcommit &&
63-
cd ..
60+
(
61+
cd project &&
62+
git reset --hard "refs/remotes/$scary_ref" &&
63+
echo urls are scary >> foo &&
64+
git commit -m "eep" -- foo &&
65+
git svn dcommit
66+
)
6467
'
6568

6669
test_expect_success 'test dcommit to trailing_dotlock branch' '
67-
cd project &&
68-
git reset --hard "refs/remotes/trailing_dotlock%2Elock" &&
69-
echo who names branches like this anyway? >> foo &&
70-
git commit -m "bar" -- foo &&
71-
git svn dcommit &&
72-
cd ..
70+
(
71+
cd project &&
72+
git reset --hard "refs/remotes/trailing_dotlock%2Elock" &&
73+
echo who names branches like this anyway? >> foo &&
74+
git commit -m "bar" -- foo &&
75+
git svn dcommit
76+
)
7377
'
7478

7579
stop_httpd

0 commit comments

Comments
 (0)