Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Commands/Fetch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SourceGit.Commands
{
public class Fetch : Command
{
public Fetch(string repo, string remote, bool noTags, bool force)
public Fetch(string repo, string remote, bool? noTags, bool force)
{
_remote = remote;

Expand All @@ -14,7 +14,8 @@ public Fetch(string repo, string remote, bool noTags, bool force)

var builder = new StringBuilder(512);
builder.Append("fetch --progress --verbose ");
builder.Append(noTags ? "--no-tags " : "--tags ");
if (noTags.HasValue)
builder.Append(noTags.Value ? "--no-tags " : "--tags ");
if (force)
builder.Append("--force ");
builder.Append(remote);
Expand Down
11 changes: 9 additions & 2 deletions src/ViewModels/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,21 +1850,28 @@ private async Task AutoFetchOnUIThread()
remotes.Add(r.Name);

IsAutoFetching = true;
var log = CreateLog("background Fetch");

if (_settings.FetchAllRemotes)
{
foreach (var remote in remotes)
await new Commands.Fetch(FullPath, remote, false, false) { RaiseError = false }.RunAsync();
await new Commands.Fetch(FullPath, remote, null, false) { RaiseError = false }
.Use(log)
.RunAsync();
}
else if (remotes.Count > 0)
{
var remote = string.IsNullOrEmpty(_settings.DefaultRemote) ?
remotes.Find(x => x.Equals(_settings.DefaultRemote, StringComparison.Ordinal)) :
remotes[0];

await new Commands.Fetch(FullPath, remote, false, false) { RaiseError = false }.RunAsync();
await new Commands.Fetch(FullPath, remote, null, false) { RaiseError = false }
.Use(log)
.RunAsync();
}

log.Complete();

_lastFetchTime = DateTime.Now;
IsAutoFetching = false;
}
Expand Down
Loading