gitolite/contrib/adc/trash
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

30 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
. $(dirname $0)/adc.common-functions
# options settable in adc.common-functions are
# TRASH_CAN -- where the trashed repos are moved. Can be anywhere that the
# hosting user has write access to. Does not have to be (and ideally
# should NOT be) inside $GL_REPO_BASE_ABS (but see note below)
# TRASH_SUFFIX -- a timestamp, (ideally and by default), to be
# suffixed to the moved repo
# helper ADCs: list-trash, restore
# NOTE: although I would NOT advise it in the interests of keeping things
# simple, it *is* possible to have even deleted repos be *directly* accessible
# via normal gitolite mechanisms (clone, etc). Here's how:
# (1) make TRASH_CAN point somewhere *within* $REPO_BASE
# (2) change TRASH_SUFFIX to something that has a .git at the end, like:
# TRASH_SUFFIX=`date +%Y-%m-%d-%H-%M-%S`.git
# (3) set ACL rules in conf/gitolite.conf for repos named
# deleted/foo/sitaram/bar.*
# cd to repo base and make sure arg1 is a valid repo (also sets $repo)
valid_owned_repo $1
mkdir -p $TRASH_CAN/$repo 2>/dev/null || die "failed creating directory in trashcan"
[ -d $TRASH_CAN/$repo/$TRASH_SUFFIX ] && die try again in a few seconds
mv $repo.git $TRASH_CAN/$repo/$TRASH_SUFFIX
echo "$repo moved to trashcan. Please run the 'help' adc for more info."