I can achieve the effect I want by running:
git log -1 --decorate --oneline <commit hash>
and reading the tag names and branch names.
Is there a way to get this information directly?
Essentially what I want is the inverse operation of:
git rev-parse <tag or branch>^{commit}