Home | History | Annotate | Line # | Download | only in hooks
      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 # Refresh libcbor.org ...
      6 cd docs
      7 
      8 if [[ $(git -C .. diff --cached --name-only) == *"index.html.erb"* ]]; then
      9 	echo "The homepage template has been updated, regenerating and checking in the HTML."
     10 	erb index.html.erb > index.html
     11 	git -C .. add $(pwd)/index.html
     12 fi
     13 
     14 cd ..
     15 
     16 # Run clang-format and add modified files
     17 MODIFIED_UNSTAGED=$(git -C . diff --name-only)
     18 MODIFIED_STAGED=$(git -C . diff --name-only --cached)
     19 
     20 ./clang-format.sh
     21 
     22 git add ${MODIFIED_STAGED}
     23 
     24 if [[ ${MODIFIED_UNSTAGED} != $(git -C . diff --name-only) ]]; then
     25   echo "WARNING: Non-staged files were reformatted. Please review and/or add" \
     26     "them"
     27 fi
     28 
     29 
     30