gitolite/contrib/adc/rm
Sitaram Chamarty 5b3dcb3757 a slew of adc changes; details below:
- get_rights_and_owner normalises its arg1 by stripping .git if
    supplied, then sets the variable "repo" to the result as a side
    effect
  - new "help" adc with some default text but main purpose is to allow
    site local help text
  - other adc's refer to 'help' adc when appropriate
  - 'undelete' renamed to 'restore'; that's what the KDE "trashcan"
    program calls that operation
  - minor typo in sample script in documentation
  - main adc doc points to contrib/adc/repo-deletion.README now
2010-10-28 16:43:04 +05:30

38 lines
944 B
Bash
Executable file

#!/bin/sh
. $(dirname $0)/adc.common-functions
# options settable in adc.common-functions are
# ARE_YOU_SURE -- prompts "are you sure?"
# USE_LOCK_UNLOCK -- allows delete only if repo is "unlock"ed
# As shipped, both options are set. If you set both of them to "0", repos are
# just deleted blindly, with no confirmation
# helper ADCs: lock, unlock
# cd to repo base and make sure arg1 is a valid repo (also sets $repo)
valid_owned_repo $1
opt $USE_LOCK_UNLOCK && {
if [ -f $repo.git/gl-rm-ok ]
then
:
else
die "$repo is locked! Please run the 'help' adc for more info."
fi
}
opt $ARE_YOU_SURE && {
echo "Are you sure? (type 'yes' if you are)" >&2
read s
[ $s = "yes" ] || die aborting...
}
rm -rf $repo.git
echo "$repo is now GONE!"
cd $HOME
PROJECTS_LIST=$(perl -e 'do ".gitolite.rc"; print $PROJECTS_LIST')
export repo
perl -ni -e 'print unless /^\Q$ENV{repo}.git\E$/' $PROJECTS_LIST