From 9556734c02a0b05764e83419ae72710908419cdc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 7 Mar 2016 18:20:31 -0400 Subject: got tired of needing to cherry-pick changes into joeyconfig, wrote a hook So, when I merge some branch into joeyconfig, config.hs will automatically be updated to point to joeyconfig.hs again, even if the merge changes it. And, when I merge joeyconfig into master, config.hs will be pointed back to config-simple.hs This may also be useful for others who maintain a branch like joeyconfig. --- contrib/post-checkout-hook | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 contrib/post-checkout-hook (limited to 'contrib') diff --git a/contrib/post-checkout-hook b/contrib/post-checkout-hook new file mode 100755 index 00000000..38998398 --- /dev/null +++ b/contrib/post-checkout-hook @@ -0,0 +1,28 @@ +#!/bin/sh +# +# git post-checkout hook, used by propellor's author to maintain a +# joeyconfig branch where config.hs is a symlink to joeyconfig.hs +# +# 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 +# Otherwise, config.hs is pointed at config-simple.hs +# + +set -e +prevhead="$1" +newhead="$2" +branchcheckout="$3" +if [ "$branchcheckout" != 0 ]; then + branch="$(git symbolic-ref --short HEAD)" + case "$branch" in + "") + true + ;; + *config) + ln -sf "$branch".hs config.hs + ;; + *) + ln -sf config-simple.hs config.hs + ;; + esac +fi -- cgit v1.2.3