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