Skip to content

Commit 95d40c3

Browse files
author
Thomas Michiels
committed
add background fetch to log + background fetch respects git defaults (since you have no explicit option to use)
1 parent a6a0c3b commit 95d40c3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Commands/Fetch.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace SourceGit.Commands
55
{
66
public class Fetch : Command
77
{
8-
public Fetch(string repo, string remote, bool noTags, bool force)
8+
public Fetch(string repo, string remote, bool? noTags, bool force)
99
{
1010
_remote = remote;
1111

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

1515
var builder = new StringBuilder(512);
1616
builder.Append("fetch --progress --verbose ");
17-
builder.Append(noTags ? "--no-tags " : "--tags ");
17+
if (noTags.HasValue)
18+
builder.Append(noTags.Value ? "--no-tags " : "--tags ");
1819
if (force)
1920
builder.Append("--force ");
2021
builder.Append(remote);

src/ViewModels/Repository.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,21 +1850,28 @@ private async Task AutoFetchOnUIThread()
18501850
remotes.Add(r.Name);
18511851

18521852
IsAutoFetching = true;
1853+
var log = CreateLog("background Fetch");
18531854

18541855
if (_settings.FetchAllRemotes)
18551856
{
18561857
foreach (var remote in remotes)
1857-
await new Commands.Fetch(FullPath, remote, false, false) { RaiseError = false }.RunAsync();
1858+
await new Commands.Fetch(FullPath, remote, null, false) { RaiseError = false }
1859+
.Use (log)
1860+
.RunAsync();
18581861
}
18591862
else if (remotes.Count > 0)
18601863
{
18611864
var remote = string.IsNullOrEmpty(_settings.DefaultRemote) ?
18621865
remotes.Find(x => x.Equals(_settings.DefaultRemote, StringComparison.Ordinal)) :
18631866
remotes[0];
18641867

1865-
await new Commands.Fetch(FullPath, remote, false, false) { RaiseError = false }.RunAsync();
1868+
await new Commands.Fetch(FullPath, remote, null, false) { RaiseError = false }
1869+
.Use (log)
1870+
.RunAsync();
18661871
}
18671872

1873+
log.Complete();
1874+
18681875
_lastFetchTime = DateTime.Now;
18691876
IsAutoFetching = false;
18701877
}

0 commit comments

Comments
 (0)