Skip to content

Commit cd25df8

Browse files
arschlesAaron Schlesinger
authored andcommitted
fix(git.go): execute the gitreceive binary
instead of the old, nonexistent scripts
1 parent dd02221 commit cd25df8

1 file changed

Lines changed: 8 additions & 41 deletions

File tree

pkg/git/git.go

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -25,47 +25,14 @@ import (
2525
//
2626
// .GitHome: the path to Git's home directory.
2727
const preReceiveHookTplStr = `#!/bin/bash
28-
strip_remote_prefix() {
29-
stdbuf -i0 -o0 -e0 sed "s/^/"$'\e[1G'"/"
30-
}
31-
32-
while read oldrev newrev refname
33-
do
34-
LOCKFILE="/tmp/$RECEIVE_REPO.lock"
35-
if ( set -o noclobber; echo "$$" > "$LOCKFILE" ) 2> /dev/null; then
36-
trap 'rm -f "$LOCKFILE"; exit 1' INT TERM EXIT
37-
38-
# check for authorization on this repo
39-
#{{.GitHome}}/receiver "$RECEIVE_REPO" "$newrev" "$RECEIVE_USER" "$RECEIVE_FINGERPRINT"
40-
#rc=$?
41-
#if [[ $rc != 0 ]] ; then
42-
#echo " ERROR: failed on rev $newrev - push denied"
43-
#exit $rc
44-
#fi
45-
# builder assumes that we are running this script from $GITHOME
46-
cd {{.GitHome}}
47-
# if we're processing a receive-pack on an existing repo, run a build
48-
if [[ $SSH_ORIGINAL_COMMAND == git-receive-pack* ]]; then
49-
#{{.GitHome}}/builder "$RECEIVE_USER" "$RECEIVE_REPO" "$newrev" 2>&1 | strip_remote_prefix
50-
51-
GIT_HOME={{.GitHome}} \
52-
SSH_CONNECTION=$SSH_CONNECTION \
53-
SSH_ORIGINAL_COMMAND=$SSH_ORIGINAL_COMMAND \
54-
REPOSITORY=$RECEIVE_REPO \
55-
SHA=$newrev \
56-
USERNAME=$RECEIVE_USER \
57-
FINGERPRINT=$RECEIVE_FINGERPRINT \
58-
POD_NAMESPACE=$POD_NAMESPACE \
59-
boot git-receive
60-
fi
61-
62-
rm -f "$LOCKFILE"
63-
trap - INT TERM EXIT
64-
else
65-
echo "Another git push is ongoing. Aborting..."
66-
exit 1
67-
fi
68-
done
28+
GIT_HOME={{.GitHome}} \
29+
SSH_CONNECTION="$SSH_CONNECTION" \
30+
SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" \
31+
REPOSITORY="$RECEIVE_REPO" \
32+
USERNAME="$RECEIVE_USER" \
33+
FINGERPRINT="$RECEIVE_FINGERPRINT" \
34+
POD_NAMESPACE="$POD_NAMESPACE" \
35+
boot git-receive
6936
`
7037

7138
var preReceiveHookTpl = template.Must(template.New("hooks").Parse(preReceiveHookTplStr))

0 commit comments

Comments
 (0)