github.com/yasker/longhorn-engine@v0.0.0-20160621014712-6ed6cfca0729/scripts/version (about)

     1  #!/bin/bash
     2  
     3  if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
     4      DIRTY="-dirty"
     5  fi
     6  
     7  COMMIT=$(git rev-parse --short HEAD)
     8  GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
     9  
    10  if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
    11      VERSION=$GIT_TAG
    12  else
    13      VERSION="${COMMIT}${DIRTY}"
    14  fi