Skip to content

Commit 857ba70

Browse files
committed
Merge branch 'rj/svn-test'
* rj/svn-test: lib-git-svn.sh: Move web-server handling code into separate function
2 parents 7810c6b + 3aa3047 commit 857ba70

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

t/lib-git-svn.sh

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ svn_cmd () {
6868
svn "$orig_svncmd" --config-dir "$svnconf" "$@"
6969
}
7070

71-
if test -n "$SVN_HTTPD_PORT"
72-
then
71+
prepare_httpd () {
7372
for d in \
7473
"$SVN_HTTPD_PATH" \
7574
/usr/sbin/apache2 \
@@ -83,8 +82,8 @@ then
8382
done
8483
if test -z "$SVN_HTTPD_PATH"
8584
then
86-
skip_all='skipping git svn tests, Apache not found'
87-
test_done
85+
echo >&2 '*** error: Apache not found'
86+
return 1
8887
fi
8988
for d in \
9089
"$SVN_HTTPD_MODULE_PATH" \
@@ -99,23 +98,16 @@ then
9998
done
10099
if test -z "$SVN_HTTPD_MODULE_PATH"
101100
then
102-
skip_all='skipping git svn tests, Apache module dir not found'
103-
test_done
104-
fi
105-
fi
106-
107-
start_httpd () {
108-
repo_base_path="$1"
109-
if test -z "$SVN_HTTPD_PORT"
110-
then
111-
echo >&2 'SVN_HTTPD_PORT is not defined!'
112-
return
101+
echo >&2 '*** error: Apache module dir not found'
102+
return 1
113103
fi
114-
if test -z "$repo_base_path"
104+
if test ! -f "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
115105
then
116-
repo_base_path=svn
106+
echo >&2 '*** error: Apache module "mod_dav_svn" not found'
107+
return 1
117108
fi
118109

110+
repo_base_path="${1-svn}"
119111
mkdir "$GIT_DIR"/logs
120112

121113
cat > "$GIT_DIR/httpd.conf" <<EOF
@@ -132,12 +124,24 @@ LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
132124
SVNPath "$rawsvnrepo"
133125
</Location>
134126
EOF
127+
}
128+
129+
start_httpd () {
130+
if test -z "$SVN_HTTPD_PORT"
131+
then
132+
echo >&2 'SVN_HTTPD_PORT is not defined!'
133+
return
134+
fi
135+
136+
prepare_httpd "$1" || return 1
137+
135138
"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start
136139
svnrepo="http://127.0.0.1:$SVN_HTTPD_PORT/$repo_base_path"
137140
}
138141

139142
stop_httpd () {
140143
test -z "$SVN_HTTPD_PORT" && return
144+
test ! -f "$GIT_DIR/httpd.conf" && return
141145
"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
142146
}
143147

0 commit comments

Comments
 (0)