chiark / gitweb /
Shell bug: avoid local=$(....) as it defeats set -e
[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_INFRA_PFX:=$DGIT_TEST_INTREE${DGIT_TEST_INTREE:+/infra/}}
15         export DGIT_TEST DGIT_BADCOMMIT_FIXUP
16         export DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST
17         export PERLLIB="$DGIT_TEST_INTREE${PERLLIB:+:}${PERLLIB}"
18 }
19
20 t-set-using-tmp () {
21         export HOME=$tmp
22         export DGIT_TEST_DUMMY_DIR=$tmp
23         export DGIT_TEST_TMP=$tmp
24         export GNUPGHOME=$tmp/nonexistent
25         git config --global user.email 'dgit-test@debian.example.net'
26         git config --global user.name 'dgit test git user'
27 }
28
29 t-filter-out-git-hyphen-dir () {
30         local pathent; pathent=$(type -p git-rev-parse ||:)
31         case "$pathent" in '') return ;; esac
32         pathent=${pathent%/*}
33         local path=":$PATH:"
34         path="${path//:$pathent:/}"
35         path="${path#:}"
36         path="${path%:}"
37         PATH="$path"
38 }