summaryrefslogtreecommitdiffstats
path: root/ug-patch
blob: 24778bceccb935818332dce6b1c4c1aca7e6128b (plain)
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
#! /bin/sh

set -e

## parse options ## {{{1
UG_OPTIONS_SPEC="\
ug patch [patchrev]*
--
"

. "$UG_EXEC_PATH/uglib.sh"

while test $# != 0; do
	case "$1" in
	--)
		shift; break
		;;
	esac
	shift
done

#}}}

# $@ contains the patch commits to show
# default to HEAD if nothing is given
if test "$#" = "0"; then
	set -- HEAD
fi

for patch do
	is_ugish "$patch" || continue # XXX: die?  warn?
	patchrev=$(git rev-parse --verify "$1")
	exported=$(export_rev "$patchrev")
	echo $exported
	git format-patch --stdout "$exported^..$exported"
done