Skip to content

Commit 6cc0c54

Browse files
committed
enhance: remember last selection of some options while stashing changes (#610)
Signed-off-by: leo <[email protected]>
1 parent 1418591 commit 6cc0c54

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

src/Models/RepositorySettings.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ public bool EnableSignOffForCommit
112112
set;
113113
} = false;
114114

115+
public bool IncludeUntrackedWhenStash
116+
{
117+
get;
118+
set;
119+
} = true;
120+
121+
public bool OnlyStagedWhenStash
122+
{
123+
get;
124+
set;
125+
} = false;
126+
127+
public bool KeepIndexWhenStash
128+
{
129+
get;
130+
set;
131+
} = false;
132+
115133
public void PushCommitMessage(string message)
116134
{
117135
var existIdx = CommitMessages.IndexOf(message);

src/ViewModels/StashChanges.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,27 @@ public bool HasSelectedFiles
1818

1919
public bool IncludeUntracked
2020
{
21-
get;
22-
set;
21+
get => _repo.Settings.IncludeUntrackedWhenStash;
22+
set => _repo.Settings.IncludeUntrackedWhenStash = value;
2323
}
2424

2525
public bool OnlyStaged
2626
{
27-
get;
28-
set;
27+
get => _repo.Settings.OnlyStagedWhenStash;
28+
set => _repo.Settings.OnlyStagedWhenStash = value;
2929
}
3030

3131
public bool KeepIndex
3232
{
33-
get;
34-
set;
33+
get => _repo.Settings.KeepIndexWhenStash;
34+
set => _repo.Settings.KeepIndexWhenStash = value;
3535
}
3636

3737
public StashChanges(Repository repo, List<Models.Change> changes, bool hasSelectedFiles)
3838
{
3939
_repo = repo;
4040
_changes = changes;
41-
4241
HasSelectedFiles = hasSelectedFiles;
43-
IncludeUntracked = true;
44-
OnlyStaged = false;
45-
KeepIndex = false;
4642

4743
View = new Views.StashChanges() { DataContext = this };
4844
}

0 commit comments

Comments
 (0)