3 # Copyright (c) Josef "Jeff" Sipek, 2008-2011
6 USAGE
="-n <num> | -a | --all"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking $GUILT directly is no longer supported." >&2
22 [ "$2" -lt 0 ] && die
"Must specify a number of patches to commit"
23 [ "$2" -eq 0 ] && exit 0
26 pat_keep
="`expr "$2" + 1`,\$p"
33 # if nothing's applied, exit
34 [ `wc -l < "$applied"` -eq 0 ] && exit 0
36 # remove patch refs for what's being committed, and update series
37 sed -n -e "${pat_commit}" "$applied" |
while read pname
; do
38 series_remove_patch
"$pname"
39 echo "$pname" | remove_patch_refs
42 # update $applied to include only the patches we're keeping
43 sed -n -e "${pat_keep}" "$applied" > "$applied.tmp"
44 mv "$applied.tmp" "$applied"