I am working on the atom-editor-git PKGBUILD in the AUR, hoping to turn it into an Atom equivalent to the gvim-git PKGBUILD. See the gvim-git PKGBUILD updates its package version whenever it is run to the latest release of gVim, e.g., if I was to run it right now it would build a package for gVim 7.4.1236. The atom-editor-git PKGBUILD, however, returns the package version 1.4.0.r653.g41029f6 when 1.4.2 is the latest release of Atom. gvim-git uses this pkgver() function:pkgver() { cd $_pkgname git describe --tags | sed 's/^v//;s/-/./g'}while atom-editor-git uses:pkgver() {  cd $srcdir/atom  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'}the obvious solution would be to replace git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' with git describe --tags | sed 's/^v//;s/-/./g' in the atom-editor-git PKGBUILD, but running git describe --tags | sed 's/^v//;s/-/./g' in the Atom git repository gives:1.4.0.653.g41029f6which is not in the format I want (1.4.2), so I suspect that what I need to get atom-editor-git to package the latest release of Atom is an alternative git line in the pkgver() function and that is what I am here for. To be clear, I want pkgver() to give me 1.4.2 exactly for the current version, not v1.4.2 or v1.4.2-1-<COMMIT> where <COMMIT> is the 7-character commit short-descriptor.  
How do I get git to give me an acceptable pkgver for Atom which I can use to check it out?
git;pkgbuild
Atom uses the stable branch for its stable release builds, so to find the latest tag for a release you need to check that branch:$ git describe --tags stablev1.4.2-1-ge9db64cTo retrieve the corresponding tag, keep everything up to the first -:$ git describe --tags stable | cut -d- -f1v1.4.2To get the version without the leading v, strip that off:$ git describe --tags stable | cut -d- -f1 | sed 's/^v//'1.4.2