From: R. Steve McKown Date: Mon, 22 Sep 2014 17:38:37 +0000 (-0600) Subject: gitcreate: add option to set description X-Git-Tag: 0.9 X-Git-Url: https://oss.titaniummirror.com/gitweb?p=repo_shell.git;a=commitdiff_plain;h=6a2a887a8152432fe2069442a6bcdda881dcbdc6 gitcreate: add option to set description --- diff --git a/README b/README index 746b25d..6eb4764 100644 --- a/README +++ b/README @@ -130,7 +130,7 @@ file as necesssary to allow access to the new repository. gitcreate is a helper script installed by make install. To create a new git repository, simply type: - sudo -u repo gitcreate + sudo -u repo gitcreate ["Short description"] Git repositories may be placed in subdirectories under {git_root}. A subdirectory may be part of . So, for example, if one wishes to @@ -145,6 +145,10 @@ subdirectory paths, add the -y option: sudo -u repo gitcreate -y mirrors/tinyos/tinyos-main.git +If the optional extra argument is provided, it will be used to populate the +description file of the new repository. Because the script takes only one +argument for this purpose, enclose the description in double quotes. + = Configuring user accounts Each user to access repositories via client side tools need an account on the diff --git a/scripts/gitcreate b/scripts/gitcreate index 4dadacd..ecd9f0f 100755 --- a/scripts/gitcreate +++ b/scripts/gitcreate @@ -28,12 +28,13 @@ if [ "$1" = "-y" ]; then shift fi -if [ $# -ne 1 ]; then - echo "usage: $0 " >&2 +if [ $# -lt 1 -o $# -gt 2 ]; then + echo "usage: $0 [\"Short description\"]" >&2 exit 1 fi repopath=$1 +repodesc=$2 if [ -e $git_root/$repopath ]; then echo "$0: repository $repopath already exists" >&2 @@ -64,6 +65,11 @@ umask 027 git --git-dir "$git_root/$repopath" init --bare [ $? -ne 0 ] && exit 1 +# Update the description +if [ -n "$2" ]; then + echo $2 > $git_root/$repopath/description +fi + # Create symbolic links to any hook scripts in $githookspath hooks="pre-receive post-receive update post-update" backdir=$(echo "$repopath/hooks" | sed -e 's|[^/]*|..|g')