auto add .git suffix, deny name with a slash

This commit is contained in:
Gitea 2022-04-02 09:45:40 +00:00
parent 99e2c68589
commit 960caab149

19
newrepo
View file

@ -1,4 +1,15 @@
#!/bin/sh
mkdir -p ~/$1
cd ~/$1
git init --bare
#!/bin/bash
repo_name="$1"
if [[ $repo_name =~ ^.*/$ ]] ; then
echo "Failed to create new repository."
echo "Don't place a slash after repository's name"
exit 1
fi
if [[ ! $repo_name =~ ^.*\.git$ ]] ; then
repo_name="${repo_name}.git"
fi
git init --bare ${repo_name}