mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
feature: supports toggle --force
option for git fetch
command (#721)
* Background auto fetch will always disable this option * This option is not add to pull operation Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
c1c743f2ff
commit
153a1f30b2
9 changed files with 26 additions and 7 deletions
|
@ -28,10 +28,17 @@ namespace SourceGit.ViewModels
|
|||
set => _repo.Settings.FetchWithoutTags = value;
|
||||
}
|
||||
|
||||
public bool Force
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Fetch(Repository repo, Models.Remote preferedRemote = null)
|
||||
{
|
||||
_repo = repo;
|
||||
_fetchAllRemotes = preferedRemote == null;
|
||||
Force = false;
|
||||
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
|
||||
View = new Views.Fetch() { DataContext = this };
|
||||
}
|
||||
|
@ -42,6 +49,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
var notags = _repo.Settings.FetchWithoutTags;
|
||||
var prune = _repo.Settings.EnablePruneOnFetch;
|
||||
var force = Force;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (FetchAllRemotes)
|
||||
|
@ -49,13 +57,13 @@ namespace SourceGit.ViewModels
|
|||
foreach (var remote in _repo.Remotes)
|
||||
{
|
||||
SetProgressDescription($"Fetching remote: {remote.Name}");
|
||||
new Commands.Fetch(_repo.FullPath, remote.Name, notags, prune, SetProgressDescription).Exec();
|
||||
new Commands.Fetch(_repo.FullPath, remote.Name, notags, prune, force, SetProgressDescription).Exec();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProgressDescription($"Fetching remote: {SelectedRemote.Name}");
|
||||
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, prune, SetProgressDescription).Exec();
|
||||
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, prune, force, SetProgressDescription).Exec();
|
||||
}
|
||||
|
||||
CallUIThread(() =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue