Permalink
Browse files

D: allow rm and unlock to be disabled

  • Loading branch information...
sitaramc committed Dec 19, 2012
1 parent 3513f4a commit b9bbb78278c12d9468d8c50b61ca27e6d6fa0c5b
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/commands/D
View
@@ -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"

0 comments on commit b9bbb78

Please sign in to comment.