diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-13 10:21:23 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-13 10:21:23 +0000 |
commit | f92acb1aa6489468f0fb005f8c9eda4a9c49cf13 (patch) | |
tree | cab67cbe1f9652a769c174887f055699360bcb65 /tests/pushspecs-only.script | |
parent | 8d3e147ce89ad191d91441fbb30a242033c865e1 (diff) | |
download | lorry-f92acb1aa6489468f0fb005f8c9eda4a9c49cf13.tar.gz |
tests: add new test, use same setup
Add a test for only pushing the refs specified. This checks whether
the set of pushed refs is the same as those specified
Also move no-pushspec-pushall.setup to setup_once as both pushspec
tests share the same setup
Diffstat (limited to 'tests/pushspecs-only.script')
-rwxr-xr-x | tests/pushspecs-only.script | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/pushspecs-only.script b/tests/pushspecs-only.script new file mode 100755 index 0000000..1be8fb3 --- /dev/null +++ b/tests/pushspecs-only.script @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Tests that only the specified refs are pushed +# +# Copyright (C) 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +set -e + +git_upstream="$DATADIR"/git-upstream +logfile="$DATADIR"/pushspecs.log +workdir="$DATADIR"/work-dir + +lorryfile="$DATADIR"/pushspecs.lorry +cat >"$lorryfile" <<EOF +{ + "pushspecs": { + "type": "git", + "url": "file://$git_upstream", + "refspecs": [ + "master", + "refs/tags/rc*" + ] + } +} +EOF + +mirror_path="$DATADIR"/git-mirror +mkdir -p "$mirror_path" +git init --quiet --bare "$mirror_path"/pushspecs.git + +./lorry --log="$logfile" --working-area="$workdir" \ + --mirror-base-url-push=file://"$mirror_path" \ + --mirror-base-url-fetch=file://"$mirror_path" \ + "$lorryfile" + +allrefs="$(cd "$mirror_path"/pushspecs.git && git for-each-ref | sort)" +wantedrefs="$(cd "$mirror_path"/pushspecs.git && + git for-each-ref master 'refs/tags/rc*' | sort)" +test "$allrefs" = "$wantedrefs" |