feat: Add stash auto-restore functionality (#947) (#948)

This commit is contained in:
GadflyFang 2025-02-06 10:31:46 +08:00 committed by GitHub
parent 942f349275
commit 3ca4dc488c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 41 additions and 8 deletions

View file

@ -36,6 +36,12 @@ namespace SourceGit.ViewModels
set => _repo.Settings.KeepIndexWhenStash = value;
}
public bool AutoRestore
{
get => _repo.Settings.AutoRestoreAfterStash;
set => _repo.Settings.AutoRestoreAfterStash = value;
}
public StashChanges(Repository repo, List<Models.Change> changes, bool hasSelectedFiles)
{
_repo = repo;
@ -84,6 +90,9 @@ namespace SourceGit.ViewModels
succ = StashWithChanges(_changes);
}
if (AutoRestore && succ)
succ = new Commands.Stash(_repo.FullPath).Apply();
CallUIThread(() =>
{
_repo.MarkWorkingCopyDirtyManually();