diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-08-29 13:06:27 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-08-29 18:49:26 +0100 |
commit | 34c03048cc99e8a8abeb3e3c99574a92a2acb00a (patch) | |
tree | aa6068e4d03fbca208f81d2f73056b3608fab401 /tests.branching/checkout-non-aliased-repos.script | |
parent | 4018afbdb583517277a0f1f7d990fa4c2a04923a (diff) | |
download | morph-34c03048cc99e8a8abeb3e3c99574a92a2acb00a.tar.gz |
Make "morph checkout" require a repository parameter
Instead of hard-coding "baserock:morphs" as the repository we check out
from, we want to allow people to check out from arbitrary repositories
with system and stratum morphologies.
This commit adds a mandatory repository parameter to "morph checkout".
This parameter can either be an aliased repo, e.g. baserock:morphs, or
a full repo URL such as ssh://gitano@git.baserock.org/baserock/morphs.
When cloning the actual repository into a local directory, the following
happens:
For alias repos baserock:morphs and baserock:foo/bar, the repositories
would be cloned into the directories
$workspace/$branch/baserock:morphs
and
$workspace/$branch/baserock:foo/bar.
For repos specified using full URLs, the scheme and .git suffix (if
present) are stripped off. The above ssh example would be cloned into
the following directory:
$workspace/$branch/gitano@git.baserock.org/baserock/morphs
This commit also adjusts all affected tests and adds a new test to
verify that checking out from full repo URLs works as expected.
Diffstat (limited to 'tests.branching/checkout-non-aliased-repos.script')
-rwxr-xr-x | tests.branching/checkout-non-aliased-repos.script | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests.branching/checkout-non-aliased-repos.script b/tests.branching/checkout-non-aliased-repos.script new file mode 100755 index 00000000..6c9ac638 --- /dev/null +++ b/tests.branching/checkout-non-aliased-repos.script @@ -0,0 +1,61 @@ +#!/bin/bash +# 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. + + +# Verify that "morph checkout" works with repos that are not aliased. +# This test in particular verifies that URI schemes are stripped off +# and that the .git suffix is only removed at the end if it is actually +# present. + + +set -eu + + +REPO_WITH_SUFFIX="file://$DATADIR/morphs.git" +REPO_WITHOUT_SUFFIX="file://$DATADIR/morphs" + +TEMP_DIR=$(dirname "$DATADIR") + +cd "$DATADIR/workspace" + +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" checkout "$REPO_WITH_SUFFIX" master + +echo "File tree of repo with suffix:" +"$SRCDIR/scripts/list-tree" . | grep -v '/\.git/' | + sed 's,/cache/gits/file_[^/]*_,/cache/gits/file_,' | + sed "s,${DATADIR:1},DATADIR,g" | + sed "s,${TEMP_DIR:1},TEMP_DIR,g" + +echo "Current branches of repo with suffix:" +"$SRCDIR/scripts/run-git-in" master/"${DATADIR:1}"/morphs branch + +cd "$DATADIR" +rm -rf "$DATADIR/workspace" +mkdir "$DATADIR/workspace" +cd "$DATADIR/workspace" + +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" checkout "$REPO_WITHOUT_SUFFIX" master + +echo "File tree of repo without suffix:" +"$SRCDIR/scripts/list-tree" . | grep -v '/\.git/' | + sed 's,/cache/gits/file_[^/]*_,/cache/gits/file_,' | + sed "s,${DATADIR:1},DATADIR,g" | + sed "s,${TEMP_DIR:1},TEMP_DIR,g" + +echo "Current branches of repo without suffix:" +"$SRCDIR/scripts/run-git-in" master/"${DATADIR:1}"/morphs branch |