post-update.sh 998 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # This script is copyright Oz N Tiram <nahumoz@gmail.com>
  3. # It is distributed under the terms of GPLv3
  4. # EDIT THE FOLLOWING VARIABLES TO FIT YOUR NEEDS
  5. SUBMIT_HOST=192.168.1.100
  6. SUBMIT_PORT=5000
  7. GITURL="git@yourhost.domain:oz123/frank.git"
  8. JSON_TO_SUBMIT=""
  9. for HEAD in $@; do
  10. # We love bash too, but there a really fancy basename
  11. # BRANCH=`basename $HEAD`
  12. # CUT, UNIX, No bash
  13. # BRANCH=$(echo $HEAD |cut -d / -f 3)
  14. # FUCK, BASHSIMS
  15. IFS="/"
  16. BRANCH=($HEAD)
  17. BRANCH=${BRANCH[2]}
  18. REST_OF_JSON=$(git --no-pager log -n 1 --format='{"hashes":{"commit":"%H", "tree":"%T", "parents":"%P" }, "author":{"date": "%ai", "name":"%an", "email":"%ae" }, "committer":{"date": "%ci", "name": "%cn", "email":"%ce" }')
  19. REST_OF_JSON=$REST_OF_JSON,\"branch\":\""${BRANCH}"\"
  20. REST_OF_JSON=$REST_OF_JSON,\"giturl\":\"$GITURL\""}"
  21. # TODO: append REST_OF_JSON to JSON_TO_SUBMIT
  22. echo $REST_OF_JSON > /home/ozn/${BRANCH}
  23. done
  24. # TODO: fix complete json, do the actual submit with curl