From b9739f2c3feaf03268776bda7f45a760948fdeb2 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 14 Jun 2022 16:57:56 +0200 Subject: [PATCH] functions.sh: make it possible to set git binary to help with testing --- functions.sh.in | 6 ++++-- tests/functions.bats | 11 ----------- 2 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 tests/functions.bats diff --git a/functions.sh.in b/functions.sh.in index 17ee502..feac094 100644 --- a/functions.sh.in +++ b/functions.sh.in @@ -91,14 +91,16 @@ readconfig() { [ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF" [ -f "$ABUILD_USERCONF" ] && . "$ABUILD_USERCONF" 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 APORTSDIR=$(cd "$APORTSDIR"; pwd -P) elif [ -z "$APORTSDIR" ] && [ -d "$HOME/aports" ]; then APORTSDIR=$(cd "$HOME/aports"; pwd -P) else 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 */aports|*/aports.git) APORTSDIR=$gitbase ;; *) APORTSDIR= ;; diff --git a/tests/functions.bats b/tests/functions.bats deleted file mode 100644 index 6b539ff..0000000 --- a/tests/functions.bats +++ /dev/null @@ -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\"" -}