summaryrefslogtreecommitdiff
path: root/tests/raw-multiple-files.script
diff options
context:
space:
mode:
Diffstat (limited to 'tests/raw-multiple-files.script')
-rwxr-xr-xtests/raw-multiple-files.script49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/raw-multiple-files.script b/tests/raw-multiple-files.script
new file mode 100755
index 0000000..4c16c51
--- /dev/null
+++ b/tests/raw-multiple-files.script
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Tests converting a folder with three raw files into a git repository.
+# Verifies that updating the relative paths in the .lorry file and
+# running again updates the relative paths in the git repo.
+#
+# Copyright (C) 2022 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/raw-multiple-files.log"
+workdir="$DATADIR/work-dir"
+
+"${SRCDIR}/test-lorry" --pull-only --log="$logfile" --working-area="$workdir" \
+ "$DATADIR/raw-multiple-files.lorry" > /dev/null
+
+# update the lorry file, verify relative paths in git repo have changed
+sed -i 's/subdir_two/./g' ${DATADIR}/raw-multiple-files.lorry
+
+"${SRCDIR}/test-lorry" --pull-only --log="$logfile" --working-area="$workdir" \
+ "$DATADIR/raw-multiple-files.lorry" > /dev/null
+
+# verify that the git repositories were created successfully
+cd "$workdir/multiple-files-repo/git-a"
+
+# verify the files were created correctly the first time
+git ls-tree -r --name-only HEAD
+
+cd "$workdir/multiple-files-repo/git-b/"
+
+# verify the files have been updated correctly
+git ls-tree -r --name-only HEAD
+
+# list the commit messages
+git log --pretty='%s' master | sed -e"s,${DATADIR},DATADIR,"