3 # Auto-deploys the contents of the gitconfig branch to $GIT_DIR.
5 # The config file is handled specially--instead of the $GIT_DIR's config file
6 # being copied over entirely, the gitconfig:config is evaluated line by line
7 # with calls to `git config`. This means you can have settings in
8 # $GIT_DIR/config that are not in the gitconfig:config and they will not be
9 # overwritten. Deleting $GIT_DIR/config entries has to be manually.
11 # Hooks are copied over entirely, but old ones are not deleted. Deleting
12 # existing hooks has to be done manually.
15 while read oldrev newrev refname ; do
16 if [ "$refname" == "refs/heads/gitconfig" ] ; then
17 config_hash=$(git ls-tree $newrev | grep config | grep -oP '\w{40}')
18 if [[ "$config_hash" != "" ]] ; then
19 git cat-file blob "$config_hash" | while read line ; do
22 git config "${key}" "${value}"
26 hooks_hash=$(git ls-tree $newrev | grep hooks | grep -oP '\w{40}')
27 if [[ "$hooks_hash" != "" ]] ; then
28 git ls-tree "$hooks_hash" | while read mode type file_hash file_name ; do
29 echo "Installing $file_name"
30 git cat-file blob "$file_hash" > "hooks/$file_name"