#!/bin/bash

# Check if we're in a git repository
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
    echo "Error: Not a git repository" >&2
    exit 1
fi

# Get the tag of the current commit
tag=$(git describe --tags --exact-match 2>/dev/null)

# Output the tag (or empty string if current commit is not tagged)
echo "$tag"