bf760f
#!/bin/bash
bf760f
bf760f
if [ $# -ne 2 ] ; then
bf760f
    echo "Usage:"
bf760f
    echo "   $0 <git-dir> <base-tag>"
bf760f
    exit 1
bf760f
fi
bf760f
bf760f
git_dir="$1"
bf760f
base_tag="$2"
bf760f
bf760f
target_dir="$(pwd)"
bf760f
bf760f
pushd "$git_dir" >/dev/null
bf760f
git format-patch -k -o "$target_dir" "$base_tag" >/dev/null
bf760f
popd >/dev/null
bf760f
bf760f
echo "# Patches exported from source git"
bf760f
bf760f
i=1
bf760f
for p in *.patch ; do
bf760f
    printf "# "
bf760f
    sed '/^Subject:/{s/^Subject: //;p};d' "$p"
bf760f
    printf "Patch%s: %s\n" $i "$p"
bf760f
    i=$(($i + 1))
bf760f
done