matteosister / GitElephant

An abstraction layer for git written in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getCurrentTag command

zhil opened this issue · comments

commented

In order to get currently deployed tag name I use bash code like

GIT_HASH=$(git rev-parse HEAD)
GIT_TAG=$(git name-rev --tags --name-only ${GIT_HASH})

Its very fast even for repositories for tons of tags (fetching all tags with hashes and searching over them would be too slow).

Will you accept PR with such a command?

commented

Another possible solution

git symbolic-ref -q --short HEAD || git describe --tags --exact-match

not sure how to execute such a command using GitElephant.

The second one looks not really easy to implement. I'm not so much into this library anymore, so if you want to send a PR that fits the library goals, and do not breaks backward compatibility it would be awesome. Many thanks!