From d40ab7a488e0b53b9541652e588b62879bc69bba Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Wed, 22 Jul 2026 10:35:51 +0530 Subject: Refactor git shell commands --- cgit/ssh/git-shell-commands/new | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'cgit/ssh/git-shell-commands/new') diff --git a/cgit/ssh/git-shell-commands/new b/cgit/ssh/git-shell-commands/new index 6b5a03d..4bd550a 100755 --- a/cgit/ssh/git-shell-commands/new +++ b/cgit/ssh/git-shell-commands/new @@ -2,22 +2,12 @@ set -eu +. "$(dirname $0)/_utils/input.sh" + remote_host="git.ediblemonad.dev" owner_info="Akshay Nair " -if [ $# -lt 2 ]; then - echo "Usage: new <...description>" 1>&2 - exit 1 -fi - -repo_name="$1"; shift 1; -[ -z "$repo_name" ] && echo "Error: empty repo name" 1>&2 && exit 1 -(echo "$repo_name" | grep -q "^[A-Za-z0-9_-]\+$" 2>/dev/null) || (echo "Error: invalid repo name" 1>&2 && exit 1) - -# Stupid cmdline parsing means I can't do $1 here for space separated stuff -description="$*" -[ -z "$description" ] && echo "Error: empty description" 1>&2 && exit 1 - +repo_name="$(input_repo_name)"; repo_dir="/git/${repo_name}.git" if [ -d "$repo_dir" ]; then @@ -25,6 +15,8 @@ if [ -d "$repo_dir" ]; then exit 1; fi +description="$(input_repo_description "$repo_dir")" + git --bare init "$repo_dir" cd "$repo_dir" -- cgit v1.3.1