make it possible to run regress tests with packed repositories
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
diff --git a/README b/README
index 6f21c24..94876ae 100644
--- a/README
+++ b/README
@@ -33,6 +33,10 @@ binaries in $PATH. Tests in the cmdline directory currently depend on git(1).
$ doas pkg_add git
$ make regress
+To test with packed repositories, run:
+
+ $ make regress GOT_TEST_PACK=1
+
Man page files in the Got source tree can be viewed with 'man -l':
$ man -l got/got.1
diff --git a/regress/cmdline/common.sh b/regress/cmdline/common.sh
index 1b91f45..3089992 100644
--- a/regress/cmdline/common.sh
+++ b/regress/cmdline/common.sh
@@ -29,11 +29,20 @@ function git_init
git init -q "$1"
}
+function maybe_pack_repo
+{
+ local repo="$1"
+ if [ -n "$GOT_TEST_PACK" ]; then
+ (cd $repo && git repack -a -q)
+ fi
+}
+
function git_commit
{
local repo="$1"
shift
(cd $repo && git commit --author="$GOT_AUTHOR" -q -a "$@")
+ maybe_pack_repo $repo
}
function git_rm
@@ -96,6 +105,7 @@ function git_commit_tree
local msg="$2"
local tree="$3"
(cd $repo && git commit-tree -m "$msg" "$tree")
+ maybe_pack_repo $repo
}
function make_test_tree