423fb66fd0ffb3a7e550312af426c0ff105b38bd
[git-central.git] / client / post-checkout-rebase
1 #!/bin/sh
2
3 # $1 = previous hash
4 # $2 = new hash (could be the same)
5 # $3 = flag (0=retreiving from index, 1=new checkout)
6
7 branch=$(git symbolic-ref --quiet HEAD)
8 if [[ $? -ne 0 ]] ; then
9         exit 0
10 fi
11
12 branch=${branch/refs\/heads\//}
13
14 rebase=$(git config "branch.${branch}.rebase")
15 if [ $? -ne 0 ] ; then
16         git config "branch.${branch}.rebase" "true"
17 fi
18
19 merge=$(git config "branch.${branch}.merge")
20 remote=$(git config "branch.${branch}.remote")
21 if [ "$branch" != "stable" -a "$remote" == "origin" -a "$merge" == "refs/heads/stable" ] ; then
22         git config "branch.${branch}.merge" "refs/heads/${branch}"
23 fi
24
25 exit 0
26