Improve upstream merge script to rebuild patches

this will help ensure that upstreams apply as cleanly as it does manually

the filtering makes the patches more fragile, but usually not an issue for small updates.

this will unfilter, apply the cleanest patches, then the next rebuild will
filter out unnecessary changes
This commit is contained in:
Aikar 2019-04-02 23:20:10 -04:00
parent 747e70a90d
commit 96f8b1af6c
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
2 changed files with 22 additions and 2 deletions

View file

@ -8,7 +8,10 @@ source "$basedir/scripts/functions.sh"
gitcmd="git -c commit.gpgsign=false -c core.safecrlf=false"
echo "Rebuilding patch files from current fork state..."
nofilter="0"
if [ "$2" = "nofilter" ]; then
nofilter="1"
fi
function cleanupPatches {
cd "$1"
for patch in *.patch; do
@ -56,7 +59,9 @@ function savePatches {
$gitcmd format-patch --no-stat -N -o "$basedir/${what_name}-Patches/" upstream/upstream >/dev/null
cd "$basedir"
$gitcmd add -A "$basedir/${what_name}-Patches"
cleanupPatches "$basedir/${what_name}-Patches"
if [ "$nofilter" == "0" ]; then
cleanupPatches "$basedir/${what_name}-Patches"
fi
echo " Patches saved for $what to $what_name-Patches/"
}