1*117a93dbSRene Scharfe#!/bin/sh 2*117a93dbSRene Scharfe# Print additional version information for non-release trees. 3aaebf433SRyan Anderson 4*117a93dbSRene Scharfeusage() { 5*117a93dbSRene Scharfe echo "Usage: $0 [srctree]" >&2 6*117a93dbSRene Scharfe exit 1 7aaebf433SRyan Anderson} 8aaebf433SRyan Anderson 9*117a93dbSRene Scharfecd "${1:-.}" || usage 10aaebf433SRyan Anderson 11*117a93dbSRene Scharfe# Check for git and a git repo. 12*117a93dbSRene Scharfeif head=`git rev-parse --verify HEAD 2>/dev/null`; then 13*117a93dbSRene Scharfe # Do we have an untagged version? 14*117a93dbSRene Scharfe if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then 15*117a93dbSRene Scharfe printf '%s%s' -g `echo "$head" | cut -c1-8` 16*117a93dbSRene Scharfe fi 17aaebf433SRyan Anderson 18*117a93dbSRene Scharfe # Are there uncommitted changes? 19*117a93dbSRene Scharfe if git diff-files | read dummy; then 20*117a93dbSRene Scharfe printf '%s' -git_dirty 21*117a93dbSRene Scharfe fi 22*117a93dbSRene Scharfefi 23