ソースを参照

Fix the script to accept multiple repositories

Oz N Tiram 9 年 前
コミット
a90381edf5
1 ファイル変更21 行追加13 行削除
  1. 21 13
      hooks/post-update.sh

+ 21 - 13
hooks/post-update.sh

@@ -1,20 +1,28 @@
+#!/bin/bash
 # This script is copyright Oz N Tiram <nahumoz@gmail.com>
 # It is distributed under the terms of GPLv3
 
-# TODO: Fix the script for the case that more than 1  branches are pushed 
-# at once 
+# EDIT THE FOLLOWING VARIABLES TO FIT YOUR NEEDS
 
-#!/bin/bash
-HEAD=$1
-# CUT, UNIX
-# BRANCH=$(echo $1 |cut -d / -f 3)
-#FUCK BASHSIMS
-IFS="/"
-BRANCH=($1)
-BRANCH=${BRANCH[2]}
+SUBMIT_HOST=192.168.1.100
+SUBMIT_PORT=5000
+GITURL="git@yourhost.domain:oz123/frank.git"
+
+
+JSON_TO_SUBMIT=""
+
+for HEAD in $@; do  
+	# CUT, UNIX, No bash
+	# BRANCH=$(echo $1 |cut -d / -f 3)
+	# FUCK, BASHSIMS
+	IFS="/"
+	BRANCH=($HEAD)
+	BRANCH=${BRANCH[2]}
+	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" }')
+	REST_OF_JSON=$REST_OF_JSON,\"branch\":\""${BRANCH}"\""}"
 
-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" }')
-REST_OF_JSON=$REST_OF_JSON,\"branch\":\""${BRANCH}"\""}"
+	echo $REST_OF_JSON > /home/ozn/${BRANCH}
+done
 
-echo $REST_OF_JSON > /home/ozn/bla
 
+# TODO: fix complete json, do the actual submit with curl