summaryrefslogtreecommitdiff
path: root/tests/update-gits-submodules.script
blob: 49f4de620c26a7985d155dd78038fd5b5fb657a9 (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
#!/bin/sh
#
# Test that 'morph update-gits' caches all the submodules needed by
# a chunk. 
#
# 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 -eu

# create a repo to use as a submodule
submodule="$DATADIR/submodule-repo"
"$SRCDIR/scripts/cmd-filter" git init --quiet "$submodule"
"$SRCDIR/scripts/run-git-in" "$submodule" commit --quiet --allow-empty \
                                          --allow-empty-message -m ""

# create an empty commit in a chunk repository
chunkrepo="$DATADIR/chunk-repo"
"$SRCDIR/scripts/run-git-in" "$chunkrepo" checkout --quiet farrokh
"$SRCDIR/scripts/run-git-in" "$chunkrepo" submodule --quiet add "$submodule" \
    > /dev/null
"$SRCDIR/scripts/run-git-in" "$chunkrepo" commit --quiet -m "add submodule"

"$SRCDIR/scripts/test-morph" update-gits test:morphs-repo master hello-stratum

test -d "$DATADIR/cache/gits/"*chunk?repo* && echo chunk-repo cached
test -d "$DATADIR/cache/gits/"*morphs?repo* && echo morphs-repo cached
test -d "$DATADIR/cache/gits/"*submodule?repo* && echo submodule-repo cached