chiark / gitweb /
changelog: start 9.13
[dgit.git] / tests / lib-core
1 #
2
3 fail () {
4         echo >&2 "failed: $*"
5         exit 1
6 }
7
8 t-set-intree () {
9         if [ "x$DGIT_TEST_INTREE" = x ]; then return; fi
10         : ${DGIT_TEST:=$DGIT_TEST_INTREE/dgit}
11         : ${DGIT_BADCOMMIT_FIXUP:=$DGIT_TEST_INTREE/dgit-badcommit-fixup}
12         : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/infra/dgit-repos-server}
13         : ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch}
14 : ${DGIT_MIRROR_SSH_WRAP_TEST:=$DGIT_TEST_INTREE/infra/dgit-mirror-ssh-wrap}
15         : ${DGIT_DEBPUSH_TEST:=$DGIT_TEST_INTREE/git-debpush}
16         : ${DGIT_INFRA_PFX:=$DGIT_TEST_INTREE${DGIT_TEST_INTREE:+/infra/}}
17         : ${DGIT_GITDEBREBASE_TEST:=$DGIT_TEST_INTREE/git-debrebase}
18         : ${DGIT_MANPAGES_SOURCE_DIR:=$DGIT_TEST_INTREE}
19         : ${DEBPUSH_GIT_PLAYTREE_SETUP:=$DGIT_TEST_INTREE/git-playtree-setup}
20         export DGIT_TEST DGIT_BADCOMMIT_FIXUP
21         export DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST
22         export DGIT_MIRROR_SSH_WRAP_TEST
23         export DGIT_MANPAGES_SOURCE_DIR DEBPUSH_GIT_PLAYTREE_SETUP
24         export PERLLIB="$DGIT_TEST_INTREE${PERLLIB:+:}${PERLLIB}"
25 }
26
27 t-set-using-tmp () {
28         export HOME=$tmp
29         export DGIT_TEST_DUMMY_DIR=$tmp
30         export DGIT_TEST_TMP=$tmp
31         export GNUPGHOME=$tmp/nonexistent
32         export DEBFULLNAME='dgit test git user'
33         git config --global user.email 'dgit-test@debian.example.net'
34         git config --global user.name "$DEBFULLNAME"
35         git config --global protocol.ext.allow always
36 }
37
38 t-filter-out-git-hyphen-dir () {
39         local pathent; pathent=$(type -p git-rev-parse ||:)
40         case "$pathent" in '') return ;; esac
41         pathent=${pathent%/*}
42         local path=":$PATH:"
43         path="${path//:$pathent:/}"
44         path="${path#:}"
45         path="${path%:}"
46         PATH="$path"
47 }
48
49 t-sort () {
50         LC_COLLATE=C sort "$@"
51 }