Remove 'dash' commands and install os.* files
[guilt/mob.git] / guilt-branch
blob909f740926b58454e61b736b6b61f0f86d635dc3
1 #!/bin/sh
3 # Copyright (c) Josef "Jeff" Sipek, 2007-2011
6 USAGE="[<new_name>]"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename $0` directly is no longer supported." >&2
9 exit 1
12 if [ $# -gt 1 ]; then
13 usage
16 _main() {
18 # make sure that there are no unapplied changes
19 if ! must_commit_first; then
20 die "Uncommited changes detected. Refresh first."
23 if [ $# -eq 0 ]; then
24 newbranch="$branch-`date +%Y-%m-%d`"
25 else
26 newbranch="$1"
29 if [ -e "$GUILT_DIR/$newbranch" ]; then
30 die "Patch directory for branch \"$newbranch\" already exists."
33 cat "$applied" | while read n; do
34 git update-ref "refs/patches/$newbranch/$n" \
35 `git rev-parse "refs/patches/$branch/$n"` ""
36 done
38 git branch "$newbranch"
39 git checkout "$newbranch"
41 mkdir -p "$GUILT_DIR/`dirname $newbranch`"
43 # copy the patch dir
44 cp_a "$GUILT_DIR/$branch" "$GUILT_DIR/$newbranch"
46 # copy the refs