File: branch_revision

package info (click to toggle)
spec-alpha-clojure 0.5.238-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 328 kB
  • sloc: xml: 146; sh: 41; makefile: 5
file content (16 lines) | stat: -rwxr-xr-x 360 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

# If on a branch other than master, returns the number of commits made off of master
# If on master, returns 0

set -e

master_tag=`git rev-parse --abbrev-ref HEAD`

if [ "$master_tag" == "master" ]; then
    echo "0"
else
    last_commit=`git rev-parse HEAD`
    revision=`git rev-list master..$last_commit | wc -l`
    echo $revision
fi