BobBuildTool/basement

repatching doesn't work for iterative patches

Closed this issue · 1 comments

if the order of patchfiles is relevant, the revert patching doesn't work:

# Skip if series is already applied. Otherwise try to remove old series if
# it does not match.
name=".applied$name"
if [ -e "$name" ] ; then
if cmp <( for (( idx=$# ; idx>0 ; idx-- )) ; do cat "${@:$idx:1}" ; done ) "$name" ; then
# The patch is allegedly applied and was not changed. Check if
# it is still applied as expected...
if patch -p $p -F 0 -Rfs --dry-run < "$name" ; then
return
fi
echo "Patch was (partially) squashed? Trying to recover..." >&2
fi
# Remove old patch
patch -p $p -F 0 -Rf < "$name" || true
rm "$name"
fi
for i in "$@" ; do
patch -p $p -F 0 -f < $i
touch "$name"
cat $i "$name" > "$name".new
mv "$name".new "$name"
done

I guess, we have to write the patches in reverted order into the .applied file?!

Actually I wanted to properly solve this issue by BobBuildTool/bob#347. The whole patch class is a stop-gap solution...