Open Supratentorial opened 6 years ago
Hey, thanks, this shouldn't be hard to try (if python json module supports something like that). I find it a bit weird. Do you and your collaborator use same platform/line endings?
I haven't checked but we both use VS code on Windows. Adding the manual line breaks resolved the conflicts for me.
I'm still having huge issues with merge conflicts even with the added line breaks. Are the crowdanki_uuid supposed to match between decks?
Not sure I understand the last question properly. What do you mean by between decks?
crowdanki_uuid is supposed to be a unique identifier of an object. It's created on the first export of the deck for all relevant objects
One more beneficial modification that may be related to this issue could be to create a setting that allows CrowdAnki to export large decks that contain many subdecks into directories and corresponding subdirectories, as opposed to one large JSON file for the entire deck. Perhaps even a single JSON file for each card and its associated notes.
This could also allow for more fine-tuned control over individual commits. While CrowdAnki will export all the current changes made to the exported deck, the user would be able to hand select which changes are ready to be pushed out to the rest of the collaborating team, by only adding the desired card/notes/decks to the stage for commit.
I also thought that splitting the cards out into individual json files may resolve the issue, but I'm not sure how this will affect the performance of Git.
I think the use case of collaborative decks is not an uncommon one. I feel the only real long term solution to this is for an update to AnkiWeb.
Steps to reproduce: Have two people independently edit the shared deck and attempt to commit. My deck size is ~7000 cards.
Expected result: Git should be able to merge without conflicts unless the same card/model/media has been edited by both people. Actual result: Git has a lot of difficulty combining large JSON files, with a large number of merge conflicts that Git can't resolve automatically. This occurs even if two different cards are edited. I am not the first person to run into this issue (albeit in a different context), and it seems to be an issue with git not being able to diff large JSON files properly. Proposed solution: Issue can be resolved if line breaks are added between objects in a JSON array as described in this Stack Overflow post. Suggest that when exporting using CrowdAnki add line breaks between objects in the notes array.