#!/bin/sh # # Copyright (C) 2012-2013 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. ## Check that "morph tag" works if morphologies are spread across multiple ## repositories. In this case, it should copy all petrified morphologies ## into the branch root repository and only create the tag there. set -eu # Make sure the commits always have the same SHA1s. . "$SRCDIR/scripts/fix-committer-info" # Create the first morphs repository. mkdir "$DATADIR/morphs1" # Create system morphology in first morphs repository. cat < "$DATADIR/morphs1/test-system.morph" name: test-system kind: system arch: $(uname -m) strata: - morph: stratum1 ref: master repo: test:morphs1 - morph: stratum2 ref: master repo: test:morphs2 EOF # Create stratum that depends on another stratum. cat < "$DATADIR/morphs1/stratum1.morph" name: stratum1 kind: stratum build-depends: - morph: stratum3 ref: master repo: test:morphs2 chunks: - build-depends: [] name: hello ref: master repo: test:hello EOF # Commit all files to the first repository. scripts/run-git-in "$DATADIR/morphs1" init -q scripts/run-git-in "$DATADIR/morphs1" add . scripts/run-git-in "$DATADIR/morphs1" commit -q -m initial # Create second morphs repository. mkdir "$DATADIR/morphs2" # Create two strata in the second repository. cat < "$DATADIR/morphs2/stratum2.morph" name: stratum2 kind: stratum build-depends: - morph: stratum3 repo: test:morphs2 ref: master chunks: - build-depends: [] name: hello ref: master repo: test:hello EOF cat < "$DATADIR/morphs2/stratum3.morph" kind: stratum name: stratum3 chunks: - build-depends: [] build-mode: test name: hello ref: master repo: test:hello EOF # Commit all files to the second repository. "$SRCDIR/scripts/run-git-in" "$DATADIR/morphs2" init -q "$SRCDIR/scripts/run-git-in" "$DATADIR/morphs2" add . "$SRCDIR/scripts/run-git-in" "$DATADIR/morphs2" commit -q -m initial cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init # Check out the master system branch. "$SRCDIR/scripts/test-morph" \ checkout test:morphs1 master # Tag the master system branch. "$SRCDIR/scripts/test-morph" \ tag tag-across-multiple-repos -- -m "create tag" # Show the tag. GIT_DIR="$DATADIR/workspace/master/test:morphs1/.git" \ git show tag-across-multiple-repos GIT_DIR="$DATADIR/workspace/master/test:morphs1/.git" \ git log --format=fuller -n1 -p --stat tag-across-multiple-repos