summaryrefslogtreecommitdiff
path: root/tests/raw-multiple-files.script
blob: 4c16c51d8ce195784173f9b0895c31edfc8f0594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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,"