summaryrefslogtreecommitdiff
path: root/hooks/post-receive
blob: 66c1b2aeeba7b842f8487f21b313d4c730d4ba91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

SCORSH_CFG="scorsh"
SCORSH_VAR="scorsh.spooldir"

while read old_value new_value ref; do 
	echo "arguments: ${old_value} ${new_value} ${ref} "
	msg=$(git cat-file -p ${ref})

	echo "Got reference:"
	printf "$msg"
	echo
	echo "------"

	repo=$(pwd)
	branch=$(echo ${ref} | sed -r -e 's:refs/heads/::g')
	now=$(date +%s)
	id="${new_value}_${now}"

	spool_dir=$(git config -f ${SCORSH_CFG} ${SCORSH_VAR})
	echo "id: ${id}"
	echo "repo: ${repo}"
	echo "branch: ${branch}"
	echo "old_rev: ${old_value}"
	echo "new_rev: ${new_value}"
	echo "spool_dir: ${spool_dir}"
  cat <<EOF >${spool_dir}/${id}
---
m_id: $id 
m_repo: $repo
m_branch: $branch
m_oldrev: ${old_value}
m_newrev: ${new_value}
...
EOF
  
done