File: pre-commit.sh

package info (click to toggle)
golang-github-ajg-form 1.5+git20160822.523a5da-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 132 kB
  • sloc: sh: 11; makefile: 2
file content (18 lines) | stat: -rwxr-xr-x 523 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash -eu

# TODO: Only colorize messages given a suitable terminal.
# FIXME: Handle case in which no stash entry is created due to no changes.

printf "\e[30m=== PRE-COMMIT STARTING ===\e[m\n"
git stash save --quiet --keep-index --include-untracked

if go build -v ./... && go test -v -cover ./... && go vet ./... && golint . && travis-lint; then
  result=$?
  printf "\e[32m=== PRE-COMMIT SUCCEEDED ===\e[m\n"
else
  result=$?
  printf "\e[31m=== PRE-COMMIT FAILED ===\e[m\n"
fi

git stash pop --quiet
exit $result