patchbomb: added --git option
[guilt.git] / guilt-init
blob6e417a65f808c0d8813dc5b1e30346b49d34d051
1 #!/bin/sh
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 DO_NOT_CHECK_BRANCH_EXISTENCE=1
8 USAGE="[-n | -a]"
9 . `dirname $0`/guilt
11 while case $# in 0) break ;; esac; do
12 case $1 in
13 -n)
14 req_autotag=0
16 -a)
17 req_autotag=1
20 usage
22 esac
23 shift
24 done
26 if [ -d "$GUILT_DIR/$branch" ]; then
27 die "Branch $branch appears to be already initialized (GIT_DIR=$GIT_DIR)"
30 [ ! -d "$GUILT_DIR" ] && mkdir "$GUILT_DIR"
31 mkdir -p "$GUILT_DIR/$branch"
32 touch "$GUILT_DIR/$branch/series"
33 touch "$GUILT_DIR/$branch/status"
35 mkdir -p "$GIT_DIR/hooks/guilt"
36 cat > "$GIT_DIR/hooks/guilt/delete" <<EOF
37 #!/bin/sh
38 # Usage: <script> <patch being removed>
40 echo "Removing patch '\$1'..."
41 EOF
43 # if there's no guilt.autotag config, set it to default
44 cur=`git config --int --get guilt.autotag`
45 if [ -z "$cur" -o ! -z "$req_autotag" ]; then
46 [ -z "$req_autotag" ] && req_autotag=$AUTOTAG_DEFAULT
48 git config --int --replace-all guilt.autotag $req_autotag