feat: even more fancy log messages

This commit is contained in:
ptrcnull 2022-07-30 02:40:01 +02:00
parent a85bf4c080
commit 4e824d06f5

33
apatch
View file

@ -71,25 +71,32 @@ if [ -f "$patch" ]; then
fi fi
( (
cd "$builddir" cd "$builddir"
git init git init
git add . git add .
git commit -m "$pkgver" >/dev/null git commit -m "$pkgver" >/dev/null
# if file exists, try to apply # if file exists, try to apply
if [ -e "$patchpath" ]; then if [ -e "$patchpath" ]; then
git apply --reject --whitespace=fix "$patchpath" || { git apply --reject --whitespace=fix "$patchpath" || {
git status --porcelain | grep '\?\? .*\.rej$' | cut -c4- | while read -r reject; do rejects="$(git status --porcelain | grep '\?\? .*\.rej$' | cut -c4-)"
target="${reject%.rej}" if [ -n "$rejects" ]; then
echo "[*] trying to wiggle $target" warning "$patch partially applied with rejects"
wiggle --merge --replace "$target" "$reject" || { for reject in $rejects; do
echo "[!] could not merge $target, fix manually" target="${reject%.rej}"
} msg "trying to wiggle $target"
rm "$reject" wiggle --merge --replace "$target" "$reject" || {
rm "$target.porig" # left by wiggle warning "could not merge $target, fix manually"
done }
rm "$reject"
rm "$target.porig" # left by wiggle
done
else
warning "$patch failed to apply"
fi
} }
fi fi
msg "you can edit now!"
$SHELL $SHELL