The sound distributed version control system

#869 Feature Idea: Something like a "force push"

Opened by ryanbooker on January 17, 2024
ryanbooker on January 17, 2024

Sometimes you may need/want to force a remote to match the local. In something like git this is captured by git push --force. It’s dangerous and shouldn’t be something you’re doing all the time, but it can be useful…

Has any thought been given to such a command in pijul?

Currently, if you have a remote already, but decide to unrecorded or amend something, the remote won’t reflect this unless you manually make the same changes there.

This can result in a strange repo full of duplicates: see this example repo and this comment on Zulip.

pmeunier on February 8, 2024

Yes, this should be added to the “metadata” part of the hashed part of patches. Currently that part isn’t used for anything, but it is a free-form Vec<u8>. Following the same convention as for the unhashed part, we could interpret it as json, and add a “replaces” key to mean “this patch replaces the patch with hash h”.

The semantics would be as follows: when applying this patch, Pijul would first try to unrecord the “replaced” patch. If that patch has dependents, fail. Else, unrecord, and then record the patch.

This should be added to libpijul::apply, probably not very hard (but still, libpijul isn’t exactly easy).