Update rebuildPatches to ignore git version string.

This commit is contained in:
Aikar 2013-01-21 21:46:26 -05:00 committed by md_5
parent 17af62c898
commit 41b7c5f465

View file

@ -5,8 +5,16 @@ echo "Rebuilding patch files from current fork state..."
function cleanupPatches { function cleanupPatches {
cd $1 cd $1
for patch in *.patch; do for patch in *.patch; do
lines=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)" | wc -l) gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
if [ "$lines" == "0" ] ; then diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)")
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
if [ "x$testver" != "x" ]; then
diffs=$(echo "$diffs" | head -n -2)
fi
if [ "x$diffs" == "x" ] ; then
git reset HEAD $patch >/dev/null git reset HEAD $patch >/dev/null
git checkout -- $patch >/dev/null git checkout -- $patch >/dev/null
fi fi