diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-07-05 22:37:01 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-07-05 22:37:01 +0530 |
| commit | 4d5182ad994c3bee390f3c21af4c43fc24428eef (patch) | |
| tree | db4f6a71520c4b948c6a48a6d27d4a4dbe1afbaf /cgit/ssh/git-shell-commands/set-category | |
| parent | c20d74cb5793d5821eadb2f96ac2e8e336e9a94a (diff) | |
| download | bacchus-remote-4d5182ad994c3bee390f3c21af4c43fc24428eef.tar.gz bacchus-remote-4d5182ad994c3bee390f3c21af4c43fc24428eef.zip | |
Add category command and styles
Diffstat (limited to 'cgit/ssh/git-shell-commands/set-category')
| -rwxr-xr-x | cgit/ssh/git-shell-commands/set-category | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cgit/ssh/git-shell-commands/set-category b/cgit/ssh/git-shell-commands/set-category new file mode 100755 index 0000000..7f74b94 --- /dev/null +++ b/cgit/ssh/git-shell-commands/set-category @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +set -eu + +if [ $# -lt 1 ]; then + echo "Usage: set-category <name> [category]" 1>&2 + exit 1 +fi + +repo_name="$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) + +category="${2:-""}"; +repo_dir="/git/${repo_name}.git" + +if ! [ -d "$repo_dir" ]; then + echo "Error: $repo_name doesn't exist" 1>&2 + exit 1; +fi + +if [ -z "$category" ]; then + git -C "$repo_dir" config unset gitweb.category +else + git -C "$repo_dir" config set gitweb.category "$category" +fi + +echo "Done" |
