#!/usr/bin/env bash # # Usage: get-scala-commit-drift [dir] # Figures out current commit drift of a git clone. # If no dir is given, current working dir is used. # # Example output string: # 123 # # Build drift = # of commits since last tag. [[ $# -eq 0 ]] || cd "$1" # git describe is completely useles to us if we're on a tag, or haven't changed since then. # This at least gives us a total number of commits included in a release, which should grow steadily. counter=$(git shortlog | grep -E '^[ ]+\w+' | wc -l) printf "%08d" "$counter"