#! /bin/sh

# Base tag
BASE=

# Patch tags
declare -a PATCHS=(
)

BASE_refs="refs/tags/$BASE"
declare -a PATCHS_refs=(
	`for I in ${PATCHS[@]}; do echo refs/tags/$I; done`
)

CreatePatch()
{
	# $1 -- tag for patch name
	# Use $BASE

	echo git-diff "$BASE" "$1" "-- >" "$1"
	git-diff "$BASE" "$1" -- > "$1"
	echo git-add "$1"
	git-add "$1"
}

echo git-merge -s ours --no-commit \
		'"'git-merge -s ours HEAD $BASE_refs ${PATCHS_refs[@]}'"' \
		HEAD $BASE_refs ${PATCHS_refs[@]}
git-merge -s ours --no-commit \
		"git-merge -s ours HEAD $BASE_refs ${PATCHS_refs[@]}" \
		HEAD $BASE_refs ${PATCHS_refs[@]}

echo git-rm *.patch
git-rm *.patch
echo rm -f *.patch
rm -f *.patch

for n in ${PATCHS[@]}
do
	CreatePatch "$n"
done

echo git-commit -a -m '"Use .git2patch/git2patch.sh ..."'
git-commit -a -m "Use .git2patch/git2patch.sh

BASE=$BASE

PATCHS:`for I in ${PATCHS[@]}; do echo -n -e \\\\n\\\\t $I; done`"
