summaryrefslogtreecommitdiff
path: root/tools/get-scala-commit-drift
blob: 1395c92c3d780d5443f8627330bb0b1133968f44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/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"