2010-10-21 19:06:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. $(dirname $0)/adc.common-functions
|
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
[ -z "$GL_RC" ] && die "ENV GL_RC not set"
|
|
|
|
|
2010-10-21 19:06:15 +02:00
|
|
|
# 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
|
2010-10-27 19:38:58 +02:00
|
|
|
die "$repo is locked! Please run the 'help' adc for more info."
|
2010-10-21 19:06:15 +02:00
|
|
|
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
|
2011-01-15 16:39:56 +01:00
|
|
|
PROJECTS_LIST=$($GL_BINDIR/gl-query-rc PROJECTS_LIST)
|
2010-10-21 19:06:15 +02:00
|
|
|
export repo
|
|
|
|
perl -ni -e 'print unless /^\Q$ENV{repo}.git\E$/' $PROJECTS_LIST
|