From 53543ee3e6a837dc3ecca3c990f7ab6bd7ee933b Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sat, 23 Jun 2012 08:53:37 +0530 Subject: [PATCH] partial-copy would not propagate deletes; fixed --- doc/non-core.mkd | 18 ++++++++++++------ src/VREF/partial-copy | 9 +++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/non-core.mkd b/doc/non-core.mkd index 2ad98d8..c07c3e3 100644 --- a/doc/non-core.mkd +++ b/doc/non-core.mkd @@ -127,22 +127,28 @@ Here's how: repo foo-partialcopy-1 - secret-branch = @temp-emp - # other rules should ensure ONLY @temp-emp has ANY ACCESS - # NO other user should have access + + # other rules; see notes below - VREF/partial-copy = @all config gitolite.partialCopyOf = foo - **IMPORTANT**: if you're using other VREFs, please make sure this one is - placed at the end, after all the others. + **IMPORTANT NOTES**: + + * if you're using other VREFs, **make sure** this one is placed at the + end, after all the others. + + * remember that any change allowed to be made to the partial-copy repo + will propagate to the main repo so make sure you use other rules to + restrict pushes to other branches and tags as needed. And that should be it. **Please test it and let me know if it doesn't work!** WARNINGS: * If you change the config to disallow something that used to be allowed, - you should delete the partial repo on the server and then run 'gitolite - compile' to let it build again. See t/partial-copy.t for details. + you should delete the partial repo on the server and then run `gitolite + compile; gitolite trigger POST_COMPILE` to let it build again. * Not tested with smart http; probably won't work. diff --git a/src/VREF/partial-copy b/src/VREF/partial-copy index 19111de..55a7dcf 100755 --- a/src/VREF/partial-copy +++ b/src/VREF/partial-copy @@ -23,6 +23,15 @@ main=`git config --file $GL_REPO_BASE/$repo.git/config --get gitolite.partialCop rand=$$ export GL_BYPASS_ACCESS_CHECKS=1 +if [ "$new" = "0000000000000000000000000000000000000000" ] +then + # special case for deleting a ref (this is why it is important to put this + # VREF as the last one; if we got this far he is allowed to delete it) + git push -f $GL_REPO_BASE/$main.git :$ref || die "FATAL: failed to delete $ref" + + exit 0 +fi + git push -f $GL_REPO_BASE/$main.git $new:refs/partial/br-$rand || die "FATAL: failed to send $new" cd $GL_REPO_BASE/$main.git