feature: remember the Include Untracked Files toggle state in local changes

This commit is contained in:
leo 2024-12-18 17:30:04 +08:00
parent 5ec8279d38
commit 31ad317a57
No known key found for this signature in database
2 changed files with 13 additions and 4 deletions

View file

@ -14,6 +14,12 @@ namespace SourceGit.Models
set; set;
} = string.Empty; } = string.Empty;
public bool IncludeUntrackedInLocalChanges
{
get;
set;
} = true;
public DealWithLocalChanges DealWithLocalChangesOnCheckoutBranch public DealWithLocalChanges DealWithLocalChangesOnCheckoutBranch
{ {
get; get;

View file

@ -206,13 +206,17 @@ namespace SourceGit.ViewModels
public bool IncludeUntracked public bool IncludeUntracked
{ {
get => _includeUntracked; get => _settings.IncludeUntrackedInLocalChanges;
set set
{ {
if (SetProperty(ref _includeUntracked, value)) if (value != _settings.IncludeUntrackedInLocalChanges)
{
_settings.IncludeUntrackedInLocalChanges = value;
OnPropertyChanged();
Task.Run(RefreshWorkingCopyChanges); Task.Run(RefreshWorkingCopyChanges);
} }
} }
}
public bool IsSearching public bool IsSearching
{ {
@ -918,7 +922,7 @@ namespace SourceGit.ViewModels
public void RefreshWorkingCopyChanges() public void RefreshWorkingCopyChanges()
{ {
var changes = new Commands.QueryLocalChanges(_fullpath, _includeUntracked).Result(); var changes = new Commands.QueryLocalChanges(_fullpath, _settings.IncludeUntrackedInLocalChanges).Result();
if (_workingCopy == null) if (_workingCopy == null)
return; return;
@ -2299,7 +2303,6 @@ namespace SourceGit.ViewModels
private List<Models.Submodule> _submodules = new List<Models.Submodule>(); private List<Models.Submodule> _submodules = new List<Models.Submodule>();
private List<Models.Submodule> _visibleSubmodules = new List<Models.Submodule>(); private List<Models.Submodule> _visibleSubmodules = new List<Models.Submodule>();
private bool _includeUntracked = true;
private Models.Commit _searchResultSelectedCommit = null; private Models.Commit _searchResultSelectedCommit = null;
private Timer _autoFetchTimer = null; private Timer _autoFetchTimer = null;
private DateTime _lastFetchTime = DateTime.MinValue; private DateTime _lastFetchTime = DateTime.MinValue;