#!/bin/bash -e

# go back to where we left after using git debrebase in build-prepare
commit=$(git rev-parse --verify tags/nerve-build-helper-tag)
if [ -n "${commit}" ]; then
	branch=$(git branch --contains ${commit} | head -1 | xargs)
	if [ -n "${branch}" ]; then
		git checkout ${branch}
	else
		# required because branch var is empty on Jenkins due to the detached check-out logic
		git checkout nerve-build-helper-tag
	fi
	git tag -d nerve-build-helper-tag
	git branch -D nerve-build-helper-branch
fi

