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