blob: a5e4f8bb8bff77ea80d020ebfcc620441b97f5c1 (
plain) (
tree)
|
|
#!/bin/bash
set -eu
fail() {
printf "%s\n" "$1" >>/dev/stderr
exit 32
}
[ "$#" -lt 1 ] && exit 64
IDSstr="$(git log --format="%H" "$1" 2>/dev/null)"
mapfile -t IDS <<< "$IDSstr"
for id in "${IDS[@]}" ; do
PATCH="$(git format-patch -1 --stdout "${id}")"
FN="$(echo "$PATCH" | git interpret-trailers --parse | awk '/^Patch: / {print $2}')"
[ -z "$FN" ] && fail "Patch filename not defined"
printf "%s" "$PATCH" > "$FN"
done
|