diff options
Diffstat (limited to '')
| -rwxr-xr-x | cgit/ssh/git-shell-commands/set-description | 25 |
1 files changed, 25 insertions, 0 deletions
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 <name> <...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" |
