diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-09-06 18:14:56 +0100 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-09-10 11:37:01 +0000 |
commit | 6075afa879da2eba9468b913332b41ff23a4e269 (patch) | |
tree | 6eac5ca3e94f261692f8dfb3d0caac24b0e9b68a /tests.branching | |
parent | 7f493ba9b6c60f25e21c16fd85ce80ceec31f2fc (diff) | |
download | morph-6075afa879da2eba9468b913332b41ff23a4e269.tar.gz |
morph branch,checkout: Clean up the branch dir on failure
Diffstat (limited to 'tests.branching')
4 files changed, 57 insertions, 0 deletions
diff --git a/tests.branching/branch-cleans-up-on-failure.script b/tests.branching/branch-cleans-up-on-failure.script new file mode 100755 index 00000000..4036046c --- /dev/null +++ b/tests.branching/branch-cleans-up-on-failure.script @@ -0,0 +1,28 @@ +#!/bin/sh +# 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. + +# If a command fails, the state of the workspace should be as if the command +# was never run + +set -eu + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init + +# This will fail because we're trying to branch off a ref that doesn't exist +"$SRCDIR/scripts/test-morph" branch baserock:morphs foo/bar invalid-ref || true + +[ ! -d "$DATADIR/workspace/foo" ] diff --git a/tests.branching/branch-cleans-up-on-failure.stderr b/tests.branching/branch-cleans-up-on-failure.stderr new file mode 100644 index 00000000..5465e700 --- /dev/null +++ b/tests.branching/branch-cleans-up-on-failure.stderr @@ -0,0 +1 @@ +ERROR: Failed to check out file://TMP/morphs:invalid-ref into TMP/workspace/foo/bar/baserock:morphs diff --git a/tests.branching/checkout-cleans-up-on-failure.script b/tests.branching/checkout-cleans-up-on-failure.script new file mode 100755 index 00000000..b2a59e6c --- /dev/null +++ b/tests.branching/checkout-cleans-up-on-failure.script @@ -0,0 +1,27 @@ +#!/bin/sh +# 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. + +# If a command fails, the state of the workspace should be as if the command +# was never run + +set -eu + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init + +"$SRCDIR/scripts/test-morph" checkout baserock:morphs i/do/not/exist || true + +[ ! -d "$DATADIR/workspace/i" ] diff --git a/tests.branching/checkout-cleans-up-on-failure.stderr b/tests.branching/checkout-cleans-up-on-failure.stderr new file mode 100644 index 00000000..472764dd --- /dev/null +++ b/tests.branching/checkout-cleans-up-on-failure.stderr @@ -0,0 +1 @@ +ERROR: Failed to check out file://TMP/morphs:i/do/not/exist into TMP/workspace/i/do/not/exist/baserock:morphs |