From 0e38d3acd98b6cf472f60cea735af8a100a3f5b0 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 11 Oct 2016 22:13:05 +0200 Subject: tests: git-receiver: avoid removing directories for safety --- tests/blogc-git-receiver/check_pre_receive.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tests/blogc-git-receiver/check_pre_receive.sh') diff --git a/tests/blogc-git-receiver/check_pre_receive.sh b/tests/blogc-git-receiver/check_pre_receive.sh index dc2066f..7ef7f0e 100755 --- a/tests/blogc-git-receiver/check_pre_receive.sh +++ b/tests/blogc-git-receiver/check_pre_receive.sh @@ -9,7 +9,7 @@ TEMP="$(mktemp -d)" trap_func() { [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" - rm -rf "${TEMP}" + [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" } trap trap_func EXIT @@ -62,9 +62,8 @@ SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEM grep "warning: no makefile found. skipping ..." "${TEMP}/output.txt" &> /dev/null cd "${TEMP}" -rm -rf "${TEMP}/repos/foo.git" -git init --bare "${TEMP}/repos/foo.git" &> /dev/null -ln -s "${SELF}" "${TEMP}/repos/foo.git/hooks/pre-receive" +git init --bare "${TEMP}/repos/foo2.git" &> /dev/null +ln -s "${SELF}" "${TEMP}/repos/foo2.git/hooks/pre-receive" cat > "${TEMP}/tmp.txt" < /dev/null cat > "${TEMP}/payload.txt" < /dev/null -ln -s "${SELF}" "${TEMP}/repos/foo.git/hooks/pre-receive" +git init --bare "${TEMP}/repos/foo3.git" &> /dev/null +ln -s "${SELF}" "${TEMP}/repos/foo3.git/hooks/pre-receive" cat > "${TEMP}/tmp.txt" < /dev/null -- cgit v1.2.3-18-g5258