From 98a6b08ff441ec1551d8acb89c2174a340a8837a Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 21 Mar 2012 07:49:13 +0530 Subject: [PATCH] 'desc' command added (manually smoke tested only; no test script) --- src/Gitolite/Rc.pm | 1 + src/commands/desc | 29 +++++++++++++++++++++++++++++ t/glt | 1 + 3 files changed, 31 insertions(+) create mode 100755 src/commands/desc 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, );