From 53627f3acaeda392443f8824609c1535f4778c5f Mon Sep 17 00:00:00 2001 From: Rogdham Date: Sun, 16 Nov 2014 13:52:45 +0100 Subject: [PATCH] Error message for repo creation when file exits When a file with the repo name exists in $GITHOME, exit with an error message. --- gitreceive | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gitreceive b/gitreceive index ad451d3..7795c7b 100755 --- a/gitreceive +++ b/gitreceive @@ -81,6 +81,10 @@ parse_repo_from_ssh_command() { ensure_bare_repo() { declare repo_path="$1" if [ ! -d "$repo_path" ]; then + if [ -e "$repo_path" ]; then + echo 'Fatal error: invalid repository name.' > /dev/stderr + exit 1 + fi mkdir -p "$repo_path" cd "$repo_path" git init --bare > /dev/null