Actually, It could be one line longer:

```bash
head="$(git rev-parse HEAD)" tag="$(git tag --points-at $head)" ; echo "${tag:-$head}"
```

Wdyt?