Use contents of local checkout instead of last commit for validation

Validating only committed files is not useful in the natural
  $test_everything_passes; commit; push
workflow; the failures will not be caught locally, only by Travis later
(and only if PRs are used instead of direct commits to master).

So, use the working directory state instead of last commit for
validations; and remove misleading comments in checks which already use
the working directory state.
This commit is contained in:
Miloslav Trmač 2016-03-21 14:55:32 +01:00
parent 0d94172288
commit d08a3812d2
4 changed files with 2 additions and 7 deletions

View File

@ -21,9 +21,7 @@ if [ -z "$VALIDATE_UPSTREAM" ]; then
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
validate_diff() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git diff "$VALIDATE_COMMIT_DIFF" "$@"
fi
git diff "$VALIDATE_UPSTREAM" "$@"
}
validate_log() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then

View File

@ -8,8 +8,7 @@ unset IFS
badFiles=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed is formatted
if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then
if [ "$(gofmt -s -l < $f)" ]; then
badFiles+=( "$f" )
fi
done

View File

@ -11,7 +11,6 @@ unset IFS
errors=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed passes go lint
failedLint=$(golint "$f")
if [ "$failedLint" ]; then
errors+=( "$failedLint" )

View File

@ -8,7 +8,6 @@ unset IFS
errors=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed passes go vet
failedVet=$(go vet "$f")
if [ "$failedVet" ]; then
errors+=( "$failedVet" )