post-update.sh 808 B

12345678910111213141516171819202122232425262728
  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. # CUT, UNIX, No bash
  11. # BRANCH=$(echo $1 |cut -d / -f 3)
  12. # FUCK, BASHSIMS
  13. IFS="/"
  14. BRANCH=($HEAD)
  15. BRANCH=${BRANCH[2]}
  16. 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" }')
  17. REST_OF_JSON=$REST_OF_JSON,\"branch\":\""${BRANCH}"\""}"
  18. echo $REST_OF_JSON > /home/ozn/${BRANCH}
  19. done
  20. # TODO: fix complete json, do the actual submit with curl