blob: bac1b2171ee46f2c711dd919744cd297618e43ca [file] [log] [blame]
#!/bin/bash
echo "Content-type: text/html"
REPO=${REQUEST_URI##/new/}
if [[ "${REPO}" != *".git" ]]; then
REPO="${REPO}.git"
fi
STATUS_CODE="500 Internal Server Error"
MESSAGE="Repository could not be created."
git init --bare /var/gerrit/git/${REPO} > /dev/null
if test -f /var/gerrit/git/${REPO}/HEAD; then
STATUS_CODE="201 Created"
MESSAGE="Repository successfully created."
fi
echo "Status: ${STATUS_CODE}"
echo ""
echo "${MESSAGE}"