[projects/geninitrd] use git-for-each-ref to find last tag

glen glen at pld-linux.org
Wed Jun 29 21:58:48 CEST 2016


commit 16e8a388f3184e59475429cf3fb7e69dd281045d
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Jun 29 22:55:58 2016 +0300

    use git-for-each-ref to find last tag
    
    omits two commands from pipeline

 make-tag.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/make-tag.sh b/make-tag.sh
index 6f54325..87aba64 100755
--- a/make-tag.sh
+++ b/make-tag.sh
@@ -1,7 +1,8 @@
 #!/bin/sh
 set -e
 rev=$(git rev-parse HEAD)
-last_tag=$(git tag -l | grep -E '^[0-9]+' | sort -V | tail -n1)
+ref=$(git for-each-ref 'refs/tags' --format='%(refname)' --sort=taggerdate | tail -n1)
+last_tag=${ref#refs/tags/}
 
 if [ -n "$1" ]; then
 	tag="$1"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/geninitrd.git/commitdiff/ce3a6bd6821fad3e6e60fb35a8153f95128e7160



More information about the pld-cvs-commit mailing list