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

Large anki decks result in merge conflicts due to poor git diff #34

Open
Supratentorial opened this issue Nov 25, 2018 · 7 comments
Open

Comments

@Supratentorial
Copy link

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.

@Stvad
Copy link
Owner

Stvad commented Nov 27, 2018

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?

@Supratentorial
Copy link
Author

I haven't checked but we both use VS code on Windows. Adding the manual line breaks resolved the conflicts for me.

@Supratentorial
Copy link
Author

I'm still having huge issues with merge conflicts even with the added line breaks. Are the crowdanki_uuid supposed to match between decks?

@Stvad
Copy link
Owner

Stvad commented Dec 27, 2018

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

@kevincar
Copy link

kevincar commented May 9, 2019

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.

@Supratentorial
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants