3 # Copyright (c) Josef "Jeff" Sipek, 2007
6 USAGE
="[-P <patch> ] <patch_file>"
15 newname
=`dirname "$1"`
20 if [ $# -lt 1 -o $# -gt 3 -o -z "$newname" -o -z "$oldname" ]; then
24 # make sure that there are no unapplied changes
25 if ! must_commit_first
; then
26 die
"Uncommited changes detected. Refresh first."
29 if [ ! -e "$oldname" ]; then
30 die
"Specified file does not exist."
33 if [ -e "$GUILT_DIR/$branch/$newname" ]; then
34 die
"Already tracking a patch under that name."
37 # create any directories as needed
38 mkdir_dir
=`dirname "$GUILT_DIR/$branch/$newname"`
39 [ "$mkdir_dir" != "$GUILT_DIR/$branch" ] && mkdir
-p "$mkdir_dir"
41 cp "$oldname" "$GUILT_DIR/$branch/$newname"
43 # insert the patch into the series file
44 series_insert_patch
"$newname"