#!/bin/sh read junk pkgname %aD ' . | python -Sc ' import os, re, subprocess, sys first = True def Describe(g): global first if first: s = sys.argv[1] first = False else: sha = g.group(1) s = subprocess.check_output(["git", "describe", "--", sha]).strip().decode("utf-8") return re.sub(r"^\D*", "", s) print(re.sub(r"SHA:([0-9a-f]+)", Describe, sys.stdin.read())) ' "$shortver"