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