Skip to content

Instantly share code, notes, and snippets.

@xyproto
Created March 21, 2017 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyproto/e0ac33a17365c9997c91df27d89e0072 to your computer and use it in GitHub Desktop.
Save xyproto/e0ac33a17365c9997c91df27d89e0072 to your computer and use it in GitHub Desktop.
First attempt at command line for extracting the latest tag's git hash from a PKGBUILD file that uses git
#!/bin/bash
# Try to extract the latest tag's commit hash
git ls-remote --tags $(grep source= PKGBUILD | cut -d\" -f2 | cut -d\# -f1 | cut -d+ -f2 | sed "s/\$pkgname/$(grep pkgname= PKGBUILD | cut -d= -f2)/g") | tail -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment