enhance: only load repository settings if file exists

This commit is contained in:
leo 2024-07-02 14:17:21 +08:00
parent 21ec16b4cc
commit 50fe25a631
No known key found for this signature in database

View file

@ -268,6 +268,8 @@ namespace SourceGit.ViewModels
public void Open()
{
var settingsFile = Path.Combine(_gitDir, "sourcegit.settings");
if (File.Exists(settingsFile))
{
try
{
_settings = JsonSerializer.Deserialize(File.ReadAllText(settingsFile), JsonCodeGen.Default.RepositorySettings);
@ -276,6 +278,11 @@ namespace SourceGit.ViewModels
{
_settings = new RepositorySettings();
}
}
else
{
_settings = new RepositorySettings();
}
_watcher = new Models.Watcher(this);
_histories = new Histories(this);