ソースを参照

tiny fixes for loop

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

+ 6 - 3
hooks/post-update.sh

@@ -12,15 +12,18 @@ GITURL="git@yourhost.domain:oz123/frank.git"
 JSON_TO_SUBMIT=""
 
 for HEAD in $@; do  
+	# We love bash too, but there a really fancy basename 
+	# BRANCH=`basename $HEAD`
 	# CUT, UNIX, No bash
-	# BRANCH=$(echo $1 |cut -d / -f 3)
+	# BRANCH=$(echo $HEAD |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=$REST_OF_JSON,\"branch\":\""${BRANCH}"\"
+	REST_OF_JSON=$REST_OF_JSON,\"giturl\":\"$GITURL\""}"
+        # TODO: append REST_OF_JSON to JSON_TO_SUBMIT
 	echo $REST_OF_JSON > /home/ozn/${BRANCH}
 done