diff --git a/xbps-src b/xbps-src index 8c104dfcf4e..f8c21b3b927 100755 --- a/xbps-src +++ b/xbps-src @@ -568,13 +568,14 @@ if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then fi # Try using chroot-git then git from the host system -if command -v chroot-git &>/dev/null; then - export XBPS_GIT_CMD=$(command -v chroot-git) -elif command -v git &>/dev/null; then - export XBPS_GIT_CMD=$(command -v git) +XBPS_GIT_CMD="$(PATH="/usr/libexec/chroot-git:$PATH:$XBPS_MASTERDIR/usr/libexec/chroot-git" command -v git 2>/dev/null)" +if [ -n "$XBPS_GIT_CMD" ]; then + export XBPS_GIT_CMD elif [ -z "$XBPS_USE_BUILD_MTIME" ] || [ "$XBPS_USE_GIT_REVS" ]; then echo "neither chroot-git or git are available in your system!" 1>&2 exit 1 +else + unset XBPS_GIT_CMD fi if [ -n "$XBPS_HOSTDIR" ]; then