diff options
Diffstat (limited to 'tests.branching')
-rwxr-xr-x | tests.branching/checkout-existing-branch.script | 6 | ||||
-rw-r--r-- | tests.branching/checkout-existing-branch.stdout | 8 | ||||
-rwxr-xr-x | tests.branching/checkout-non-aliased-repos.script | 61 | ||||
-rw-r--r-- | tests.branching/checkout-non-aliased-repos.stdout | 36 | ||||
-rwxr-xr-x | tests.branching/edit-checkouts-existing-chunk.script | 6 | ||||
-rwxr-xr-x | tests.branching/petrify.script | 4 | ||||
-rwxr-xr-x | tests.branching/setup | 3 | ||||
-rwxr-xr-x | tests.branching/workflow.script | 4 |
8 files changed, 114 insertions, 14 deletions
diff --git a/tests.branching/checkout-existing-branch.script b/tests.branching/checkout-existing-branch.script index 643a3a5e..e7e3a379 100755 --- a/tests.branching/checkout-existing-branch.script +++ b/tests.branching/checkout-existing-branch.script @@ -15,7 +15,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# Verify that "morph checkout master" works. +# Verify that "morph checkout baserock:morphs master" works. set -eu @@ -23,11 +23,11 @@ set -eu cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout master +"$SRCDIR/scripts/test-morph" checkout baserock:morphs master echo "File tree:" "$SRCDIR/scripts/list-tree" . | grep -v '/\.git/' | sed 's,/cache/gits/file_[^/]*_,/cache/gits/file_,' echo "Current branches:" -"$SRCDIR/scripts/run-git-in" master/morphs branch +"$SRCDIR/scripts/run-git-in" master/baserock:morphs branch diff --git a/tests.branching/checkout-existing-branch.stdout b/tests.branching/checkout-existing-branch.stdout index 47043bbe..7ac4a149 100644 --- a/tests.branching/checkout-existing-branch.stdout +++ b/tests.branching/checkout-existing-branch.stdout @@ -7,9 +7,9 @@ d ./.morph/cache/gits/file_morphs d ./.morph/cache/gits/file_morphs/.git d ./master d ./master/.morph-system-branch -d ./master/morphs -d ./master/morphs/.git -f ./master/morphs/hello-stratum.morph -f ./master/morphs/hello-system.morph +d ./master/baserock:morphs +d ./master/baserock:morphs/.git +f ./master/baserock:morphs/hello-stratum.morph +f ./master/baserock:morphs/hello-system.morph Current branches: * master 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 diff --git a/tests.branching/checkout-non-aliased-repos.stdout b/tests.branching/checkout-non-aliased-repos.stdout new file mode 100644 index 00000000..75dcd63d --- /dev/null +++ b/tests.branching/checkout-non-aliased-repos.stdout @@ -0,0 +1,36 @@ +File tree of repo with suffix: +d . +d ./.morph +d ./.morph/cache +d ./.morph/cache/gits +d ./.morph/cache/gits/file_git +d ./.morph/cache/gits/file_git/.git +d ./master +d ./master/.morph-system-branch +d ./master/tmp +d ./master/TEMP_DIR +d ./master/DATADIR +d ./master/DATADIR/morphs +d ./master/DATADIR/morphs/.git +f ./master/DATADIR/morphs/hello-stratum.morph +f ./master/DATADIR/morphs/hello-system.morph +Current branches of repo with suffix: +* master +File tree of repo without suffix: +d . +d ./.morph +d ./.morph/cache +d ./.morph/cache/gits +d ./.morph/cache/gits/file_morphs +d ./.morph/cache/gits/file_morphs/.git +d ./master +d ./master/.morph-system-branch +d ./master/tmp +d ./master/TEMP_DIR +d ./master/DATADIR +d ./master/DATADIR/morphs +d ./master/DATADIR/morphs/.git +f ./master/DATADIR/morphs/hello-stratum.morph +f ./master/DATADIR/morphs/hello-system.morph +Current branches of repo without suffix: +* master diff --git a/tests.branching/edit-checkouts-existing-chunk.script b/tests.branching/edit-checkouts-existing-chunk.script index 99276853..b8480a5b 100755 --- a/tests.branching/edit-checkouts-existing-chunk.script +++ b/tests.branching/edit-checkouts-existing-chunk.script @@ -23,14 +23,14 @@ set -eu # Checkout the master system branch. cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout alfred +"$SRCDIR/scripts/test-morph" checkout baserock:morphs alfred # Edit the hello chunk in alfred. -cd alfred/morphs +cd alfred/baserock:morphs "$SRCDIR/scripts/test-morph" edit baserock:hello alfred echo "Current branches, morphs:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/alfred/morphs" branch +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/alfred/baserock:morphs" branch echo "Current branches, hello:" "$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/alfred/hello" branch diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script index 921eb048..502c8220 100755 --- a/tests.branching/petrify.script +++ b/tests.branching/petrify.script @@ -25,8 +25,8 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" update-gits baserock:morphs master \ hello-stratum.morph -"$SRCDIR/scripts/test-morph" checkout master +"$SRCDIR/scripts/test-morph" checkout baserock:morphs master -cd master/morphs +cd master/baserock:morphs "$SRCDIR/scripts/test-morph" petrify hello-stratum.morph cat hello-stratum.morph diff --git a/tests.branching/setup b/tests.branching/setup index 1705c9b4..51092cea 100755 --- a/tests.branching/setup +++ b/tests.branching/setup @@ -56,6 +56,9 @@ mkdir "$DATADIR/workspace" # Create a fake morphs repository mkdir "$DATADIR/morphs" +## Create a link to this repo that has a .git suffix +ln -s "$DATADIR/morphs" "$DATADIR/morphs.git" + cat <<EOF > "$DATADIR/morphs/hello-system.morph" { "name": "hello-system", diff --git a/tests.branching/workflow.script b/tests.branching/workflow.script index ca626cd8..64326e4a 100755 --- a/tests.branching/workflow.script +++ b/tests.branching/workflow.script @@ -32,8 +32,8 @@ git add README git commit -m "Fix README, yo!" --quiet cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" checkout master -cd master/morphs +"$SRCDIR/scripts/test-morph" checkout baserock:morphs master +cd master/baserock:morphs "$SRCDIR/scripts/test-morph" edit baserock:hello master "$SRCDIR/scripts/test-morph" merge me/readme-fix hello |