diff options
-rw-r--r-- | src/blogc-git-receiver/pre-receive.c | 2 | ||||
-rwxr-xr-x | tests/blogc-git-receiver/check_pre_receive.sh.in | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c index 9772a2f..c780055 100644 --- a/src/blogc-git-receiver/pre-receive.c +++ b/src/blogc-git-receiver/pre-receive.c @@ -112,7 +112,7 @@ bgr_pre_receive_hook(int argc, char *argv[]) goto cleanup; } - if (isatty(STDIN_FILENO)) { + if (NULL == getenv("GIT_DIR")) { char *htdocs_sym = bc_strdup_printf("%s/htdocs", repo_dir); if (0 != access(htdocs_sym, R_OK)) { fprintf(stderr, "error: no previous build found. nothing to " diff --git a/tests/blogc-git-receiver/check_pre_receive.sh.in b/tests/blogc-git-receiver/check_pre_receive.sh.in index c2f57ac..ba3d78c 100755 --- a/tests/blogc-git-receiver/check_pre_receive.sh.in +++ b/tests/blogc-git-receiver/check_pre_receive.sh.in @@ -28,7 +28,7 @@ EOF cd "${TEMP}/repos/foo.git" -SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" +SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" grep "warning: no reference to master branch found. nothing to deploy." "${TEMP}/output.txt" &> /dev/null cat > "${TEMP}/tmp.txt" <<EOF @@ -58,7 +58,7 @@ cat > "${TEMP}/payload.txt" <<EOF 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 refs/heads/bar EOF -SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" +SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" grep "warning: no makefile found. skipping ..." "${TEMP}/output.txt" &> /dev/null cd "${TEMP}" @@ -93,7 +93,7 @@ cat > "${TEMP}/payload.txt" <<EOF 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 refs/heads/bar EOF -SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" +SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" grep "echo lol" "${TEMP}/output.txt" &> /dev/null [[ -h htdocs ]] @@ -135,7 +135,7 @@ cat > "${TEMP}/payload.txt" <<EOF 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 refs/heads/bar EOF -SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" +SHELL="${SELF}" HOME="${TEMP}" GIT_DIR=. ${TESTS_ENVIRONMENT} ./hooks/pre-receive < "${TEMP}/payload.txt" 2>&1 | tee "${TEMP}/output.txt" grep "echo lol" "${TEMP}/output.txt" &> /dev/null [[ -h htdocs ]] |