diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-07 21:39:29 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-07 21:39:55 -0400 |
| commit | 3269dd8ffd621fa977cb108e0e6ad2671a7b6836 (patch) | |
| tree | 70e686ef46056984f27c0eccc9551253f08b3a46 /contrib | |
| parent | c98285d957865aadaac3190543be1a1b3ae16476 (diff) | |
| parent | 3137c266b0082cf33d0cf747b2a2ea0929ca2d92 (diff) | |
Merge branch 'master' into wip
Diffstat (limited to 'contrib')
| -rwxr-xr-x | contrib/post-merge-hook | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/contrib/post-merge-hook b/contrib/post-merge-hook new file mode 100755 index 00000000..fa9ab5b6 --- /dev/null +++ b/contrib/post-merge-hook @@ -0,0 +1,44 @@ +#!/bin/sh +# +# git post-merge hook, used by propellor's author to maintain a +# joeyconfig branch with some changes while being able to merge +# between it and branches without the changes. +# +# Each time this hook is run, it checks if it's on a branch with +# name ending in "config". If so, config.hs is pointed at $branch.hs +# and privdata/relocate is written to make files in privdata/.$branch/ be +# used. +# +# Otherwise, config.hs is pointed at config-simple.hs, and +# privdata/relocate is removed. + +set -e + +commit () { + if [ -n "$(git status --short privdata/relocate config.hs)" ]; then + git commit privdata/relocate config.hs -m "$1" + fi +} + +branch="$(git symbolic-ref --short HEAD)" +case "$branch" in + "") + true + ;; + *config) + ln -sf "$branch".hs config.hs + git add config.hs + echo ".$branch" > privdata/relocate + git add privdata/relocate + commit "setting up $branch after merge" + ;; + *) + ln -sf config-simple.hs config.hs + git add config.hs + if [ -e privdata/relocate ]; then + rm -f privdata/relocate + git rm --quiet privdata/relocate + fi + commit "clean up after merge" + ;; +esac |
