From eca86870bf10c064a9f561249491f03c6e750a86 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 5 Jul 2026 10:52:25 +0530 Subject: Add fork/set-description git commands + optimizations --- cgit/ssh/git-shell-commands/set-description | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 cgit/ssh/git-shell-commands/set-description (limited to 'cgit/ssh/git-shell-commands/set-description') diff --git a/cgit/ssh/git-shell-commands/set-description b/cgit/ssh/git-shell-commands/set-description new file mode 100755 index 0000000..a120fa0 --- /dev/null +++ b/cgit/ssh/git-shell-commands/set-description @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +set -eu + +if [ $# -lt 2 ]; then + echo "Usage: set-description <...description>" 1>&2 + exit 1 +fi + +repo_name="$1"; shift 1; +[ -z "$repo_name" ] && echo "Error: empty repo name" 1>&2 && exit 1 + +description="$*"; +[ -z "$description" ] && echo "Error: empty description" 1>&2 && exit 1 + +repo_dir="/git/${repo_name}.git" + +if ! [ -d "$repo_dir" ]; then + echo "Error: $repo_name doesn't exist" 1>&2 + exit 1; +fi + +echo "$description" > "${repo_dir}/description" + +echo "Done" -- cgit v1.3.1