feature: supports --no-tags on fetch and pull operation (#226)

This commit is contained in:
leo 2024-07-01 16:19:08 +08:00
parent de1a4d14e8
commit 6dad466eef
No known key found for this signature in database
10 changed files with 46 additions and 12 deletions

View file

@ -100,7 +100,7 @@ namespace SourceGit.ViewModels
{
SetProgressDescription("Fetching from added remote ...");
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, _name, true, false, SetProgressDescription).Exec();
}
CallUIThread(() =>
{

View file

@ -26,14 +26,19 @@ namespace SourceGit.ViewModels
{
get;
set;
}
} = true;
public bool NoTags
{
get;
set;
} = false;
public Fetch(Repository repo, Models.Remote preferedRemote = null)
{
_repo = repo;
_fetchAllRemotes = preferedRemote == null;
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
Prune = true;
View = new Views.Fetch() { DataContext = this };
}
@ -47,13 +52,13 @@ namespace SourceGit.ViewModels
foreach (var remote in _repo.Remotes)
{
SetProgressDescription($"Fetching remote: {remote.Name}");
new Commands.Fetch(_repo.FullPath, remote.Name, Prune, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, remote.Name, Prune, NoTags, SetProgressDescription).Exec();
}
}
else
{
SetProgressDescription($"Fetching remote: {SelectedRemote.Name}");
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, NoTags, SetProgressDescription).Exec();
}
CallUIThread(() => _repo.SetWatcherEnabled(true));

View file

@ -59,6 +59,12 @@ namespace SourceGit.ViewModels
set => _repo.Settings.PreferRebaseInsteadOfMerge = value;
}
public bool NoTags
{
get;
set;
} = false;
public Pull(Repository repo, Models.Branch specifiedRemoteBranch)
{
_repo = repo;
@ -145,7 +151,7 @@ namespace SourceGit.ViewModels
}
SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}...");
var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, SetProgressDescription).Exec();
var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec();
if (rs && needPopStash)
{
SetProgressDescription("Re-apply local changes...");