summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-17 14:43:52 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-17 14:43:52 +0000
commit518a15225d1cd47aa1092cebcad395a3e413fcf8 (patch)
treed0062293f087af007c791a2152e02214b1870050 /tests
parentd587789d4972af6acee94471edc1db08a1b7f40b (diff)
downloadlorry-518a15225d1cd47aa1092cebcad395a3e413fcf8.tar.gz
Add missing files for the git test.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/git-single-commit.script45
-rwxr-xr-xtests/git-single-commit.setup50
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/git-single-commit.script b/tests/git-single-commit.script
new file mode 100755
index 0000000..a8afa5d
--- /dev/null
+++ b/tests/git-single-commit.script
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Tests converting a simple git repository to git.
+#
+# 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
+
+
+logfile="$DATADIR/git-test-repo.log"
+workdir="$DATADIR/work-dir"
+
+./lorry --pull-only --log="$logfile" --working-area="$workdir" \
+ "$DATADIR/git-test-repo.lorry" > /dev/null 2> /dev/null
+
+cd "$workdir/git-test-repo/git/"
+
+# list the branches
+git show-ref | cut -d' ' -f2
+
+# cat the test file
+git cat-file blob master:test.txt
+
+# check out the trunk branch
+cd "$workdir/git-test-repo"
+git clone --quiet git temporary-clone
+cd temporary-clone
+git checkout --quiet master
+
+# list the commit messages
+git log --pretty='%s'
diff --git a/tests/git-single-commit.setup b/tests/git-single-commit.setup
new file mode 100755
index 0000000..f3d8585
--- /dev/null
+++ b/tests/git-single-commit.setup
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# Creates a git repository with a single file and a single commit.
+#
+# 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
+
+# clean up the data directory
+test -d "$DATADIR" && rm -rf "$DATADIR"/*
+
+# create the repository
+repo="$DATADIR/git-test-repo"
+mkdir "$repo"
+cd "$repo"
+git init --quiet
+
+# add the test file
+echo "first line" > test.txt
+git add test.txt
+
+# make a commit
+git commit --quiet -m "first commit"
+
+# create the .lorry file for the repository
+cat <<EOF > $DATADIR/git-test-repo.lorry
+{
+ "git-test-repo": {
+ "type": "git",
+ "url": "file://$repo"
+ }
+}
+EOF
+
+# create the working directory
+mkdir "$DATADIR/work-dir"