From: Stephen Haberman Date: Thu, 13 Nov 2008 04:37:50 +0000 (-0600) Subject: Auto-deploy files other than config and hooks. X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b004a2512f6d04d271a8a77658c1506955ebea4c;p=git-central.git Auto-deploy files other than config and hooks. --- diff --git a/server/post-receive-gitconfig b/server/post-receive-gitconfig index 46ab3e4..98dab4a 100644 --- a/server/post-receive-gitconfig +++ b/server/post-receive-gitconfig @@ -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 diff --git a/tests/t2800-post-receive-gitconfig.sh b/tests/t2800-post-receive-gitconfig.sh index 75eae1f..6933fc8 100644 --- a/tests/t2800-post-receive-gitconfig.sh +++ b/tests/t2800-post-receive-gitconfig.sh @@ -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