mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 02:47:44 +01:00
96f8b1af6c
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
41 lines
880 B
Bash
Executable File
41 lines
880 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
(
|
|
set -e
|
|
PS1="$"
|
|
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
|
|
update CraftBukkit
|
|
update Spigot
|
|
|
|
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
|
|
)
|