summaryrefslogtreecommitdiff
path: root/Omni/Ide/hooks/pre-commit
blob: 06f171638a6178e1e3954982bab141d3f8e15f61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
#
# - prevent frozen code from being checked in
# - guard against lint errors
##
  set -e
  mapfile -t changed < <(git diff-index --cached --name-only HEAD)
  for ns in "${changed[@]}"
  do
    version=$("${CODEROOT:?}"/Omni/Ide/version.sh "$ns")
    if [[ $version -eq -1 ]]; then
      echo "info:  version:  $ns:  deleted"
    elif [[ $version -lt 1 ]]; then
      echo "fail:  version:  $ns:  $version"
      exit 1
    else
      echo "info:  version:  $ns:  $version"
    fi
  done
  lint "${changed[@]}"
##