Auto-deploy files other than config and hooks.
authorStephen Haberman <stephen@exigencecorp.com>
Thu, 13 Nov 2008 04:37:50 +0000 (22:37 -0600)
committerStephen Haberman <stephen@exigencecorp.com>
Thu, 13 Nov 2008 04:37:50 +0000 (22:37 -0600)
server/post-receive-gitconfig
tests/t2800-post-receive-gitconfig.sh

index 46ab3e4..98dab4a 100644 (file)
@@ -1,5 +1,7 @@
 #!/bin/sh
 #
+# Copyright (c) 2008 Stephen Haberman
+#
 # Auto-deploys the contents of the gitconfig branch to $GIT_DIR.
 #
 # The config file is handled specially--instead of the $GIT_DIR's config file
@@ -30,6 +32,11 @@ while read oldrev newrev refname ; do
                                git cat-file blob "$file_hash" > "hooks/$file_name"
                        done
                fi
+
+               git ls-tree $newrev | grep -v hooks | grep -v config | grep blob | while read mode type file_hash file_name ; do
+                       echo "Installing $file_name"
+                       git cat-file blob "$file_hash" > "$file_name"
+               done
        fi
 done
 
index 75eae1f..6933fc8 100644 (file)
@@ -34,5 +34,17 @@ test_expect_success 'pushing initial value works' '
        cd ..
 '
 
+test_expect_success 'pushing locked works' '
+       ! test -f server/.git/locked &&
+
+       git checkout gitconfig &&
+       echo "foo" > locked &&
+       git add locked &&
+       git commit -m "Add locked"
+       git push origin gitconfig
+
+       test -f server/.git/locked
+'
+
 test_done