aboutsummaryrefslogtreecommitdiff
path: root/tests/common/git
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common/git')
-rw-r--r--tests/common/git/README104
-rwxr-xr-xtests/common/git/init171
-rwxr-xr-xtests/common/git/pack29
-rw-r--r--tests/common/git/state0/libbar.tarbin0 -> 61440 bytes
-rw-r--r--tests/common/git/state0/libfoo.tarbin0 -> 256000 bytes
-rw-r--r--tests/common/git/state0/style-basic.tarbin0 -> 61440 bytes
-rw-r--r--tests/common/git/state0/style.tarbin0 -> 112640 bytes
-rw-r--r--tests/common/git/state1/libbaz.tarbin0 -> 61440 bytes
-rw-r--r--tests/common/git/state1/libfoo.tarbin0 -> 337920 bytes
-rw-r--r--tests/common/git/state1/style-basic.tarbin0 -> 61440 bytes
-rw-r--r--tests/common/git/state1/style.tarbin0 -> 112640 bytes
11 files changed, 304 insertions, 0 deletions
diff --git a/tests/common/git/README b/tests/common/git/README
new file mode 100644
index 0000000..eac6765
--- /dev/null
+++ b/tests/common/git/README
@@ -0,0 +1,104 @@
+1. Local repositories.
+
+To modify the repositories that are used for git repository tests run
+
+$ ./init --unpack
+
+before modification, and
+
+$ ./pack
+
+afterwrds.
+
+Also note that config files under .git/ subdirectory refer to the submodule
+repositories using absolute paths. So prior to pulling in subproject directory
+(say in state0/libfoo.git/doc/style) you need to run the following commands,
+to make sure that the repository references match their current locations:
+
+$ git -C style.git submodule sync --recursive
+$ git -C libfoo.git submodule sync --recursive
+
+
+2. Remote repositories.
+
+To bootstrap the remote repositories run the following commands on build2.org
+host.
+
+$ cd /var/scm
+
+Create repositories, providing the proper project description:
+
+# bpkg test repository with doc basic style library (initial state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state0/style-basic.git
+
+# bpkg test repository with doc style library (initial state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state0/style.git
+
+# bpkg test repository with libbar library (initial state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state0/libbar.git
+
+# bpkg test repository with libfoo library (initial state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state0/libfoo.git
+
+# bpkg test repository with doc basic style library (final state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state1/style-basic.git
+
+# bpkg test repository with doc style library (final state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state1/style.git
+
+# bpkg test repository with libbaz library (final state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state1/libbaz.git
+
+# bpkg test repository with libfoo library (final state)
+#
+$ ./mkrepo testing/bpkg/unadv/rep-fetch/state1/libfoo.git
+
+
+# bpkg test repository with doc basic style library (advonly, initial state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state0/style-basic.git
+
+# bpkg test repository with doc style library (advonly, initial state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state0/style.git
+
+# bpkg test repository with libbar library (advonly, initial state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state0/libbar.git
+
+# bpkg test repository with libfoo library (advonly, initial state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state0/libfoo.git
+
+# bpkg test repository with doc basic style library (advonly, final state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state1/style-basic.git
+
+# bpkg test repository with doc style library (advonly, final state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state1/style.git
+
+# bpkg test repository with libbaz library (advonly, final state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state1/libbaz.git
+
+# bpkg test repository with libfoo library (advonly, final state)
+#
+$ ./mkrepo testing/bpkg/advonly/rep-fetch/state1/libfoo.git
+
+Add configuration options:
+
+$ for d in $(find . -type d -regex '\./testing/bpkg/.*/[^/]+\.git'); do \
+ git -C $d config receive.denyDeleteCurrent ignore \
+done
+
+$ for d in $(find . -type d -regex '\./testing/bpkg/advonly/.*/[^/]+\.git'); do \
+ git -C $d config uploadpack.allowAnySHA1InWant false \
+done
diff --git a/tests/common/git/init b/tests/common/git/init
new file mode 100755
index 0000000..c999347
--- /dev/null
+++ b/tests/common/git/init
@@ -0,0 +1,171 @@
+#! /bin/sh
+
+# Create git repositories from project directories/tarballs.
+#
+# Usage example:
+#
+# ./init [--unpack]
+#
+owd=`pwd`
+trap "{ cd $owd; exit 1; }" ERR
+set -o errtrace # Trap in functions.
+
+function info () { echo "$*" 1>&2; }
+function error () { info "error: $*"; exit 1; }
+function trace () { if [ "$verbose" == 'y' ]; then info "trace: $*"; fi }
+
+unpack=
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ --unpack)
+ unpack='y'
+ shift
+ ;;
+ *)
+ error "invalid option $1"
+ ;;
+ esac
+done
+
+# Unpack repositories if requested.
+#
+if [ -n "$unpack" ]; then
+ for f in */*.tar; do
+ rm -r -f ${f%.tar}.git
+ tar xf $f;
+ done
+fi
+
+# Create the initial state of the repositories libfoo.git, libbar.git,
+# style.git, and style-basic.git.
+#
+cd state0
+
+rm -f -r libfoo.git/.git
+rm -f libfoo.git/.gitmodules
+rm -f libfoo.git/README
+rm -f -r libfoo.git/libbar
+rm -f -r libfoo.git/doc/style
+
+rm -f -r libbar.git/.git
+
+rm -f -r style.git/.git
+rm -f -r style.git/basic
+
+rm -f -r style-basic.git/.git
+rm -f style-basic.git/README
+rm -f style-basic.git/INSTALL
+
+# Create master branch for style-basic.git.
+#
+git -C style-basic.git init
+git -C style-basic.git add '*'
+git -C style-basic.git commit -am 'Create'
+
+# Create stable branch for style-basic.
+#
+git -C style-basic.git branch stable
+git -C style-basic.git checkout stable
+touch style-basic.git/README
+git -C style-basic.git add README
+git -C style-basic.git commit -am 'README'
+
+# Create master branch for style.git, adding style-basic.git as a submodule.
+#
+git -C style.git init
+git -C style.git add '*'
+git -C style.git submodule add ../style-basic.git basic # The stable branch.
+git -C style.git commit -am 'Create'
+
+# Make style.git to refer an unadvertised reference, commiting into the stable
+# branch of style-basic.git.
+#
+touch style-basic.git/INSTALL
+git -C style-basic.git add INSTALL
+git -C style-basic.git commit -am 'INSTALL'
+git -C style-basic.git checkout master
+
+# Create master branch for libbar.git.
+#
+git -C libbar.git init
+git -C libbar.git add '*'
+git -C libbar.git commit -am 'Create'
+
+# Create master branch for libfoo.git, adding style.git and libbar.git as
+# submodules.
+#
+git -C libfoo.git init
+git -C libfoo.git add '*'
+git -C libfoo.git submodule add ../style.git doc/style
+git -C libfoo.git submodule add ../libbar.git libbar
+git -C libfoo.git submodule update --init --recursive # Updates doc/style/basic.
+git -C libfoo.git commit -am 'Create'
+
+# Add tags for libfoo.git.
+#
+git -C libfoo.git tag 'lightweight_tag'
+git -C libfoo.git tag -a 'annotated_tag' -m 'annotated_tag'
+
+# Advance the master branch to make tags not to mark a branch tip.
+#
+touch libfoo.git/README
+git -C libfoo.git add README
+git -C libfoo.git commit -am 'README'
+
+# Create the modified state of the repositories, replacing libbar.git submodule
+# of libfoo with the newly created libbaz.git repository. Also advance master
+# branches and tags for libfoo.git and it's submodule style.git.
+#
+cd ../state1
+
+# Copy repositories initial state.
+#
+for d in ../state0/*.git; do
+ rm -f -r $(basename $d)
+ cp -r $d .
+done
+
+# Create libbaz.git repository.
+#
+rm -f -r libbaz.git/.git
+
+git -C libbaz.git init
+git -C libbaz.git add '*'
+git -C libbaz.git commit -am 'Create'
+
+# Sync submodule references with their new locations.
+#
+for d in *.git; do
+ git -C $d submodule sync --recursive
+done
+
+# Advance style.git master branch.
+#
+touch style.git/README
+git -C style.git add README
+git -C style.git commit -am 'README'
+
+# Advance libfoo.git master branch.
+#
+git -C libfoo.git submodule update --init --remote # Pull style only.
+git -C libfoo.git commit -am 'Update style'
+
+git -C libfoo.git rm -r tests
+git -C libfoo.git commit -am 'Remove tests'
+
+git -C libfoo.git submodule deinit libbar
+git -C libfoo.git rm libbar
+git -C libfoo.git commit -am 'Remove libbar'
+rm -f -r libbar.git
+
+git -C libfoo.git submodule add ../libbaz.git libbaz
+git -C libfoo.git submodule update --init libbaz
+git -C libfoo.git commit -am 'Add libbaz'
+
+git -C libfoo.git tag -f 'lightweight_tag'
+git -C libfoo.git tag -f -a 'annotated_tag' -m 'annotated_tag'
+
+touch libfoo.git/INSTALL
+git -C libfoo.git add INSTALL
+git -C libfoo.git commit -am 'INSTALL'
diff --git a/tests/common/git/pack b/tests/common/git/pack
new file mode 100755
index 0000000..f53e794
--- /dev/null
+++ b/tests/common/git/pack
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+# Move git projects to tar archives.
+#
+# Usage example:
+#
+# ./pack
+#
+owd=`pwd`
+trap "{ cd $owd; exit 1; }" ERR
+set -o errtrace # Trap in functions.
+
+function info () { echo "$*" 1>&2; }
+function error () { info "$*"; exit 1; }
+
+projects=('state0/libfoo' 'state0/libbar' 'state0/style' 'state0/style-basic' \
+ 'state1/libfoo' 'state1/libbaz' 'state1/style' 'state1/style-basic')
+
+for p in "${projects[@]}"; do
+ d=$p.git
+ if [ ! -d $d ]; then
+ error "$d directory not found"
+ fi
+
+ git -C $d submodule sync --recursive
+
+ tar cf $p.tar $d
+ rm -r -f $d
+done
diff --git a/tests/common/git/state0/libbar.tar b/tests/common/git/state0/libbar.tar
new file mode 100644
index 0000000..4eff7d2
--- /dev/null
+++ b/tests/common/git/state0/libbar.tar
Binary files differ
diff --git a/tests/common/git/state0/libfoo.tar b/tests/common/git/state0/libfoo.tar
new file mode 100644
index 0000000..3938070
--- /dev/null
+++ b/tests/common/git/state0/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state0/style-basic.tar b/tests/common/git/state0/style-basic.tar
new file mode 100644
index 0000000..aabbbcd
--- /dev/null
+++ b/tests/common/git/state0/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state0/style.tar b/tests/common/git/state0/style.tar
new file mode 100644
index 0000000..1821210
--- /dev/null
+++ b/tests/common/git/state0/style.tar
Binary files differ
diff --git a/tests/common/git/state1/libbaz.tar b/tests/common/git/state1/libbaz.tar
new file mode 100644
index 0000000..de6e3d9
--- /dev/null
+++ b/tests/common/git/state1/libbaz.tar
Binary files differ
diff --git a/tests/common/git/state1/libfoo.tar b/tests/common/git/state1/libfoo.tar
new file mode 100644
index 0000000..ac5d10d
--- /dev/null
+++ b/tests/common/git/state1/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state1/style-basic.tar b/tests/common/git/state1/style-basic.tar
new file mode 100644
index 0000000..94dc12b
--- /dev/null
+++ b/tests/common/git/state1/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state1/style.tar b/tests/common/git/state1/style.tar
new file mode 100644
index 0000000..9e997ae
--- /dev/null
+++ b/tests/common/git/state1/style.tar
Binary files differ