diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index 50530c6a..930b31a3 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -14,6 +14,12 @@ namespace SourceGit.Models set; } = string.Empty; + public bool IncludeUntrackedInLocalChanges + { + get; + set; + } = true; + public DealWithLocalChanges DealWithLocalChangesOnCheckoutBranch { get; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index df6f2e27..66b308b4 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -206,11 +206,15 @@ namespace SourceGit.ViewModels public bool IncludeUntracked { - get => _includeUntracked; + get => _settings.IncludeUntrackedInLocalChanges; set { - if (SetProperty(ref _includeUntracked, value)) + if (value != _settings.IncludeUntrackedInLocalChanges) + { + _settings.IncludeUntrackedInLocalChanges = value; + OnPropertyChanged(); Task.Run(RefreshWorkingCopyChanges); + } } } @@ -918,7 +922,7 @@ namespace SourceGit.ViewModels public void RefreshWorkingCopyChanges() { - var changes = new Commands.QueryLocalChanges(_fullpath, _includeUntracked).Result(); + var changes = new Commands.QueryLocalChanges(_fullpath, _settings.IncludeUntrackedInLocalChanges).Result(); if (_workingCopy == null) return; @@ -2299,7 +2303,6 @@ namespace SourceGit.ViewModels private List _submodules = new List(); private List _visibleSubmodules = new List(); - private bool _includeUntracked = true; private Models.Commit _searchResultSelectedCommit = null; private Timer _autoFetchTimer = null; private DateTime _lastFetchTime = DateTime.MinValue;