Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repatching doesn't work for iterative patches #55

Closed
mahaase opened this issue Jan 25, 2021 · 1 comment
Closed

repatching doesn't work for iterative patches #55

mahaase opened this issue Jan 25, 2021 · 1 comment

Comments

@mahaase
Copy link
Contributor

mahaase commented Jan 25, 2021

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?!

@jkloetzke
Copy link
Member

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

jkloetzke added a commit to jkloetzke/basement that referenced this issue Mar 10, 2024
Each applied patch is tracked individually. This has the benefit of
being able to handle situations where multiple patches touch the same
file.

Also remove the check if the patch is still applied. This proved to be
unreliable, especially if multiple patches touch the same file. We now
solely rely on the tracked applied patches and compare them to the
desired ones. If they match, the class will assume the patch is still
applied.

Fixes BobBuildTool#55. Fixes BobBuildTool#180.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants