#! /bin/bash12# This file is part of t8code.3# t8code is a C library to manage a collection (a forest) of multiple4# connected adaptive space-trees of general element classes in parallel.5#6# Copyright (C) 2025 the developers7#8# t8code is free software; you can redistribute it and/or modify9# it under the terms of the GNU General Public License as published by10# the Free Software Foundation; either version 2 of the License, or11# (at your option) any later version.12#13# t8code is distributed in the hope that it will be useful,14# but WITHOUT ANY WARRANTY; without even the implied warranty of15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16# GNU General Public License for more details.17#18# You should have received a copy of the GNU General Public License19# along with t8code; if not, write to the Free Software Foundation, Inc.,20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.2122#23# This script checks if a given file is correctly indented according to the t8indent.sh script.24#2526GIT_REPO_PATH=$(git rev-parse --show-toplevel)2728INDENT_SCRIPT=${GIT_REPO_PATH}/scripts/t8indent.sh2930usage="USAGE:$0 [FILE_TO_CHECK]\n\nWill check if [FILE_TO_CHECK] is correctly indentend according to the script t8indent.sh."3132# Check if first argument given33if [ ${1-x} = x ]34then35echo ERROR: Need to provide a file as first argument.36echo $usage37exit 138fi3940# Check if first argument is a file and store it in variable41if [ -f "$1" ]42then43file="$1"44else45# Try from folder above.46if [ -f "../$1" ]47then48file="../$1"49else50echo "ERROR: Non existing file: $1"51echo $usage52exit 153fi54fi5556#57# Check if the file is indented58#59$INDENT_SCRIPT NO_CHANGE $file60status=$?61if [ $status != 0 ]62then63echo $file is not indented.64echo65fi66exit $status67686970