Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 58 lines (47 sloc) 1.031 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#

USAGE="[-e] [<patchname>]"
. `dirname $0`/guilt

case $# in
0)
patch=`get_top`
;;
1)
if [ "$1" = "-e" ]; then
edit=t
patch=`get_top`
else
patch="$1"
fi
;;
2)
[ "$1" != "-e" ] && usage

edit=t
patch="$2"

;;
esac

# are there any patches applied?
[ -z "$patch" ] && die "No patches applied."

# check that patch exists in the series
ret=`get_full_series | grep -e "^$patch\$" | wc -l`
if [ $ret -eq 0 ]; then
die "Patch $patch is not in the series"
fi

# FIXME: warn if we're editing an applied patch

TMP_MSG=`get_tmp_file msg`
TMP_DIFF=`get_tmp_file diff`

if [ -z "$edit" ]; then
do_get_header "$GUILT_DIR/$branch/$patch"
else
do_get_full_header "$GUILT_DIR/$branch/$patch" > "$TMP_MSG"
do_get_patch "$GUILT_DIR/$branch/$patch" > "$TMP_DIFF"
git_editor "$TMP_MSG"
mv "$GUILT_DIR/$branch/$patch" "$GUILT_DIR/$branch/$patch~"

(
cat "$TMP_MSG"
cat "$TMP_DIFF"
) > "$GUILT_DIR/$branch/$patch"
fi

rm -f "$TMP_MSG" "$TMP_DIFF"
Something went wrong with that request. Please try again.