functions.sh: make it possible to set git binary
to help with testing
This commit is contained in:
parent
9dc6b74058
commit
b9739f2c3f
|
@ -91,14 +91,16 @@ readconfig() {
|
||||||
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
|
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
|
||||||
[ -f "$ABUILD_USERCONF" ] && . "$ABUILD_USERCONF"
|
[ -f "$ABUILD_USERCONF" ] && . "$ABUILD_USERCONF"
|
||||||
APORTSDIR=${_APORTSDIR-$APORTSDIR}
|
APORTSDIR=${_APORTSDIR-$APORTSDIR}
|
||||||
gitbase=$(git rev-parse --show-toplevel 2>/dev/null) || true # already is -P
|
|
||||||
|
: ${GIT:=git}
|
||||||
|
gitbase=$($GIT rev-parse --show-toplevel 2>/dev/null) || true # already is -P
|
||||||
if [ -d "$APORTSDIR" ]; then
|
if [ -d "$APORTSDIR" ]; then
|
||||||
APORTSDIR=$(cd "$APORTSDIR"; pwd -P)
|
APORTSDIR=$(cd "$APORTSDIR"; pwd -P)
|
||||||
elif [ -z "$APORTSDIR" ] && [ -d "$HOME/aports" ]; then
|
elif [ -z "$APORTSDIR" ] && [ -d "$HOME/aports" ]; then
|
||||||
APORTSDIR=$(cd "$HOME/aports"; pwd -P)
|
APORTSDIR=$(cd "$HOME/aports"; pwd -P)
|
||||||
else
|
else
|
||||||
if [ -n "$gitbase" ]; then
|
if [ -n "$gitbase" ]; then
|
||||||
case $(git remote get-url origin) in
|
case $($GIT remote get-url origin) in
|
||||||
# '.git' for SSH URLs, and no suffix for HTTPS URLs
|
# '.git' for SSH URLs, and no suffix for HTTPS URLs
|
||||||
*/aports|*/aports.git) APORTSDIR=$gitbase ;;
|
*/aports|*/aports.git) APORTSDIR=$gitbase ;;
|
||||||
*) APORTSDIR= ;;
|
*) APORTSDIR= ;;
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
setup() {
|
|
||||||
export FUNCS=../functions.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "functions: check if CBUILD is set" {
|
|
||||||
. $FUNCS && test -n "$CBUILD"
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "functions: check that missing gcc does not kill us" {
|
|
||||||
sh -e -c "CC=false; . $FUNCS && test -z \"$CBUILD\""
|
|
||||||
}
|
|
Loading…
Reference in New Issue