[PATCH] guilt: add option guilt.diffstat
[guilt/mob.git] / guilt-branch
blob125bb1a1517b93ccc12c553ec2706ce76480debc
1 #!/bin/sh
3 # Copyright (c) Josef "Jeff" Sipek, 2007-2008
6 USAGE="[<new_name>]"
7 . `dirname $0`/guilt
9 if [ $# -gt 1 ]; then
10 usage
13 # make sure that there are no unapplied changes
14 if ! must_commit_first; then
15 die "Uncommited changes detected. Refresh first."
18 if [ $# -eq 0 ]; then
19 newbranch="$branch-`date +%Y-%m-%d`"
20 else
21 newbranch="$1"
24 if [ -e "$GUILT_DIR/$newbranch" ]; then
25 die "Patch directory for branch \"$newbranch\" already exists."
28 cat "$applied" | while read n; do
29 git update-ref "refs/patches/$newbranch/$n" \
30 `git rev-parse "refs/patches/$branch/$n"` ""
31 done
33 git branch "$newbranch"
34 git checkout "$newbranch"
36 mkdir -p "$GUILT_DIR/`dirname $newbranch`"
38 # copy the patch dir
39 cp -a "$GUILT_DIR/$branch" "$GUILT_DIR/$newbranch"
41 # copy the refs