From b9bbb78278c12d9468d8c50b61ca27e6d6fa0c5b Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 19 Dec 2012 07:17:09 +0530 Subject: [PATCH] D: allow rm and unlock to be disabled --- src/commands/D | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/commands/D b/src/commands/D index a255073..1a8c2b5 100755 --- a/src/commands/D +++ b/src/commands/D @@ -12,6 +12,9 @@ # - run a cron job to delete old repos based on age (the TRASH_SUFFIX has a # timestamp); your choice how/how often you do that + +# - you can completely disable the 'rm' command by setting an rc variable +# called D_DISABLE_RM to "1". # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- @@ -67,6 +70,8 @@ owner_or_die() { if [ "$cmd" = "rm" ] then + gitolite query-rc -q D_DISABLE_RM && die "sorry, 'unlock' and 'rm' are disabled" + owner_or_die [ -f $repo.git/gl-rm-ok ] || die "'$repo' is locked!" rm -rf $repo.git @@ -82,6 +87,8 @@ then elif [ "$cmd" = "unlock" ] then + gitolite query-rc -q D_DISABLE_RM && die "sorry, 'unlock' and 'rm' are disabled" + owner_or_die touch $repo.git/gl-rm-ok echo "'$repo' is now unlocked"