diff --git a/src/Gitolite/Rc.pm b/src/Gitolite/Rc.pm index 1202449..79ec246 100644 --- a/src/Gitolite/Rc.pm +++ b/src/Gitolite/Rc.pm @@ -271,6 +271,7 @@ __DATA__ { 'help' => 1, 'info' => 1, + 'desc' => 1, 'perms' => 1, 'writes' => 1, }, diff --git a/src/commands/desc b/src/commands/desc new file mode 100755 index 0000000..32d0a94 --- /dev/null +++ b/src/commands/desc @@ -0,0 +1,29 @@ +#!/bin/sh + +# Usage: ssh git@host desc +# ssh git@host desc +# +# Show or set description for user-created ("wild") repo. + +die() { echo "$@" >&2; exit 1; } +usage() { perl -lne 'print substr($_, 2) if /^# Usage/../^$/' < $0; exit 1; } +[ -z "$1" ] && usage +[ "$1" = "-h" ] && usage +[ -z "$GL_USER" ] && die GL_USER not set + +# ---------------------------------------------------------------------- +repo=$1; shift + +# this shell script takes arguments that are completely under the user's +# control, so make sure you quote those suckers! + +gitolite creator "$repo" $GL_USER || die You are not authorised +descfile=`gitolite query-rc GL_REPO_BASE`/"$repo".git/description + +if [ -z "$1" ] +then + [ -r $descfile ] && cat $descfile + exit 0 +fi + +echo "$*" > $descfile diff --git a/t/glt b/t/glt index bc8f719..3b3daf8 100755 --- a/t/glt +++ b/t/glt @@ -12,6 +12,7 @@ my $rc; my %extcmds = ( help => 1, info => 1, + desc => 1, perms => 1, writes => 1, );