From 1a6cfbcf91f63379c15e328a44bb80996dff590a Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Sun, 17 Jul 2022 01:21:37 +0800 Subject: Update 'Collaborators' --- Collaborators.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Collaborators.md diff --git a/Collaborators.md b/Collaborators.md new file mode 100644 index 0000000..200259e --- /dev/null +++ b/Collaborators.md @@ -0,0 +1,19 @@ +Some random notes about federated collaborators that I wrote: + +The goal of federated collaborators is to add a remote user as a collaborator to a repository. This is mainly difficult because the collaborator will only be able to modify the repository on their remote instance (unless we do some SSO wizardry), so changes must be synchronized between the copies on the two instances. + +## Why do we need federated collaborators? +One "solution" to this problem would be to simply not implement federated collaborators. Then the collaborators for a repo can only be users on the same instance as the repo. This is very inconvenient because if you are a maintainer of two projects on different instances, you will have to create two accounts to be a collaborator on both projects, which is contrary to the federation goal of using one account across all instances. For a concrete example of this, I would like to eventually collaborate on the ForgeFed Codeberg repo using my account on git.exozy.me instead of my Codeberg account. + +## Why exactly is this so difficult? +Here's an example scenario. Alice runs a Gitea instance at alice.com and Bobert runs a Gitea instance at bobert.com. Alice adds Bobert as a collaborator to her https://alice.com/Alice/Hello-world repo. Bobert can now access the repo on his instance at https://bobert.com/Alice@alice.com/Hello-world. If Bobert modifies his copy of the repo by, for instance, changing the repository description, then this must be synced back to Alice's instance. This would require a lot of code for handling each repo setting that can be modified, and we would need to create a format for syncing these changes. + +For synchronizing code, there are several methods we could use here, since we really don't want sync conflicts and changes to be overwritten. +1. All copies force push to the main copy upon receiving commits, and the main copy force pushes to all other copies upon receiving commits. This can cause changes to be overwritten when two people push to different copies simultaneously, which is bad. +2. When pushing to a copy, the copy first pulls from the main copy. +3. When pushing to a copy, the copy is not modified and the push is redirected to the main copy using Git. The main copy force pushes to all other copies. +4. When pushing to a copy, the copy is not modified and the push is redirected to the main copy using [ForgeFed](https://forgefed.org/behavior.html#reporting-pushed-commits). The main copy force pushes to all other copies. +5. The copies display the main copy's clone URL, so all Git operations only go to the main copy. This requires some work to be able to authenticate a push by a user from another instance. The main copy force pushes to all other copies. + +## Sync conflicts +I don't think sync conflicts are actually a big issue here, since the main repo at alice.com is always correct, and when it receives a sync update, it pushes out the update to all other copies, which keeps everything in sync. For example, if both Alice and Bobert modified the description at the same time, Alice's instance would first send out Alice's modification, then receive Bobert's modification and send it out to all copies. At the end, all copies now contain Bobert's modifications. Alice's modification is overwritten, but all copies are consistent. \ No newline at end of file -- cgit v1.2.3-70-g09d2