summaryrefslogtreecommitdiff
path: root/contrib/post-checkout-hook
blob: 3899839872714e19257914d33d7487f8649cf203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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