grm

git repo manager for self-hosted git servers
git clone git://sink.krj.st/grm
Log | Files | Refs | README | LICENSE

commit 33167194c7a640da7f6006d59cd1b9cb32e4b560
parent 0609808d3fbfffc893c5e6bdffb732a6e23f5d2a
Author: krasjet <nil@krj.st>
Date:   Sat, 11 Jul 2020 22:22:43 -0700

abort early when creating repo

Diffstat:
Mgrm | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/grm b/grm @@ -31,6 +31,11 @@ grm_new() { [ -z "$repo_name" ] && \ { echo "no repo name given, exiting..."; exit 1; } + # now we have the complete path of the repo + repo_path="$repos_root/${repo_name}.git" + [ -e "$repo_path" ] && \ + { echo "repository already exists"; exit 1; } + printf "description (%s): " "$default_desc" read -r repo_desc repo_desc=${repo_desc:-$default_desc} @@ -43,12 +48,7 @@ grm_new() { read -r clone_url clone_url=${clone_url:-$url_prefix/$repo_name} - # now we have the complete path of the repo - repo_path="$repos_root/${repo_name}.git" - # first, create an empty directory - [ -e "$repo_path" ] && \ - { echo "repository already exists"; exit 1; } mkdir -p "$repo_path" cd "$repo_path" || exit 1 # stop if directory can't be created