mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
feature: allow to ignore local changes also when switching branch or pulling changes (#151)
This commit is contained in:
parent
69f9dceece
commit
0b09d210be
13 changed files with 253 additions and 212 deletions
|
@ -10,10 +10,10 @@ namespace SourceGit.ViewModels
|
|||
private set;
|
||||
}
|
||||
|
||||
public bool AutoStash
|
||||
public Models.DealWithLocalChanges PreAction
|
||||
{
|
||||
get => _autoStash;
|
||||
set => SetProperty(ref _autoStash, value);
|
||||
get => _preAction;
|
||||
set => SetProperty(ref _preAction, value);
|
||||
}
|
||||
|
||||
public Checkout(Repository repo, string branch)
|
||||
|
@ -34,7 +34,7 @@ namespace SourceGit.ViewModels
|
|||
var needPopStash = false;
|
||||
if (hasLocalChanges)
|
||||
{
|
||||
if (AutoStash)
|
||||
if (_preAction == Models.DealWithLocalChanges.StashAndReaply)
|
||||
{
|
||||
SetProgressDescription("Adding untracked changes ...");
|
||||
var succ = new Commands.Add(_repo.FullPath).Exec();
|
||||
|
@ -52,7 +52,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
needPopStash = true;
|
||||
}
|
||||
else
|
||||
else if (_preAction == Models.DealWithLocalChanges.Discard)
|
||||
{
|
||||
SetProgressDescription("Discard local changes ...");
|
||||
Commands.Discard.All(_repo.FullPath);
|
||||
|
@ -78,6 +78,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
private readonly Repository _repo = null;
|
||||
private bool _autoStash = true;
|
||||
private Models.DealWithLocalChanges _preAction = Models.DealWithLocalChanges.StashAndReaply;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue