Fix pre-commit bug regarding astyle detection. If not installed, all commited files...
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Sun, 17 May 2015 15:21:46 +0000 (17:21 +0200)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Sun, 17 May 2015 16:23:09 +0000 (18:23 +0200)
19 files changed:
example/diameter/launcher/Launcher.cpp [new file with mode: 0644]
example/diameter/launcher/Launcher.hpp [new file with mode: 0644]
example/diameter/launcher/MyCommunicator.cpp [new file with mode: 0644]
example/diameter/launcher/MyCommunicator.hpp [new file with mode: 0644]
example/diameter/launcher/MyCounterRecorder.cpp [new file with mode: 0644]
example/diameter/launcher/MyCounterRecorder.hpp [new file with mode: 0644]
example/diameter/launcher/MyCounterRecorderClock.hpp [new file with mode: 0644]
example/diameter/launcher/MyDiameterEngine.hpp [new file with mode: 0644]
example/diameter/launcher/MyDiameterEntity.cpp [new file with mode: 0644]
example/diameter/launcher/MyDiameterEntity.hpp [new file with mode: 0644]
example/diameter/launcher/MyHandler.cpp [new file with mode: 0644]
example/diameter/launcher/MyHandler.hpp [new file with mode: 0644]
example/diameter/launcher/MyLocalServer.cpp [new file with mode: 0644]
example/diameter/launcher/MyLocalServer.hpp [new file with mode: 0644]
example/diameter/launcher/ProgrammedAnswers.cpp [new file with mode: 0644]
example/diameter/launcher/ProgrammedAnswers.hpp [new file with mode: 0644]
example/diameter/launcher/deployments/ft-client/pre-start.sh
include/anna/config/defines.hpp
scr/git/pre-commit.sh

diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/Launcher.hpp b/example/diameter/launcher/Launcher.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyCommunicator.cpp b/example/diameter/launcher/MyCommunicator.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyCommunicator.hpp b/example/diameter/launcher/MyCommunicator.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyCounterRecorder.cpp b/example/diameter/launcher/MyCounterRecorder.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyCounterRecorder.hpp b/example/diameter/launcher/MyCounterRecorder.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyCounterRecorderClock.hpp b/example/diameter/launcher/MyCounterRecorderClock.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyDiameterEngine.hpp b/example/diameter/launcher/MyDiameterEngine.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyDiameterEntity.cpp b/example/diameter/launcher/MyDiameterEntity.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyDiameterEntity.hpp b/example/diameter/launcher/MyDiameterEntity.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyHandler.cpp b/example/diameter/launcher/MyHandler.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyHandler.hpp b/example/diameter/launcher/MyHandler.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyLocalServer.cpp b/example/diameter/launcher/MyLocalServer.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/MyLocalServer.hpp b/example/diameter/launcher/MyLocalServer.hpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/ProgrammedAnswers.cpp b/example/diameter/launcher/ProgrammedAnswers.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/example/diameter/launcher/ProgrammedAnswers.hpp b/example/diameter/launcher/ProgrammedAnswers.hpp
new file mode 100644 (file)
index 0000000..e69de29
index b1863af..a01d1f0 100755 (executable)
@@ -24,7 +24,7 @@ fi
 # DEFAULTS
 #[ "$entity_dflt" = "" ] && entity_dflt="192.168.12.11:3868,192.168.12.21:3868"
 [ "$entity_dflt" = "" ] && entity_dflt="localhost:3868"
-[ "$entityServerSessions_dflt" = "" ] && entityServerSessions_dflt=10
+[ "$entityServerSessions_dflt" = "" ] && entityServerSessions_dflt=1
 [ "$dictionary_dflt" = "" ] && dictionary_dflt=dictionary.xml
 
 
index a8e995b..4bae089 100644 (file)
@@ -14,6 +14,9 @@
 // For cstd0x compatibility we will use stdint.h types instead of std:: ones on cstdint:
 //#include <cstdint>  when C++11 available
 
+#include <anna/core/tracing/Logger.hpp>
+
+
 #ifdef ANNA_FILE_LOCATION
 #undef ANNA_FILE_LOCATION
 #endif
index 5d1a980..01e85e9 100755 (executable)
@@ -48,10 +48,9 @@ then
 fi
 
 # Astyle
-version=`astyle --version 2> /dev/null`
-if test "x$version" != "x"; then
-echo "SDF3 git pre-receive hook:"
-echo "Did not find astyle, please install it before continuing."
+which astyle >/dev/null 2>/dev/null
+if [ $? -ne 0 ]; then
+echo "pre-commit hook: 'astyle' not found, install it before continuing or remove .fix_style to skip astyle processing."
 exit 1
 fi
 ASTYLE=astyle
@@ -60,8 +59,7 @@ case `$ASTYLE --version 2> /dev/null` in
   Artistic*)
       ;;
   default)
-      echo "SDF3 git pre-commit hook:"
-      echo "Did not find astyle, please install it before continuing."
+      echo "pre-commit hook: unsupported astyle version, must be 'Artistic Style Version x.xx'. Install or skip (remove .fix_style)."
       exit 1
       ;;
 esac
@@ -90,13 +88,18 @@ test_style () {
   file=$1
   newfile=${file}.astyled
   #$ASTYLE ${ASTYLE_PARAMETERS} < $file > $newfile 2>>/dev/null
-  $ASTYLE -a -f -p -o -O -c -s2 -U -x --mode=c < $file > $newfile 2>>/dev/null
+  echo "Executing $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile"
+  $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile
+  if [ $? -ne 0 ] ; then
+    echo "Error in astyle"
+    exit 1
+  fi
   diff "${file}" "${newfile}"
-  r=$?
-  if [ $r != 0 ] ; then
+  if [ $? -ne 0 ] ; then
     echo "Code style error in '$file', please fix before commiting."
     if [ -f "./.fix_style" ]; then
       echo "Auto-fixing code style..."
+      cp $file ${file}.orig
       mv $newfile $file
     else
       echo "To autofix, create a hidden file named './.fix_style' on suite root."