From 84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sat, 5 Oct 2013 00:56:26 +0200 Subject: Add test instance of the web site Serve https://www.nagios-plugins.org:444/ from the "test" branch of this repository. --- bin/git-export | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'bin/git-export') diff --git a/bin/git-export b/bin/git-export index fc76081..06d832a 100755 --- a/bin/git-export +++ b/bin/git-export @@ -18,23 +18,38 @@ set -u export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' export_prefix='/home/plugins/exported' -export_branch='master' myself=${0##*/} -if [ $# -lt 1 ] -then - echo >&2 "Usage: $myself ..." +usage() +{ + echo >&2 "Usage: $myself [-b ] ..." exit 2 -fi +} + +while getopts b: option +do + case $option in + b) + branch=$OPTARG + ;; + *) + usage + ;; + esac +done + +shift $((OPTIND - 1)) +test $# -ge 1 || usage for repository in "$@" do export_dir="$export_prefix/${repository##*/}" export_dir=${export_dir%.git} + export_dir="$export_dir${branch:+-$branch}" cd "$repository" rm -r -f "$export_dir" mkdir -p "$export_dir" - git archive "$export_branch" | tar -x -C "$export_dir" -f - + git archive "${branch:-master}" | tar -x -C "$export_dir" -f - cd "$OLDPWD" done -- cgit v1.2.3-74-g34f1