Closed ennerperez closed 2 months ago
I've pushed a commit d87716dc8675ea15218fa401b3f48ed628337bd2 to solve this problem. This issue appear when Directory.Exists(repo.FullPath)
returns false for some unknown reason on app startup.
Property Repositories
stores all the managed repositories. Before commit d87716dc8675ea15218fa401b3f48ed628337bd2, it will try to remove those failed with checking Directory.Exists(repo.FullPath)
.
Property RepositoryNodes
stores the structure (as a tree) that you group your repositories. It used by the welcome page. For example, here is mine:
And one more thing, according to the manual of Native AOT deployment overview, it's not recommanded to use System.Linq
in this app (and it will introduce a compile warning).
Please refer to: https://github.com/sourcegit-scm/sourcegit/pull/114
I'll be removing the reference System.Linq according to the AOT limitations
Make sure that your device is properly mounted to the path /run/media/xxxx
when this app starts. There is only one line code can cause this problem - _instance.Repositories.RemoveAll(x => !Directory.Exists(x.FullPath));
Yes I'm 100% sure of this, it's my Main work disk, also this happens to me in macOS the Json get malformed sometimes.
The problem it's not deleting the node from Json file, the problem is having duplicates nodes to save the same information for some reason store data in Repository nodes but not in Repository, you can restore this line cuz is fine, it's not the real problem.
Please take a look at PR 114.
Also take a look to the FS pictures I attached for this issue.
I've test this pr by gh pr checkout 112
and the other one by gh pr checkout 114
. I know exactly what you have changed. As I said before, I do NOT want to merge Repository
into RepositoryNode
, because they are different things that store different informations.
And duplicated node should also work if repository has not been removed from preference. We find the repository by the node's id.
For example, I created two node that both points to the same repository manually. Both work well until the repository has been remove from property Repositories
.
I do NOT think duplicated nodes will be the reason of issue #90.
The problem I found in https://github.com/sourcegit-scm/sourcegit/issues/90 was essentially a difference between "Repositories" and "RepositoryNodes" in some scenarios "Repositories" get an empty list when in other hand "RepositoryNodes" get elements inside, that make visible all repos in the UI but not accessible because it's not present in "Repositories"
This workaround basically copies existing repos from "RepositoryNodes" into Repositories when the user tries to open it, and for some reason this is not in the "Repository" node from the preferences.
I rather to check this Json file, because as far I saw this, looks like there is no need to have two "Repositories" nodes inside same Json file, but for now this is my workaround.