First pass at sequential commit numbers.
[git-central.git] / client / post-checkout-rebase
1 #!/bin/bash
2
3 # The hook is given three parameters: the ref of the previous HEAD, the ref of
4 # the new HEAD (which may or may not have changed), and a flag indicating
5 # whether the checkout was a branch checkout (changing branches, flag=1) or a
6 # file checkout (retrieving a file from the index, flag=0).
7
8 branch=$(git symbolic-ref HEAD 2>/dev/null)
9 if [[ $? -ne 0 ]] ; then
10         exit 0
11 fi
12
13 branch=${branch/refs\/heads\//}
14
15 git config --list | grep "branch.${branch}.rebase" > /dev/null
16 if [ $? -ne 0 ] ; then
17         git config --add "branch.${branch}.rebase" true
18 fi