feat: even more fancy log messages

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

13
apatch
View file

@ -79,17 +79,24 @@ fi
# 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
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}"
echo "[*] trying to wiggle $target"
msg "trying to wiggle $target"
wiggle --merge --replace "$target" "$reject" || {
echo "[!] could not merge $target, fix manually"
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