xbps-src: use host git(1) to detect current branch.

This now guesses correctly the current git branch when the target
masterdir does not match the host architecture.
This commit is contained in:
Juan RP 2015-11-13 10:54:14 +01:00
parent b46d82174f
commit cacdf5e724

View File

@ -245,7 +245,11 @@ check_build_requirements() {
if [ -z "$XBPS_ALT_REPOSITORY" ]; then
pushd "$PWD" &>/dev/null
cd $XBPS_DISTDIR
_gitbranch="$(chroot-git symbolic-ref --short HEAD 2>/dev/null)"
if [ -n "$IN_CHROOT" ]; then
_gitbranch="$(chroot-git symbolic-ref --short HEAD 2>/dev/null)"
else
_gitbranch="$(git symbolic-ref --short HEAD 2>/dev/null)"
fi
if [ -n "${_gitbranch}" -a "${_gitbranch}" != "master" ]; then
export XBPS_ALT_REPOSITORY="${_gitbranch}"
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${_gitbranch}"