diff options
author | Aikar <[email protected]> | 2019-04-02 23:20:10 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2019-04-02 23:25:48 -0400 |
commit | 96f8b1af6c4e06d91b82fe624cccf410a3427f99 (patch) | |
tree | 20c05057dab45478bdc6000433904cea2db97b15 /scripts | |
parent | 747e70a90df4215742343270a40bf467c65bd8f6 (diff) | |
download | Paper-96f8b1af6c4e06d91b82fe624cccf410a3427f99.tar.gz Paper-96f8b1af6c4e06d91b82fe624cccf410a3427f99.zip |
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
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rebuildPatches.sh | 9 | ||||
-rwxr-xr-x | scripts/upstreamMerge.sh | 15 |
2 files changed, 22 insertions, 2 deletions
diff --git a/scripts/rebuildPatches.sh b/scripts/rebuildPatches.sh index a065d6ce59..b89ee69f50 100755 --- a/scripts/rebuildPatches.sh +++ b/scripts/rebuildPatches.sh @@ -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/" } diff --git a/scripts/upstreamMerge.sh b/scripts/upstreamMerge.sh index a54b7c10eb..d59a8b442d 100755 --- a/scripts/upstreamMerge.sh +++ b/scripts/upstreamMerge.sh @@ -7,11 +7,21 @@ basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" gitcmd="git -c commit.gpgsign=false" +updated="0" +function getRef { + git ls-tree $1 $2 | cut -d' ' -f3 | cut -f1 +} function update { cd "$workdir/$1" $gitcmd fetch && $gitcmd clean -fd && $gitcmd reset --hard origin/master + refRemote=$(git rev-parse HEAD) cd ../ $gitcmd add $1 + refHEAD=$(getRef HEAD "$workdir/$1") + echo "$1 $refHEAD - $refRemote" + if [ "$refHEAD" != "$refRemote" ]; then + export updated="1" + fi } update Bukkit @@ -22,4 +32,9 @@ if [[ "$2" = "all" || "$2" = "a" ]] ; then update BuildData update Paperclip fi +if [ "$updated" == "1" ]; then + echo "Rebuilding patches without filtering to improve apply ability" + cd "$basedir" + scripts/rebuildPatches.sh "$basedir" nofilter 1>/dev/null|| exit 1 +fi ) |