echo -n "$input" | sh /srv/git/hooks/server/post-receive-email
echo -n "$input" | sh /srv/git/hooks/server/post-receive-trac
+echo -n "$input" | sh /srv/git/hooks/server/post-receive-git-config
--- /dev/null
+#!/bin/sh
+
+while read oldrev newrev refname ; do
+ if [ "$refname" == "refs/heads/gitconfig" ] ; then
+ config_hash=$(git ls-tree $newrev | grep config | gawk '{print $3}')
+ if [[ "$config_hash" != "" ]] ; then
+ git cat-file blob "$config_hash" | while read line ; do
+ key="${line%=*}"
+ value="${line#*=}"
+ git config "${key}" "${value}"
+ done
+ fi
+ fi
+done
+
+++ /dev/null
-#!/bin/sh
-
-refname="$1"
-oldrev="$2"
-newrev="$3"
-
-if [ "$refname" != "refs/heads/gitconfig" ] ; then
- exit 0
-fi
-
-config_hash=$(git ls-tree $newrev | grep config | gawk '{print $3}')
-if [[ "$config_hash" != "" ]] ; then
- git cat-file blob "$config_hash" | while read line ; do
- key="${line%=*}"
- value="${line#*=}"
- git config "${key}" "${value}"
- done
-fi
-
--- /dev/null
+#!/bin/sh
+
+test_description='server update git config'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config --add branch.master.remote origin &&
+ git config --add branch.master.merge refs/heads/master &&
+ git fetch
+'
+
+install_post_receive_hook 'post-receive-git-config'
+
+test_expect_success 'pushing initial value works' '
+ cd server &&
+ ! git config --list | grep foo &&
+ cd .. &&
+
+ ../../scripts/make-gitconfig-branch.sh &&
+ git checkout gitconfig &&
+ echo "foo.foo=bar" > config &&
+ git commit -a -m "Set foo.foo=bar."
+ git push origin gitconfig
+
+ cd server &&
+ git config --list | grep foo &&
+ cd ..
+'
+
+test_done
+
+++ /dev/null
-#!/bin/sh
-
-test_description='server update git config'
-
-. ./test-lib.sh
-
-test_expect_success 'setup' '
- echo "setup" >a &&
- git add a &&
- git commit -m "setup" &&
- git clone ./. server &&
- rm -fr server/.git/hooks &&
- git remote add origin ./server &&
- git config --add branch.master.remote origin &&
- git config --add branch.master.merge refs/heads/master &&
- git fetch
-'
-
-install_update_hook 'update-git-config'
-
-test_expect_success 'pushing initial value works' '
- cd server &&
- ! git config --list | grep foo &&
- cd .. &&
-
- ../../scripts/make-gitconfig-branch.sh &&
- git checkout gitconfig &&
- echo "foo.foo=bar" > config &&
- git commit -a -m "Set foo.foo=bar."
- git push origin gitconfig
-
- cd server &&
- git config --list | grep foo &&
- cd ..
-'
-
-test_done
-