filter-branch is deprecated according to the official git documentation. They recommend using filter-repo instead, which is an external tool that can be used as a git plugin.
The resulting command is more readable, and the process takes much less time (a few seconds instead of 12 hours). It also fixes the issue encountered with the current script not being able to handle whitespaces (see D14143 for an alternative fix to this issue).
Note that the history rewritten by the previous script does not rebase properly on this newly rewritten history.
To make it work, I had to rewrite the entire history of the remote secp256k1 repository:
- run the script a first time by inserting a exit 0 line just before git pull github master --rebase
- force push the result of the newly created local secp256k1 to the remote github repository
This needs to be done only once.