INNER CODE UNIT · Java
CURRENT_BRANCH
SoftInstigate/restheart · setversion.sh:145
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)
MAJOR="${NEW_PARTS[0]}"
EXPECTED_BRANCH="${MAJOR}.x"
if [ -n "$CURRENT_BRANCH" ] && [ "$CURRENT_BRANCH" != "$EXPECTED_BRANCH" ] && [ "$FORCE" != "true" ]; then
echo "Error: Releasing version $VERSION requires being on branch '$EXPECTED_BRANCH' but current branch is '$CURRENT_BRANCH'." >&2
echo "If you really want to proceed from this branch, pass --force." >&2
exit 1
fi
# Ensure git is configured
if ! git config user.name &>/dev/null || ! git config user.email &>/dev/null; then
echo "Error: Git user.name and user.email are not configured." >&2
exit 1
fi
# Ensure working tree is clean to avoid accidental overwrites (skip this check for --dry-run)
if [ "$DRY_RUN" != "true" ] && [ -n "$(git status --porcelain)" ] && [ "$FORCE" != "true" ]; then
echo "Error: Working tree is not clean. Commit or stash changes, or pass --force to override." >&2