mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 05:35:00 +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
|
@ -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, false, false, SetProgressDescription).Exec();
|
||||
new Commands.Fetch(_repo.FullPath, _name, false, false, false, SetProgressDescription).Exec();
|
||||
}
|
||||
CallUIThread(() =>
|
||||
{
|
||||
|
|
|
@ -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(() =>
|
||||
|
|
|
@ -152,6 +152,7 @@ namespace SourceGit.ViewModels
|
|||
_selectedRemote.Name,
|
||||
NoTags,
|
||||
_repo.Settings.EnablePruneOnFetch,
|
||||
false,
|
||||
SetProgressDescription).Exec();
|
||||
|
||||
if (!rs)
|
||||
|
|
|
@ -2194,7 +2194,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
IsAutoFetching = true;
|
||||
Dispatcher.UIThread.Invoke(() => OnPropertyChanged(nameof(IsAutoFetching)));
|
||||
new Commands.Fetch(_fullpath, "--all", false, _settings.EnablePruneOnFetch, null) { RaiseError = false }.Exec();
|
||||
new Commands.Fetch(_fullpath, "--all", false, _settings.EnablePruneOnFetch, false, null) { RaiseError = false }.Exec();
|
||||
_lastFetchTime = DateTime.Now;
|
||||
IsAutoFetching = false;
|
||||
Dispatcher.UIThread.Invoke(() => OnPropertyChanged(nameof(IsAutoFetching)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue