#!/bin/bash
set -e

CUR_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

indent --version || true

$CUR_DIR/gst-indent-all

if git diff --quiet -- ':!subprojects/gst-integration-testsuites/medias' .; then
    echo "Code is properly formatted"
else
    git diff --color=always -- ':!subprojects/gst-integration-testsuites/medias' .
echo 'style diverges, please run gst-indent first'
    exit 1
fi