aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-06-10 18:51:58 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-06-10 18:51:58 +0200
commitf356ebbc13491a98c397920097494958efb042dd (patch)
tree84b3ae4a7926bca040c2201d103f634bd0d277d5 /tests
parentf11ee7c4354d33c173116aec3179c1b483e3a63e (diff)
downloadblogc-f356ebbc13491a98c397920097494958efb042dd.tar.gz
blogc-f356ebbc13491a98c397920097494958efb042dd.tar.bz2
blogc-f356ebbc13491a98c397920097494958efb042dd.zip
git-receiver: fixed segfault on pre-receive hook
if a [repo:*] section was defined in blogc-git-receiver.ini, but was not providing a symlink value, that would result in a segfault.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/blogc-git-receiver/check_pre_receive.sh.in22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/blogc-git-receiver/check_pre_receive.sh.in b/tests/blogc-git-receiver/check_pre_receive.sh.in
index 2a9aa91..41daaf3 100755
--- a/tests/blogc-git-receiver/check_pre_receive.sh.in
+++ b/tests/blogc-git-receiver/check_pre_receive.sh.in
@@ -94,8 +94,6 @@ cat > "${TEMP}/payload.txt" <<EOF
EOF
cat > "${TEMP}/blogc-git-receiver.ini" <<EOF
-[repo:foo2.git]
-symlink = ${TEMP}/chunda
[repo:foo2a.git]
symlink = ${TEMP}/guda
EOF
@@ -103,6 +101,26 @@ EOF
SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. BLOGC_GIT_RECEIVER_BUILDS_DIR="${TEMP}/foooo" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt"
grep "echo lol" "${TEMP}/output.txt" &> /dev/null
+[[ -h htdocs ]]
+[[ "$(cat htdocs/foo.txt)" == "lol" ]]
+
+cat >> "${TEMP}/blogc-git-receiver.ini" <<EOF
+[repo:foo2.git]
+EOF
+
+SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. BLOGC_GIT_RECEIVER_BUILDS_DIR="${TEMP}/foooo" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt"
+grep "echo lol" "${TEMP}/output.txt" &> /dev/null
+
+[[ -h htdocs ]]
+[[ "$(cat htdocs/foo.txt)" == "lol" ]]
+
+cat >> "${TEMP}/blogc-git-receiver.ini" <<EOF
+symlink = ${TEMP}/chunda
+EOF
+
+SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. BLOGC_GIT_RECEIVER_BUILDS_DIR="${TEMP}/foooo" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt"
+grep "echo lol" "${TEMP}/output.txt" &> /dev/null
+
[[ -h "${TEMP}/chunda" ]]
[[ "$(cat "${TEMP}/chunda/foo.txt")" == "lol" ]]