[PATCH] guilt-header: Add -e option for editing
[guilt/mob.git] / guilt-branch
blob8bacfc37ee75d9abe78f712940a308be090950a9
1 #!/bin/sh
3 # Copyright (c) Josef "Jeff" Sipek, 2007
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 git-branch "$newbranch"
29 git-checkout "$newbranch"
31 mkdir -p "$GUILT_DIR/`dirname $newbranch`"
33 # copy the patch
34 cp -a "$GUILT_DIR/$branch" "$GUILT_DIR/$newbranch"