From 2920a0604acce011338a7d74c971c1f680824119 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 13 Feb 2024 21:53:01 +0100 Subject: [PATCH] feat: quick and dirty way to toggle tci on repos --- help | 1 + tci | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 tci diff --git a/help b/help index d927420..f1b3487 100755 --- a/help +++ b/help @@ -15,6 +15,7 @@ echo " $ owner [owner] set or unset owner for repository" echo " $ group [group] set or unset group for repository" echo " $ page [page] set or unset homepage for repository" echo " $ pic [href] set or unset picture url for repository" +echo " $ tci [value] set or unset tci.allow for repository" echo " $ update-time force update idle times for all repos" echo " $ show make repository public" echo " $ hide hide public repository" diff --git a/tci b/tci new file mode 100755 index 0000000..69ec94b --- /dev/null +++ b/tci @@ -0,0 +1,30 @@ +#!/bin/bash +if [ $# -eq 0 ]; then + echo "[!] no repository name specified" + exit +fi + +REPOSITORY="$1" # with .git +REPONAME="$1" # without .git + +if [[ ! "$REPOSITORY" == *.git ]]; then + REPOSITORY="$REPOSITORY.git" +fi + +if [[ "$REPONAME" == *.git ]]; then + REPONAME=$(echo "$REPONAME" | sed 's/\.git$//') +fi + +if [ ! -d "/srv/git/$REPOSITORY" ]; then + echo "[!] repository doesn't exist" + exit +fi + +if [ $# -eq 1 ]; then + git config -f "/srv/git/$REPOSITORY/config" --unset tci.allow + echo "[ ] unset tci.allow from $REPONAME" +else + git config -f "/srv/git/$REPOSITORY/config" tci.allow "$2" + echo "[@] set '$2' for 'tci.allow' in $REPONAME" +fi +