Jim Meyering wrote: > We've all wanted to be able to tweak a few server-side settings, > without having to find/ask/wait for someone do something manually > on the server. With this change to ovirt's "update" hook, > you can now do just that by pushing a specially formed tag to > the remote repository. (once this hook is installed) If that tag meets > several criteria, the "update" hook will run the command you choose. > > Of course, security is important here. We don't allow arbitrary > commands, but only those specified explicitly by some server > repository administrator. See the examples in the comments below. ... > Date: Tue, 22 Sep 2009 17:17:24 +0200 > Subject: [PATCH release] update hook: allow people to change server-side git > config
FYI, here's the script I used to test this: (depends on having "update" or similar named update-hook in the current directory) #!/bin/bash # a git hook that will modify server-side config mkdir .j (cd .j git init git config hooks.server.config-changing.valid-commands \ 'git config hooks.allowbadwhitespace true git config hooks.allowbadwhitespace false git config hooks.denypush.branch.master [email protected] git config --unset hooks.denypush.branch.master' touch k git add k git commit -m. -a git config core.bare true echo foo > .git/description cp -a ../update-hook .git/hooks/update ) lock_cmd='git config hooks.denypush.branch.master [email protected]' unlock_cmd='git config --unset hooks.denypush.branch.master' server_config_change() { cmd=$1 first_commit=$(git log --reverse --pretty=%H |head -1) tag_name=git-control-$(date +%F-%H-%M-%S.%N) git tag -m "$cmd" $tag_name $first_commit git push origin tag $tag_name } lock_repo() { server_config_change "$lock_cmd"; } unlock_repo() { server_config_change "$unlock_cmd"; } git clone .j .j2 (cd .j2 first_commit=$(git log --reverse --pretty=%H |head -1) echo a >> k; git commit -m'log msg 1 *************' -a lock_repo echo a >> k; git commit -m'log msg 2 *************' -a unlock_repo git checkout -b br echo on-branch >> k; git commit -m'log msg on-br *********' -a lock_repo git push --tags git push --all ) _______________________________________________ Ovirt-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/ovirt-devel
