diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs
index 556c99ea..44742fb8 100644
--- a/src/Models/RepositorySettings.cs
+++ b/src/Models/RepositorySettings.cs
@@ -104,6 +104,18 @@ namespace SourceGit.Models
set;
} = false;
+ public bool PushToRemoteWhenCreateTag
+ {
+ get;
+ set;
+ } = true;
+
+ public bool PushToRemoteWhenDeleteTag
+ {
+ get;
+ set;
+ } = false;
+
public DealWithLocalChanges DealWithLocalChangesOnCreateBranch
{
get;
diff --git a/src/ViewModels/CreateTag.cs b/src/ViewModels/CreateTag.cs
index af9dcf99..a6d7255b 100644
--- a/src/ViewModels/CreateTag.cs
+++ b/src/ViewModels/CreateTag.cs
@@ -39,11 +39,11 @@ namespace SourceGit.ViewModels
set;
} = false;
- public bool PushToAllRemotes
+ public bool PushToRemotes
{
- get;
- set;
- } = true;
+ get => _repo.Settings.PushToRemoteWhenCreateTag;
+ set => _repo.Settings.PushToRemoteWhenCreateTag = value;
+ }
public CreateTag(Repository repo, Models.Branch branch)
{
@@ -82,6 +82,7 @@ namespace SourceGit.ViewModels
_repo.SetWatcherEnabled(false);
ProgressDescription = "Create tag...";
+ var remotes = PushToRemotes ? _repo.Remotes : null;
return Task.Run(() =>
{
bool succ;
@@ -90,9 +91,9 @@ namespace SourceGit.ViewModels
else
succ = Commands.Tag.Add(_repo.FullPath, _tagName, _basedOn);
- if (succ && PushToAllRemotes)
+ if (succ && remotes != null)
{
- foreach (var remote in _repo.Remotes)
+ foreach (var remote in remotes)
{
SetProgressDescription($"Pushing tag to remote {remote.Name} ...");
new Commands.Push(_repo.FullPath, remote.Name, _tagName, false).Exec();
diff --git a/src/ViewModels/DeleteTag.cs b/src/ViewModels/DeleteTag.cs
index 7b53e798..341eb4a2 100644
--- a/src/ViewModels/DeleteTag.cs
+++ b/src/ViewModels/DeleteTag.cs
@@ -10,17 +10,16 @@ namespace SourceGit.ViewModels
private set;
}
- public bool ShouldPushToRemote
+ public bool PushToRemotes
{
- get;
- set;
+ get => _repo.Settings.PushToRemoteWhenDeleteTag;
+ set => _repo.Settings.PushToRemoteWhenDeleteTag = value;
}
public DeleteTag(Repository repo, Models.Tag tag)
{
_repo = repo;
Target = tag;
- ShouldPushToRemote = true;
View = new Views.DeleteTag() { DataContext = this };
}
@@ -29,9 +28,9 @@ namespace SourceGit.ViewModels
_repo.SetWatcherEnabled(false);
ProgressDescription = $"Deleting tag '{Target.Name}' ...";
+ var remotes = PushToRemotes ? _repo.Remotes : null;
return Task.Run(() =>
{
- var remotes = ShouldPushToRemote ? _repo.Remotes : null;
var succ = Commands.Tag.Delete(_repo.FullPath, Target.Name, remotes);
CallUIThread(() =>
{
diff --git a/src/Views/CreateTag.axaml b/src/Views/CreateTag.axaml
index 20b6798a..55b6052f 100644
--- a/src/Views/CreateTag.axaml
+++ b/src/Views/CreateTag.axaml
@@ -84,7 +84,7 @@
+ IsChecked="{Binding PushToRemotes, Mode=TwoWay}"/>
diff --git a/src/Views/DeleteTag.axaml b/src/Views/DeleteTag.axaml
index 702a7f2a..23c19d35 100644
--- a/src/Views/DeleteTag.axaml
+++ b/src/Views/DeleteTag.axaml
@@ -23,7 +23,7 @@
+ IsChecked="{Binding PushToRemotes, Mode=TwoWay}"/>