https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: bc96f60ae153e7cf15d5f5bbb6ebc5611d06a263 authored by Dmitry Yu. Naumov on 02 December 2021, 11:36:09 UTC
Merge branch 'SmallFixes' into 'master'
Tip revision: bc96f60
pre-commit-file-extensions.sh
#!/usr/bin/env bash

# set -e

# Check for uppercase letters in filename extensions
pattern=".*\.\w*([A-Z]+)\w*$"
files=$(echo $@ | grep -E "$pattern")

if [[ -n $files ]];
then
    echo "Attention!"
    echo "----------"
    echo "Found files that contain capital letters in the file extension."
    echo "Please rename the following files and commit again:"

    while read -r file; do
        echo -e '\E[0;32m'"$file"'\033[0m'
    done <<< "$files"
    # Abort commit
    exit 1
fi

exit 0
back to top