svn tests: refactor away a "set -e" in test body
Refactor a test added in 83c9433e67 (git-svn: support for git-svn propset, 2014-12-07) to avoid using "set -e" in the test body. Let's move this into a setup test using "test_expect_success" instead. While I'm at it refactor: * Repeated "mkdir" to "mkdir -p" * Uses of "touch" to creating the files with ">" instead * The "rm -rf" at the end to happen in a "test_when_finished" Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Apr 12, 2021 at 13:33 UTC
4f4d2017a370bdee57059d9454d4e1aca0741231
1 file changed
+15
-12
t/t9148-git-svn-propset.sh
+15
-12
@@ -7,19 +7,22 @@ test_description='git svn propset tests'
7
8
. ./lib-git-svn.sh
9
10
-foo_subdir2="subdir/subdir2/foo_subdir2"
10
+test_expect_success 'setup propset via import' '
11
+ test_when_finished "rm -rf import" &&
12
12
-set -e
13
-mkdir import &&
14
-(set -e ; cd import
15
- mkdir subdir
16
- mkdir subdir/subdir2
17
- touch foo # for 'add props top level'
18
- touch subdir/foo_subdir # for 'add props relative'
19
- touch "$foo_subdir2" # for 'add props subdir'
20
- svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
21
-)
22
-rm -rf import
13
+ foo_subdir2="subdir/subdir2/foo_subdir2" &&
14
+ mkdir -p import/subdir/subdir2 &&
15
+ (
16
+ cd import &&
17
+ # for "add props top level"
18
+ >foo &&
19
+ # for "add props relative"
20
+ >subdir/foo_subdir &&
21
+ # for "add props subdir"
22
+ >"$foo_subdir2" &&
23
+ svn_cmd import -m "import for git svn" . "$svnrepo"
24
+ )
25
+'
26
27
test_expect_success 'initialize git svn' '
28
git svn init "$svnrepo"