From: Eduardo Ramos Testillano Date: Tue, 25 Jun 2013 01:21:36 +0000 (+0200) Subject: pre-commit with auto fixing X-Git-Tag: REFACTORING_TESTING_LIBRARY~271 X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=2357b29571f7b46859a6841d82a4b88b366c037f;p=anna.git pre-commit with auto fixing --- diff --git a/pre-commit.sh b/pre-commit.sh index 2771db8..e9ded58 100755 --- a/pre-commit.sh +++ b/pre-commit.sh @@ -93,13 +93,18 @@ test_style () { $ASTYLE -a -f -p -o -O -c -s2 -U -x --mode=c < $file > $newfile 2>>/dev/null diff "${file}" "${newfile}" r=$? - rm "${newfile}" if [ $r != 0 ] ; then echo "Code style error in '$file', please fix before commiting." - echo "To autofix, create a hidden file named './.fix_style' on suite root." -pwd -echo xxxx - exit 1 + if [ -f "./.fix_style" ]; then + echo "Auto-fixing code style..." + mv $newfile $file + else + echo "To autofix, create a hidden file named './.fix_style' on suite root." + rm $newfile + exit 1 + fi + else + rm $newfile fi } diff --git a/source/core/util/Environment.cpp b/source/core/util/Environment.cpp index c00d9a5..83ed2f8 100644 --- a/source/core/util/Environment.cpp +++ b/source/core/util/Environment.cpp @@ -112,7 +112,7 @@ std::string Environment::getValue(const char* variableName, bool exceptionIfMiss std::map::const_iterator it = a_managedVars.find(variableName); - if (it == a_managedVars.end()) { + if(it == a_managedVars.end()) { std::string msg = "The variable '"; msg += variableName; msg += "' is not defined in the environment.";