@ -68,14 +68,14 @@ else
echo "Using extra git-dch options (${DCH_EXTRA_OPTS})"
echo "Using extra git-dch options (${DCH_EXTRA_OPTS})"
fi
fi
branch_checkout () {
create_local_branch () {
[ -n "${1:-}" ] || return 1
[ -n "${1:-}" ] || return 1
local BRANCH="$1"
local BRANCH="$1"
if git branch -a | grep -q "remotes/origin/${BRANCH}" ; then
if git branch -a | grep -q "remotes/origin/${BRANCH}" ; then
git branch -D "${BRANCH}" || true
git branch -D "${BRANCH}" || true
git checkout -b "${BRANCH}" "remotes/origin/${BRANCH}"
git bran ch "${BRANCH}" "remotes/origin/${BRANCH}"
else
else
echo "NOTE: branch $BRANCH does not exist, ignoring request to checkout therefore."
echo "NOTE: branch $BRANCH does not exist, ignoring request to checkout therefore."
fi
fi
@ -133,16 +133,21 @@ git_tag_build() {
# Clean up any unexpected local changes
# Clean up any unexpected local changes
#git reset --hard HEAD
#git reset --hard HEAD
# git-buildpackage's --git-upstream-branch defaults to "upstream",
# make sure common branches are available for git-buildpackage
# so try to make sure it's available if it exists
create_local_branch upstream
if [ -n "${branch:-}" ] && [ "${branch:-}" != "upstream" ] ; then
create_local_branch debian
branch_checkout upstream
create_local_branch pristine-tar
fi
# Drop residual files
# Drop residual files
#git clean -xfd
#git clean -xfd
git checkout "$GIT_COMMIT"
if [ -n "${branch:-}" ] ; then
echo "Branch parameter set, checking out $branch"
git checkout "${branch}"
else
echo "No branch parameter set, checking out $GIT_COMMIT"
git checkout "$GIT_COMMIT"
fi
if [ -n "${tag:-}" ] ; then
if [ -n "${tag:-}" ] ; then
echo "Tag parameter found, using dch for changelog generation."
echo "Tag parameter found, using dch for changelog generation."