3 # Copyright (c) Josef "Jeff" Sipek, 2007
6 USAGE
="[<hash> | <since>..[<until>] | ..<until>]"
9 if [ $# -ne 1 ] ||
[ -z "$1" ]; then
10 die
"You must specify a range of commits"
13 rhash
=`munge_hash_range $1`
15 # make sure that there are no unapplied changes
16 if ! must_commit_first
; then
17 die
"Uncommited changes detected. Refresh first."
20 echo "About to begin conversion..." >&2
21 echo "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2
23 for rev in `git rev-list $rhash`; do
24 s
=`git log --pretty=oneline -1 $rev | cut -c 42-`
26 fname
=`echo $s | sed -e "s/&/and/g" -e "s/[ :]/_/g" -e "s,[/\\],-,g" \
27 -e "s/['\\[{}]//g" -e 's/]//g' | tr A-Z a-z`
29 echo "Converting `echo $rev | cut -c 1-8` as $fname"
33 while [ -f "$GUILT_DIR/$branch/$fname" ]; do
34 fname
="$fname_base-$mangle_prefix"
35 mangle_prefix
=`expr $mangle_prefix + 1`
36 echo "Patch under that name exists...trying '$fname'"
43 ) > $GUILT_DIR/$branch/$fname
45 # FIXME: grab the GIT_AUTHOR_DATE from the commit object and set the
46 # timestamp on the patch
48 # insert the patch name into the series file
49 series_insert_patch
$fname
51 # Only reset if the commit was on this branch
52 if head_check
$rev 2> /dev
/null
; then
53 # BEWARE: "git reset" ahead! Is there a way to verify that
54 # we really created a patch? - We don't want to lose any
56 git
reset --hard $rev^
> /dev
/null
57 elif [ -z "$warned" ]; then
58 echo "Warning: commit $rev is not the HEAD...preserving commit" >&2
59 echo "Warning: (this message is displayed only once)" >&2
65 echo "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2