Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 1814a5b

Browse files
committed
silence git init on run, post archive contents to url, only make git user if it doesnt exist
1 parent 7c1256a commit 1814a5b

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

gitreceive

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,20 @@ case "$1" in
88
# Public commands
99

1010
init) # gitreceive init
11-
useradd -d $GITHOME $GITUSER
11+
useradd -d $GITHOME $GITUSER || true
1212
mkdir -p $GITHOME/.ssh
1313
touch $GITHOME/.ssh/authorized_keys
1414
cat > $GITHOME/receiver <<EOF
1515
#!/bin/bash
1616
URL=http://requestb.in/rlh4znrl
1717
curl \\
1818
-X 'POST' \\
19-
-F "repository=\$1" \\
19+
-F "repository=\$1" \\
2020
-F "revision=\$2" \\
2121
-F "username=\$3" \\
2222
-F "fingerprint=\$4" \\
23-
\$URL
24-
#cat > /tmp/received
25-
sleep 4
26-
echo "Ok, done"
23+
-F contents=@- \\
24+
--silent \$URL
2725
EOF
2826
chmod +x $GITHOME/receiver
2927
chown -R $GITUSER $GITHOME
@@ -46,7 +44,7 @@ EOF
4644
if [ ! -d $REPO_PATH ]; then
4745
mkdir -p $REPO_PATH
4846
cd $REPO_PATH
49-
git init --bare
47+
git init --bare > /dev/null
5048
fi
5149
cd $GITHOME
5250
PRERECEIVE_HOOK="$REPO_PATH/hooks/pre-receive"
@@ -64,7 +62,7 @@ EOF
6462
# Only run this script for the master branch. You can remove this
6563
# if block if you wish to run it for others as well.
6664
if [[ $refname = "refs/heads/master" ]] ; then
67-
echo "----> Receiving $RECEIVE_REPO @ $newrev ... "
65+
echo "----> Receiving $RECEIVE_REPO ... "
6866

6967
git archive $newrev | $GITHOME/receiver "$RECEIVE_REPO" "$newrev" "$RECEIVE_USER" "$RECEIVE_FINGERPRINT"
7068

0 commit comments

Comments
 (0)