damionx7 / Zettel-Notes-Documentation

Documentation for Zettel Notes : Markdown Note Taking application for android devices
https://znotes.thedoc.eu.org/
GNU General Public License v3.0
55 stars 5 forks source link

[Bug] GitHub Synchronization Overwriting Commits From Other Devices #29

Closed KTSCode closed 1 month ago

KTSCode commented 1 year ago

When I make changes to my notes on my laptop, commit the changes and push them up, they are overwritten the next time that Zettel Notes Syncs.

This is the commit log of me deleting a file on my laptop committing the deletion, pushing it up, and then Syncing Zettel Notes and it putting the file back, I deleted the file 3 times and every time I pulled changes down after Zettel synced and the file was back.

Screenshot 2023-07-14 at 12 12 41 PM
KTSCode commented 1 year ago

After more research I've found that the issue seems to be the app merging it's local version of origin/main with the branch without actually fetching the remote origin/main so it's delete commits that weren't made by the Zettel Notes app

KTSCode commented 1 year ago

Looks like the issue was coming from the git submodule in the repo. Once I removed the submodule the weird root author merge commit stopped overwritting changes that I made on other devices.

damionx7 commented 1 year ago

Hey. Is this issue resolved ?

KTSCode commented 1 year ago

I'm still having the issue whenever I try to use git repos with submodules.

damionx7 commented 1 year ago

I have added this issue in my to-do list. I will fix this.

aamott commented 4 months ago

Adding my experience with this. I do not have submodules. I'm just using Obsidian to edit on my computer and if I edit in Obsidian, then Zettel, then update Zettel, it will overwrite. I reversed the merge and synced Zettel again and it immediately overwrote the changes again. Is it pushing before pulling upon loading the app? I would love it if Zettel ran a git pull whenever it opened a note to avoid conflicts that might cause merge issues later.

This issue seems to have caused another. After a few attempts, I tried to reset the repository and it errored out, Java.lang.NullPointerException: Inflater has been closed. I'll submit that as a separate issue, but I'm putting it here since it seems linked.

slarrain commented 2 months ago

I'm having the same problem. Needless to say, overwriting commits without asking is an unacceptable behavior. It is the same "Merge branch main [...] into main", with an overwriting merge.

I really want to like this App, since it would be almost the only way to use vimwiki with my android phones and tablets, and I could ditch Obsidian, but it can't be overwriting commits.

It is, in my opinion, a BUG that needs to be addressed ASAP, and it looks like it has been around for over a year,

slarrain commented 2 months ago

I can confirm that this happens with the latest Zettel Notes 2.6.9 and I tried with Merge Strategy to most recent changes and default and also with Conflict Resolution to auto and prefer remote changes. It happens in every case. The same that was reported by OP: a merge over writes a commit done outside of Zettel Notes

damionx7 commented 2 months ago

I can confirm that this happens with the latest Zettel Notes 2.6.9 and I tried with Merge Strategy to most recent changes and default and also with Conflict Resolution to auto and prefer remote changes. It happens in every case. The same that was reported by OP: a merge over writes a commit done outside of Zettel Notes

The merge options currently don't work with Git synchronization. I will fix this.

The merge option was chosen as default so as to avoid git conflicts that surface when changes are made on server and client both.

slarrain commented 2 months ago

Thank you for looking into it. Please let me know when you implement a fix so I can test it and report back. I think this is an awesome App -full of features and amazing functionality- but this is a major bug.

damionx7 commented 1 month ago

Thank you for looking into it. Please let me know when you implement a fix so I can test it and report back. I think this is an awesome App -full of features and amazing functionality- but this is a major bug.

I have fixed this issue. Zettel Notes now first tries to rebase on pull and if it fails, it tries using merge strategy, which can be configured via conflict resolution option in synchronization settings (ours vs theirs).

damionx7 commented 1 month ago

You can test the changes in latest version (v2.7.0) updated in my f-droid repository. https://thedoc.eu.org/fdroid/repo.

damionx7 commented 1 month ago

I have also detailed the git synchronization process which Zettel Notes follows in this commmit https://github.com/damionx7/Zettel-Notes-Documentation/commit/c5dce26d3a7ce7a0780e0379df9d0441c0ac02ae

damionx7 commented 1 month ago

Closing due to inactivity and issue being resolved.