sourcegit-scm / sourcegit

Windows/macOS/Linux GUI client for GIT users
MIT License
668 stars 69 forks source link

[ENHANCEMENT] Simplify Duplicated Repository structure in the preferences.json #113

Closed ennerperez closed 2 months ago

ennerperez commented 2 months ago

In order to avoid problems with missing repositories in one of the repositories nodes, I suggest unifying and simplify the process of load and saving repositories in the preferences.json

Probably is a better idea to separate this in a different json file to have better control and more independent configurations per repositories

ennerperez commented 2 months ago

https://github.com/sourcegit-scm/sourcegit/pull/114

love-linger commented 2 months ago

Property Repositories in Preference contains all the managed repositories by this app. It will save extra information, like Filters, CommitMessages, into the final json.

Property RepositoryNodes in Preference show the structure in a tree that you group the repositories above. Each item contains information of a tree node only.

The issue #90 is caused by that before commit d87716dc8675ea15218fa401b3f48ed628337bd2 it will remove repositories those failed checking Directory.Exists(repo.FullPath) for some unknown reason on Linux.

ennerperez commented 2 months ago

Yes, you're right, but there is no need to store both in different nodes inside the Json file, in this PR I store all data in a single parent node, but I read one according to the other that way we can avoid problems like this, it's not only a Linux problem, I face it on Mac too.

love-linger commented 2 months ago

You still don't get my point. RepositoryNode and Repository are two very different structures. The only thing they have in common is that when RepositoryNode points to a Repository, the Id is the same, which is the Repository path.

image

Do you think these should be stored as repositories?

Further, Issue #90 was caused by Repository being removed at startup because Directory.Exists(repo.FullPath) returned false. This is due to the file system (I'm not sure what happened to you there). After my commit, I didn't find any other code that removed repositories.