refactor: remove ConfigureAwait when we need to go back to UIThread after it

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-07-03 18:42:56 +08:00
parent 2a0f9f4192
commit 18b9d982ce
72 changed files with 172 additions and 399 deletions

View File

@@ -148,14 +148,6 @@ namespace SourceGit
public static async Task<bool> AskConfirmAsync(string message, Action onSure)
{
if (!Dispatcher.UIThread.CheckAccess())
{
return await Dispatcher.UIThread.InvokeAsync<bool>(async () =>
{
return await AskConfirmAsync(message, onSure);
});
}
if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
{
var confirm = new Views.Confirm();

View File

@@ -62,7 +62,7 @@ namespace SourceGit.Commands
{
bool exists = await new Remote(repo).HasBranchAsync(remote, name).ConfigureAwait(false);
if (exists)
return await new Push(repo, remote, $"refs/heads/{name}", true) { Log = log }.ExecAsync().ConfigureAwait(false);
return await new Push(repo, remote, $"refs/heads/{name}", true) { Log = log }.RunAsync().ConfigureAwait(false);
var cmd = new Command();
cmd.WorkingDirectory = repo;

View File

@@ -62,10 +62,10 @@ namespace SourceGit.ViewModels
{
await new Commands.GenerateCommitMessage(_service, _repo.FullPath, _changes, _cancel.Token, message =>
{
Dispatcher.UIThread.Invoke(() => Text = message);
}).ExecAsync();
Dispatcher.UIThread.Post(() => Text = message);
}).ExecAsync().ConfigureAwait(false);
await Dispatcher.UIThread.InvokeAsync(() => IsGenerating = false);
Dispatcher.UIThread.Post(() => IsGenerating = false);
}, _cancel.Token);
}

View File

@@ -97,20 +97,17 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Remote(_repo.FullPath)
.Use(log)
.AddAsync(_name, _url)
.ConfigureAwait(false);
.AddAsync(_name, _url);
if (succ)
{
await new Commands.Config(_repo.FullPath)
.Use(log)
.SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null)
.ConfigureAwait(false);
.SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
await new Commands.Fetch(_repo.FullPath, _name, false, false)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
}
log.Complete();

View File

@@ -61,8 +61,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Submodule(_repo.FullPath)
.Use(log)
.AddAsync(_url, relativePath, Recursive)
.ConfigureAwait(false);
.AddAsync(_url, relativePath, Recursive);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -118,8 +118,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Worktree(_repo.FullPath)
.Use(log)
.AddAsync(_path, branchName, _createNewBranch, tracking)
.ConfigureAwait(false);
.AddAsync(_path, branchName, _createNewBranch, tracking);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -51,8 +51,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Apply(_repo.FullPath, _patchFile, _ignoreWhiteSpace, SelectedWhiteSpaceMode.Arg, null)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -38,14 +38,12 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.ApplyAsync(Stash.Name, RestoreIndex)
.ConfigureAwait(false);
.ApplyAsync(Stash.Name, RestoreIndex);
if (succ && DropAfterApply)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.DropAsync(Stash.Name)
.ConfigureAwait(false);
.DropAsync(Stash.Name);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -54,8 +54,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Archive(_repo.FullPath, _revision, _saveFile)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -18,8 +18,7 @@ namespace SourceGit.ViewModels
var collect = await new Commands.QueryAssumeUnchangedFiles(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
await Dispatcher.UIThread.InvokeAsync(() => Files.AddRange(collect));
Dispatcher.UIThread.Post(() => Files.AddRange(collect));
});
}
@@ -31,8 +30,7 @@ namespace SourceGit.ViewModels
await new Commands.AssumeUnchanged(_repo.FullPath, file, false)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
Files.Remove(file);

View File

@@ -139,7 +139,7 @@ namespace SourceGit.ViewModels
.GetResultAsync()
.ConfigureAwait(false);
await Dispatcher.UIThread.InvokeAsync(() =>
Dispatcher.UIThread.Post(() =>
{
if (!token.IsCancellationRequested)
{
@@ -156,7 +156,7 @@ namespace SourceGit.ViewModels
.ReadAsync()
.ConfigureAwait(false);
await Dispatcher.UIThread.InvokeAsync(() =>
Dispatcher.UIThread.Post(() =>
{
if (!token.IsCancellationRequested)
Data = result;

View File

@@ -133,7 +133,7 @@ namespace SourceGit.ViewModels
var toolPath = Preferences.Instance.ExternalMergeToolPath;
var opt = new Models.DiffOption(_based.Head, _to.Head, change);
Task.Run(() => Commands.MergeTool.OpenForDiffAsync(_repo, toolType, toolPath, opt));
_ = Commands.MergeTool.OpenForDiffAsync(_repo, toolType, toolPath, opt);
ev.Handled = true;
};
menu.Items.Add(diffWithMerger);
@@ -190,7 +190,7 @@ namespace SourceGit.ViewModels
.GetResultAsync()
.ConfigureAwait(false);
await Dispatcher.UIThread.InvokeAsync(() =>
Dispatcher.UIThread.Post(() =>
{
BaseHead = baseHead;
ToHead = toHead;
@@ -212,7 +212,7 @@ namespace SourceGit.ViewModels
}
}
await Dispatcher.UIThread.InvokeAsync(() => VisibleChanges = visible);
Dispatcher.UIThread.Post(() => VisibleChanges = visible);
});
}

View File

@@ -56,21 +56,16 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.BranchAsync(Branch, true)
.ConfigureAwait(false);
.BranchAsync(Branch, true);
}
else
{
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).GetResultAsync();
if (changes > 0)
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync("CHECKOUT_AUTO_STASH")
.ConfigureAwait(false);
.PushAsync("CHECKOUT_AUTO_STASH");
if (!succ)
{
log.Complete();
@@ -83,30 +78,24 @@ namespace SourceGit.ViewModels
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.BranchAsync(Branch, false)
.ConfigureAwait(false);
.BranchAsync(Branch, false);
}
if (succ)
{
if (updateSubmodules)
{
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
if (submodules.Count > 0)
await new Commands.Submodule(_repo.FullPath)
.Use(log)
.UpdateAsync(submodules, true, true)
.ConfigureAwait(false);
.UpdateAsync(submodules, true, true);
}
if (needPopStash)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.PopAsync("stash@{0}")
.ConfigureAwait(false);
.PopAsync("stash@{0}");
}
log.Complete();

View File

@@ -61,22 +61,16 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, true, true)
.ConfigureAwait(false);
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, true, true);
}
else
{
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).GetResultAsync();
if (changes > 0)
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync("CHECKOUT_AND_FASTFORWARD_AUTO_STASH")
.ConfigureAwait(false);
.PushAsync("CHECKOUT_AND_FASTFORWARD_AUTO_STASH");
if (!succ)
{
log.Complete();
@@ -89,30 +83,25 @@ namespace SourceGit.ViewModels
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, false, true)
.ConfigureAwait(false);
.BranchAsync(LocalBranch.Name, RemoteBranch.Head, false, true);
}
if (succ)
{
if (updateSubmodules)
{
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
if (submodules.Count > 0)
await new Commands.Submodule(_repo.FullPath)
.Use(log)
.UpdateAsync(submodules, true, true)
.ConfigureAwait(false);
.UpdateAsync(submodules, true, true);
}
if (needPopStash)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.PopAsync("stash@{0}")
.ConfigureAwait(false);
.PopAsync("stash@{0}");
}
log.Complete();

View File

@@ -56,22 +56,16 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.CommitAsync(Commit.SHA, true)
.ConfigureAwait(false);
.CommitAsync(Commit.SHA, true);
}
else
{
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).GetResultAsync();
if (changes > 0)
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync("CHECKOUT_AUTO_STASH")
.ConfigureAwait(false);
.PushAsync("CHECKOUT_AUTO_STASH");
if (!succ)
{
log.Complete();
@@ -84,30 +78,24 @@ namespace SourceGit.ViewModels
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.CommitAsync(Commit.SHA, false)
.ConfigureAwait(false);
.CommitAsync(Commit.SHA, false);
}
if (succ)
{
if (updateSubmodules)
{
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
if (submodules.Count > 0)
await new Commands.Submodule(_repo.FullPath)
.Use(log)
.UpdateAsync(submodules, true, true)
.ConfigureAwait(false);
.UpdateAsync(submodules, true, true);
}
if (needPop)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.PopAsync("stash@{0}")
.ConfigureAwait(false);
.PopAsync("stash@{0}");
}
log.Complete();

View File

@@ -81,8 +81,7 @@ namespace SourceGit.ViewModels
AppendSourceToMessage,
$"-m {MainlineForMergeCommit + 1}")
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
}
else
{
@@ -93,8 +92,7 @@ namespace SourceGit.ViewModels
AppendSourceToMessage,
string.Empty)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
}
log.Complete();

View File

@@ -19,8 +19,7 @@ namespace SourceGit.ViewModels
await new Commands.GC(_repo.FullPath)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -19,8 +19,7 @@ namespace SourceGit.ViewModels
await new Commands.Stash(_repo.FullPath)
.Use(log)
.ClearAsync()
.ConfigureAwait(false);
.ClearAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -101,9 +101,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Clone(_pageId, _parentFolder, _remote, _local, _useSSH ? _sshKey : "", _extraArgs)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
if (succ)
return false;
@@ -133,21 +131,16 @@ namespace SourceGit.ViewModels
{
await new Commands.Config(path)
.Use(log)
.SetAsync("remote.origin.sshkey", _sshKey)
.ConfigureAwait(false);
.SetAsync("remote.origin.sshkey", _sshKey);
}
if (InitAndUpdateSubmodules)
{
var submodules = await new Commands.QueryUpdatableSubmodules(path)
.GetResultAsync()
.ConfigureAwait(false);
var submodules = await new Commands.QueryUpdatableSubmodules(path).GetResultAsync();
if (submodules.Count > 0)
await new Commands.Submodule(path)
.Use(log)
.UpdateAsync(submodules, true, true)
.ConfigureAwait(false);
.UpdateAsync(submodules, true, true);
}
log.Complete();

View File

@@ -282,10 +282,7 @@ namespace SourceGit.ViewModels
if (storageFile != null)
{
var saveTo = storageFile.Path.LocalPath;
var succ = await Commands.SaveChangesAsPatch
.ProcessRevisionCompareChangesAsync(_repo.FullPath, changes, baseRevision, _commit.SHA, saveTo)
.ConfigureAwait(false);
var succ = await Commands.SaveChangesAsPatch.ProcessRevisionCompareChangesAsync(_repo.FullPath, changes, baseRevision, _commit.SHA, saveTo);
if (succ)
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
}
@@ -334,7 +331,7 @@ namespace SourceGit.ViewModels
var toolPath = Preferences.Instance.ExternalMergeToolPath;
var opt = new Models.DiffOption(_commit, change);
Task.Run(() => Commands.MergeTool.OpenForDiffAsync(_repo.FullPath, toolType, toolPath, opt));
_ = Commands.MergeTool.OpenForDiffAsync(_repo.FullPath, toolType, toolPath, opt);
ev.Handled = true;
};
@@ -829,10 +826,7 @@ namespace SourceGit.ViewModels
lfsLock.Click += async (_, e) =>
{
var log = _repo.CreateLog("Lock LFS file");
var succ = await new Commands.LFS(_repo.FullPath)
.LockAsync(_repo.Remotes[0].Name, path, log)
.ConfigureAwait(false);
var succ = await new Commands.LFS(_repo.FullPath).LockAsync(_repo.Remotes[0].Name, path, log);
if (succ)
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
@@ -850,10 +844,7 @@ namespace SourceGit.ViewModels
lockRemote.Click += async (_, e) =>
{
var log = _repo.CreateLog("Lock LFS file");
var succ = await new Commands.LFS(_repo.FullPath)
.LockAsync(remoteName, path, log)
.ConfigureAwait(false);
var succ = await new Commands.LFS(_repo.FullPath).LockAsync(remoteName, path, log);
if (succ)
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
@@ -873,10 +864,7 @@ namespace SourceGit.ViewModels
lfsUnlock.Click += async (_, e) =>
{
var log = _repo.CreateLog("Unlock LFS file");
var succ = await new Commands.LFS(_repo.FullPath)
.UnlockAsync(_repo.Remotes[0].Name, path, false, log)
.ConfigureAwait(false);
var succ = await new Commands.LFS(_repo.FullPath).UnlockAsync(_repo.Remotes[0].Name, path, false, log);
if (succ)
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
@@ -894,10 +882,7 @@ namespace SourceGit.ViewModels
unlockRemote.Click += async (_, e) =>
{
var log = _repo.CreateLog("Unlock LFS file");
var succ = await new Commands.LFS(_repo.FullPath)
.UnlockAsync(remoteName, path, false, log)
.ConfigureAwait(false);
var succ = await new Commands.LFS(_repo.FullPath).UnlockAsync(remoteName, path, false, log);
if (succ)
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
@@ -974,36 +959,26 @@ namespace SourceGit.ViewModels
private async Task SetViewingBlobAsync(Models.Object file)
{
var isBinary = await new Commands.IsBinary(_repo.FullPath, _commit.SHA, file.Path)
.GetResultAsync()
.ConfigureAwait(false);
var isBinary = await new Commands.IsBinary(_repo.FullPath, _commit.SHA, file.Path).GetResultAsync();
if (isBinary)
{
var imgDecoder = ImageSource.GetDecoder(file.Path);
if (imgDecoder != Models.ImageDecoder.None)
{
var source = await ImageSource.FromRevisionAsync(_repo.FullPath, _commit.SHA, file.Path, imgDecoder).ConfigureAwait(false);
var source = await ImageSource.FromRevisionAsync(_repo.FullPath, _commit.SHA, file.Path, imgDecoder);
ViewRevisionFileContent = new Models.RevisionImageFile(file.Path, source.Bitmap, source.Size);
}
else
{
var size = await new Commands.QueryFileSize(_repo.FullPath, file.Path, _commit.SHA)
.GetResultAsync()
.ConfigureAwait(false);
var size = await new Commands.QueryFileSize(_repo.FullPath, file.Path, _commit.SHA).GetResultAsync();
ViewRevisionFileContent = new Models.RevisionBinaryFile() { Size = size };
}
return;
}
var contentStream = await Commands.QueryFileContent
.RunAsync(_repo.FullPath, _commit.SHA, file.Path)
.ConfigureAwait(false);
var content = await new StreamReader(contentStream)
.ReadToEndAsync()
.ConfigureAwait(false);
var contentStream = await Commands.QueryFileContent.RunAsync(_repo.FullPath, _commit.SHA, file.Path);
var content = await new StreamReader(contentStream).ReadToEndAsync();
var lfs = Models.LFSObject.Parse(content);
if (lfs != null)
{
@@ -1022,10 +997,7 @@ namespace SourceGit.ViewModels
private async Task SetViewingCommitAsync(Models.Object file)
{
var submoduleRoot = Path.Combine(_repo.FullPath, file.Path).Replace('\\', '/').Trim('/');
var commit = await new Commands.QuerySingleCommit(submoduleRoot, file.SHA)
.GetResultAsync()
.ConfigureAwait(false);
var commit = await new Commands.QuerySingleCommit(submoduleRoot, file.SHA).GetResultAsync();
if (commit == null)
{
ViewRevisionFileContent = new Models.RevisionSubmodule()
@@ -1036,10 +1008,7 @@ namespace SourceGit.ViewModels
}
else
{
var message = await new Commands.QueryCommitFullMessage(submoduleRoot, file.SHA)
.GetResultAsync()
.ConfigureAwait(false);
var message = await new Commands.QueryCommitFullMessage(submoduleRoot, file.SHA).GetResultAsync();
ViewRevisionFileContent = new Models.RevisionSubmodule()
{
Commit = commit,

View File

@@ -142,22 +142,16 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.BranchAsync(fixedName, _baseOnRevision, true, _allowOverwrite)
.ConfigureAwait(false);
.BranchAsync(fixedName, _baseOnRevision, true, _allowOverwrite);
}
else
{
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).GetResultAsync();
if (changes > 0)
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync("CREATE_BRANCH_AUTO_STASH")
.ConfigureAwait(false);
.PushAsync("CREATE_BRANCH_AUTO_STASH");
if (!succ)
{
log.Complete();
@@ -170,37 +164,29 @@ namespace SourceGit.ViewModels
succ = await new Commands.Checkout(_repo.FullPath)
.Use(log)
.BranchAsync(fixedName, _baseOnRevision, false, _allowOverwrite)
.ConfigureAwait(false);
.BranchAsync(fixedName, _baseOnRevision, false, _allowOverwrite);
}
if (succ)
{
if (updateSubmodules)
{
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
if (submodules.Count > 0)
await new Commands.Submodule(_repo.FullPath)
.Use(log)
.UpdateAsync(submodules, true, true)
.ConfigureAwait(false);
.UpdateAsync(submodules, true, true);
}
if (needPopStash)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.PopAsync("stash@{0}")
.ConfigureAwait(false);
.PopAsync("stash@{0}");
}
}
else
{
succ = await Commands.Branch
.CreateAsync(_repo.FullPath, fixedName, _baseOnRevision, _allowOverwrite, log)
.ConfigureAwait(false);
succ = await Commands.Branch.CreateAsync(_repo.FullPath, fixedName, _baseOnRevision, _allowOverwrite, log);
}
log.Complete();

View File

@@ -85,17 +85,16 @@ namespace SourceGit.ViewModels
bool succ;
if (_annotated)
succ = await Commands.Tag.AddAsync(_repo.FullPath, _tagName, _basedOn, Message, SignTag, log).ConfigureAwait(false);
succ = await Commands.Tag.AddAsync(_repo.FullPath, _tagName, _basedOn, Message, SignTag, log);
else
succ = await Commands.Tag.AddAsync(_repo.FullPath, _tagName, _basedOn, log).ConfigureAwait(false);
succ = await Commands.Tag.AddAsync(_repo.FullPath, _tagName, _basedOn, log);
if (succ && remotes != null)
{
foreach (var remote in remotes)
await new Commands.Push(_repo.FullPath, remote.Name, $"refs/tags/{_tagName}", false)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
}
log.Complete();

View File

@@ -33,8 +33,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Submodule(_repo.FullPath)
.Use(log)
.DeinitAsync(Submodule, false)
.ConfigureAwait(false);
.DeinitAsync(Submodule, false);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -49,20 +49,13 @@ namespace SourceGit.ViewModels
if (Target.IsLocal)
{
await Commands.Branch
.DeleteLocalAsync(_repo.FullPath, Target.Name, log)
.ConfigureAwait(false);
await Commands.Branch.DeleteLocalAsync(_repo.FullPath, Target.Name, log);
if (_alsoDeleteTrackingRemote && TrackingRemoteBranch != null)
await Commands.Branch
.DeleteRemoteAsync(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name, log)
.ConfigureAwait(false);
await Commands.Branch.DeleteRemoteAsync(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name, log);
}
else
{
await Commands.Branch
.DeleteRemoteAsync(_repo.FullPath, Target.Remote, Target.Name, log)
.ConfigureAwait(false);
await Commands.Branch.DeleteRemoteAsync(_repo.FullPath, Target.Remote, Target.Name, log);
}
log.Complete();

View File

@@ -28,16 +28,12 @@ namespace SourceGit.ViewModels
if (_isLocal)
{
foreach (var target in Targets)
await Commands.Branch
.DeleteLocalAsync(_repo.FullPath, target.Name, log)
.ConfigureAwait(false);
await Commands.Branch.DeleteLocalAsync(_repo.FullPath, target.Name, log);
}
else
{
foreach (var target in Targets)
await Commands.Branch
.DeleteRemoteAsync(_repo.FullPath, target.Remote, target.Name, log)
.ConfigureAwait(false);
await Commands.Branch.DeleteRemoteAsync(_repo.FullPath, target.Remote, target.Name, log);
}
log.Complete();

View File

@@ -26,8 +26,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Remote(_repo.FullPath)
.Use(log)
.DeleteAsync(Remote.Name)
.ConfigureAwait(false);
.DeleteAsync(Remote.Name);
log.Complete();
_repo.MarkBranchesDirtyManually();

View File

@@ -26,8 +26,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Submodule(_repo.FullPath)
.Use(log)
.DeleteAsync(Submodule)
.ConfigureAwait(false);
.DeleteAsync(Submodule);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -31,17 +31,13 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("Delete Tag");
Use(log);
var succ = await Commands.Tag
.DeleteAsync(_repo.FullPath, Target.Name, log)
.ConfigureAwait(false);
var succ = await Commands.Tag.DeleteAsync(_repo.FullPath, Target.Name, log);
if (succ)
{
foreach (var r in remotes)
await new Commands.Push(_repo.FullPath, r.Name, $"refs/tags/{Target.Name}", true)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
}
log.Complete();

View File

@@ -65,9 +65,9 @@ namespace SourceGit.ViewModels
Use(log);
if (Mode is DiscardAllMode all)
await Commands.Discard.AllAsync(_repo.FullPath, all.IncludeIgnored, log).ConfigureAwait(false);
await Commands.Discard.AllAsync(_repo.FullPath, all.IncludeIgnored, log);
else
await Commands.Discard.ChangesAsync(_repo.FullPath, _changes, log).ConfigureAwait(false);
await Commands.Discard.ChangesAsync(_repo.FullPath, _changes, log);
log.Complete();
_repo.MarkWorkingCopyDirtyManually();

View File

@@ -21,8 +21,7 @@ namespace SourceGit.ViewModels
await new Commands.Stash(_repo.FullPath)
.Use(log)
.DropAsync(Stash.Name)
.ConfigureAwait(false);
.DropAsync(Stash.Name);
log.Complete();
return true;

View File

@@ -53,9 +53,7 @@ namespace SourceGit.ViewModels
_useSSH = Models.Remote.IsSSH(remote.URL);
if (_useSSH)
{
SSHKey = new Commands.Config(repo.FullPath).GetAsync($"remote.{remote.Name}.sshkey").Result;
}
}
public static ValidationResult ValidateRemoteName(string name, ValidationContext ctx)
@@ -107,34 +105,23 @@ namespace SourceGit.ViewModels
if (_remote.Name != _name)
{
var succ = await new Commands.Remote(_repo.FullPath)
.RenameAsync(_remote.Name, _name)
.ConfigureAwait(false);
var succ = await new Commands.Remote(_repo.FullPath).RenameAsync(_remote.Name, _name);
if (succ)
_remote.Name = _name;
}
if (_remote.URL != _url)
{
var succ = await new Commands.Remote(_repo.FullPath)
.SetURLAsync(_name, _url, false)
.ConfigureAwait(false);
var succ = await new Commands.Remote(_repo.FullPath).SetURLAsync(_name, _url, false);
if (succ)
_remote.URL = _url;
}
var pushURL = await new Commands.Remote(_repo.FullPath)
.GetURLAsync(_name, true)
.ConfigureAwait(false);
var pushURL = await new Commands.Remote(_repo.FullPath).GetURLAsync(_name, true);
if (pushURL != _url)
await new Commands.Remote(_repo.FullPath)
.SetURLAsync(_name, _url, true)
.ConfigureAwait(false);
await new Commands.Remote(_repo.FullPath).SetURLAsync(_name, _url, true);
await new Commands.Config(_repo.FullPath)
.SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null)
.ConfigureAwait(false);
await new Commands.Config(_repo.FullPath).SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
_repo.SetWatcherEnabled(true);
return true;

View File

@@ -68,15 +68,13 @@ namespace SourceGit.ViewModels
foreach (var remote in _repo.Remotes)
await new Commands.Fetch(_repo.FullPath, remote.Name, notags, force)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
}
else
{
await new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, force)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
}
log.Complete();
@@ -84,9 +82,7 @@ namespace SourceGit.ViewModels
var upstream = _repo.CurrentBranch?.Upstream;
if (!string.IsNullOrEmpty(upstream))
{
var upstreamHead = await new Commands.QueryRevisionByRefName(_repo.FullPath, upstream.Substring(13))
.GetResultAsync()
.ConfigureAwait(false);
var upstreamHead = await new Commands.QueryRevisionByRefName(_repo.FullPath, upstream.Substring(13)).GetResultAsync();
_repo.NavigateToCommit(upstreamHead, true);
}

View File

@@ -31,15 +31,11 @@ namespace SourceGit.ViewModels
await new Commands.Fetch(_repo.FullPath, Local, Upstream)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
log.Complete();
var newHead = await new Commands.QueryRevisionByRefName(_repo.FullPath, Local.Name)
.GetResultAsync()
.ConfigureAwait(false);
var newHead = await new Commands.QueryRevisionByRefName(_repo.FullPath, Local.Name).GetResultAsync();
_repo.NavigateToCommit(newHead, true);
_repo.SetWatcherEnabled(true);
return true;

View File

@@ -50,10 +50,7 @@ namespace SourceGit.ViewModels
var prefix = _repo.GitFlow.GetPrefix(Type);
var name = Branch.Name.StartsWith(prefix) ? Branch.Name.Substring(prefix.Length) : Branch.Name;
var succ = await Commands.GitFlow
.FinishAsync(_repo.FullPath, Type, name, Squash, AutoPush, KeepBranch, log)
.ConfigureAwait(false);
var succ = await Commands.GitFlow.FinishAsync(_repo.FullPath, Type, name, Squash, AutoPush, KeepBranch, log);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -57,10 +57,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("GitFlow - Start");
Use(log);
var succ = await Commands.GitFlow
.StartAsync(_repo.FullPath, Type, _name, log)
.ConfigureAwait(false);
var succ = await Commands.GitFlow.StartAsync(_repo.FullPath, Type, _name, log);
log.Complete();
_repo.SetWatcherEnabled(true);
return succ;

View File

@@ -602,7 +602,7 @@ namespace SourceGit.ViewModels
{
var parent = _commits.Find(x => x.SHA == sha);
if (parent == null)
parent = await new Commands.QuerySingleCommit(_repo.FullPath, sha).GetResultAsync().ConfigureAwait(false);
parent = await new Commands.QuerySingleCommit(_repo.FullPath, sha).GetResultAsync();
if (parent != null)
parents.Add(parent);
@@ -692,7 +692,7 @@ namespace SourceGit.ViewModels
if (head == null)
{
_repo.SelectedSearchedCommit = null;
head = await new Commands.QuerySingleCommit(_repo.FullPath, current.Head).GetResultAsync().ConfigureAwait(false);
head = await new Commands.QuerySingleCommit(_repo.FullPath, current.Head).GetResultAsync();
if (head != null)
DetailContext = new RevisionCompare(_repo.FullPath, commit, head);
}

View File

@@ -38,13 +38,13 @@ namespace SourceGit.ViewModels
public static async Task<ImageSource> FromFileAsync(string fullpath, Models.ImageDecoder decoder)
{
await using (var stream = File.OpenRead(fullpath))
return await Task.Run(() => LoadFromStream(stream, decoder));
return await Task.Run(() => LoadFromStream(stream, decoder)).ConfigureAwait(false);
}
public static async Task<ImageSource> FromRevisionAsync(string repo, string revision, string file, Models.ImageDecoder decoder)
{
var stream = await Commands.QueryFileContent.RunAsync(repo, revision, file).ConfigureAwait(false);
return await Task.Run(() => LoadFromStream(stream, decoder));
return await Task.Run(() => LoadFromStream(stream, decoder)).ConfigureAwait(false);
}
public static async Task<ImageSource> FromLFSObjectAsync(string repo, Models.LFSObject lfs, Models.ImageDecoder decoder)
@@ -53,7 +53,7 @@ namespace SourceGit.ViewModels
return new ImageSource(null, 0);
var stream = await Commands.QueryFileContent.FromLFSAsync(repo, lfs.Oid, lfs.Size).ConfigureAwait(false);
return await Task.Run(() => LoadFromStream(stream, decoder));
return await Task.Run(() => LoadFromStream(stream, decoder)).ConfigureAwait(false);
}
private static ImageSource LoadFromStream(Stream stream, Models.ImageDecoder decoder)

View File

@@ -33,8 +33,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Init(_pageId, _targetPath)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();

View File

@@ -114,7 +114,7 @@ namespace SourceGit.ViewModels
var masterBranch = _repo.Branches.Find(x => x.IsLocal && x.Name.Equals(_master, StringComparison.Ordinal));
if (masterBranch == null)
{
succ = await Commands.Branch.CreateAsync(_repo.FullPath, _master, current.Head, true, log).ConfigureAwait(false);
succ = await Commands.Branch.CreateAsync(_repo.FullPath, _master, current.Head, true, log);
if (!succ)
{
log.Complete();
@@ -126,7 +126,7 @@ namespace SourceGit.ViewModels
var developBranch = _repo.Branches.Find(x => x.IsLocal && x.Name.Equals(_develop, StringComparison.Ordinal));
if (developBranch == null)
{
succ = await Commands.Branch.CreateAsync(_repo.FullPath, _develop, current.Head, true, log).ConfigureAwait(false);
succ = await Commands.Branch.CreateAsync(_repo.FullPath, _develop, current.Head, true, log);
if (!succ)
{
log.Complete();
@@ -143,7 +143,7 @@ namespace SourceGit.ViewModels
_releasePrefix,
_hotfixPrefix,
_tagPrefix,
log).ConfigureAwait(false);
log);
log.Complete();

View File

@@ -214,8 +214,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("Interactive Rebase");
var succ = await new Commands.InteractiveRebase(_repo.FullPath, On.SHA)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -27,9 +27,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("LFS Fetch");
Use(log);
await new Commands.LFS(_repo.FullPath)
.FetchAsync(SelectedRemote.Name, log)
.ConfigureAwait(false);
await new Commands.LFS(_repo.FullPath).FetchAsync(SelectedRemote.Name, log);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -63,10 +63,7 @@ namespace SourceGit.ViewModels
IsLoading = true;
var log = _repo.CreateLog("Unlock LFS File");
var succ = await new Commands.LFS(_repo.FullPath)
.UnlockAsync(_remote, lfsLock.ID, force, log)
.ConfigureAwait(false);
var succ = await new Commands.LFS(_repo.FullPath).UnlockAsync(_remote, lfsLock.ID, force, log);
log.Complete();
if (succ)

View File

@@ -17,9 +17,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("LFS Prune");
Use(log);
await new Commands.LFS(_repo.FullPath)
.PruneAsync(log)
.ConfigureAwait(false);
await new Commands.LFS(_repo.FullPath).PruneAsync(log);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -27,9 +27,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("LFS Pull");
Use(log);
await new Commands.LFS(_repo.FullPath)
.PullAsync(SelectedRemote.Name, log)
.ConfigureAwait(false);
await new Commands.LFS(_repo.FullPath).PullAsync(SelectedRemote.Name, log);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -27,9 +27,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("LFS Push");
Use(log);
await new Commands.LFS(_repo.FullPath)
.PushAsync(SelectedRemote.Name, log)
.ConfigureAwait(false);
await new Commands.LFS(_repo.FullPath).PushAsync(SelectedRemote.Name, log);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -31,9 +31,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("LFS Add Custom Pattern");
Use(log);
var succ = await new Commands.LFS(_repo.FullPath)
.TrackAsync(_pattern, IsFilename, log)
.ConfigureAwait(false);
var succ = await new Commands.LFS(_repo.FullPath).TrackAsync(_pattern, IsFilename, log);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -67,15 +67,11 @@ namespace SourceGit.ViewModels
await new Commands.Merge(_repo.FullPath, _sourceName, Mode.Arg, Edit)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
var head = await new Commands.QueryRevisionByRefName(_repo.FullPath, "HEAD")
.GetResultAsync()
.ConfigureAwait(false);
var head = await new Commands.QueryRevisionByRefName(_repo.FullPath, "HEAD").GetResultAsync();
_repo.NavigateToCommit(head, true);
_repo.SetWatcherEnabled(true);
return true;

View File

@@ -53,8 +53,7 @@ namespace SourceGit.ViewModels
AutoCommit,
Strategy.Arg)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -25,8 +25,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Remote(_repo.FullPath)
.Use(log)
.PruneAsync(Remote.Name)
.ConfigureAwait(false);
.PruneAsync(Remote.Name);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -19,8 +19,7 @@ namespace SourceGit.ViewModels
await new Commands.Worktree(_repo.FullPath)
.Use(log)
.PruneAsync()
.ConfigureAwait(false);
.PruneAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -119,25 +119,17 @@ namespace SourceGit.ViewModels
Use(log);
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).GetResultAsync();
var needPopStash = false;
if (changes > 0)
{
if (DiscardLocalChanges)
{
await Commands.Discard
.AllAsync(_repo.FullPath, false, log)
.ConfigureAwait(false);
await Commands.Discard.AllAsync(_repo.FullPath, false, log);
}
else
{
var succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync("PULL_AUTO_STASH")
.ConfigureAwait(false);
var succ = await new Commands.Stash(_repo.FullPath).Use(log).PushAsync("PULL_AUTO_STASH");
if (!succ)
{
log.Complete();
@@ -153,38 +145,23 @@ namespace SourceGit.ViewModels
_repo.FullPath,
_selectedRemote.Name,
!string.IsNullOrEmpty(Current.Upstream) && Current.Upstream.Equals(_selectedBranch.FullName) ? string.Empty : _selectedBranch.Name,
UseRebase)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
UseRebase).Use(log).RunAsync();
if (rs)
{
if (updateSubmodules)
{
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
if (submodules.Count > 0)
await new Commands.Submodule(_repo.FullPath)
.Use(log)
.UpdateAsync(submodules, true, true)
.ConfigureAwait(false);
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules, true, true);
}
if (needPopStash)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.PopAsync("stash@{0}")
.ConfigureAwait(false);
await new Commands.Stash(_repo.FullPath).Use(log).PopAsync("stash@{0}");
}
log.Complete();
var head = await new Commands.QueryRevisionByRefName(_repo.FullPath, "HEAD")
.GetResultAsync()
.ConfigureAwait(false);
var head = await new Commands.QueryRevisionByRefName(_repo.FullPath, "HEAD").GetResultAsync();
_repo.NavigateToCommit(head, true);
_repo.SetWatcherEnabled(true);
return rs;

View File

@@ -176,10 +176,7 @@ namespace SourceGit.ViewModels
PushAllTags,
_repo.Submodules.Count > 0 && CheckSubmodules,
_isSetTrackOptionVisible && Tracking,
ForcePush)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
ForcePush).Use(log).RunAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -44,7 +44,7 @@ namespace SourceGit.ViewModels
false,
false,
false,
Force).Use(log).ExecAsync().ConfigureAwait(false);
Force).Use(log).RunAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -50,8 +50,7 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Push(_repo.FullPath, remote.Name, tag, false)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
if (!succ)
break;
}
@@ -60,8 +59,7 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Push(_repo.FullPath, SelectedRemote.Name, tag, false)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.RunAsync();
}
log.Complete();

View File

@@ -51,8 +51,7 @@ namespace SourceGit.ViewModels
await new Commands.Rebase(_repo.FullPath, _revision, AutoStash)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -31,8 +31,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Worktree(_repo.FullPath)
.Use(log)
.RemoveAsync(Target.FullPath, Force)
.ConfigureAwait(false);
.RemoveAsync(Target.FullPath, Force);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -59,8 +59,7 @@ namespace SourceGit.ViewModels
var isCurrent = Target.IsCurrent;
var oldName = Target.FullName;
var succ = await Commands.Branch
.RenameAsync(_repo.FullPath, Target.Name, fixedName, log)
.ConfigureAwait(false);
.RenameAsync(_repo.FullPath, Target.Name, fixedName, log);
if (succ)
{

View File

@@ -1113,10 +1113,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Bisect(_fullpath, subcmd).Use(log).ExecAsync();
log.Complete();
var head = await new Commands.QueryRevisionByRefName(_fullpath, "HEAD")
.GetResultAsync()
.ConfigureAwait(false);
var head = await new Commands.QueryRevisionByRefName(_fullpath, "HEAD").GetResultAsync();
if (!succ)
App.RaiseException(_fullpath, log.Content.Substring(log.Content.IndexOf('\n')).Trim());
else if (log.Content.Contains("is the first bad commit"))
@@ -1345,7 +1342,7 @@ namespace SourceGit.ViewModels
if (_currentBranch is not { IsDetachedHead: true })
return true;
var refs = await new Commands.QueryRefsContainsCommit(_fullpath, _currentBranch.Head).GetResultAsync().ConfigureAwait(false);
var refs = await new Commands.QueryRefsContainsCommit(_fullpath, _currentBranch.Head).GetResultAsync();
if (refs.Count == 0)
{
var msg = App.Text("Checkout.WarnLostCommits");
@@ -2018,7 +2015,7 @@ namespace SourceGit.ViewModels
if (_histories != null)
{
var target = await new Commands.QuerySingleCommit(_fullpath, branch.Head).GetResultAsync().ConfigureAwait(false);
var target = await new Commands.QuerySingleCommit(_fullpath, branch.Head).GetResultAsync();
_histories.AutoSelectedCommit = null;
_histories.DetailContext = new RevisionCompare(_fullpath, target, null);
}
@@ -2297,7 +2294,7 @@ namespace SourceGit.ViewModels
if (_histories != null)
{
var target = await new Commands.QuerySingleCommit(_fullpath, branch.Head).GetResultAsync().ConfigureAwait(false);
var target = await new Commands.QuerySingleCommit(_fullpath, branch.Head).GetResultAsync();
_histories.AutoSelectedCommit = null;
_histories.DetailContext = new RevisionCompare(_fullpath, target, null);
}
@@ -2965,7 +2962,7 @@ namespace SourceGit.ViewModels
Dispatcher.UIThread.Invoke(() => IsAutoFetching = true);
foreach (var remote in remotes)
await new Commands.Fetch(_fullpath, remote, false, false) { RaiseError = false }.ExecAsync();
await new Commands.Fetch(_fullpath, remote, false, false) { RaiseError = false }.RunAsync();
_lastFetchTime = DateTime.Now;
Dispatcher.UIThread.Invoke(() => IsAutoFetching = false);
}

View File

@@ -38,8 +38,7 @@ namespace SourceGit.ViewModels
var succ = await new Commands.Reset(_repo.FullPath, To.SHA, SelectedMode.Arg)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -38,10 +38,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog($"Reset '{Target.Name}' to '{_revision}'");
Use(log);
var succ = await Commands.Branch
.CreateAsync(_repo.FullPath, Target.Name, _revision, true, log)
.ConfigureAwait(false);
var succ = await Commands.Branch.CreateAsync(_repo.FullPath, Target.Name, _revision, true, log);
log.Complete();
_repo.SetWatcherEnabled(true);
return succ;

View File

@@ -33,8 +33,7 @@ namespace SourceGit.ViewModels
await new Commands.Revert(_repo.FullPath, Target.SHA, AutoCommit)
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -44,6 +44,7 @@ namespace SourceGit.ViewModels
var minDelay = Task.Delay(500);
var rootDir = new DirectoryInfo(_selected.Path);
var found = new List<string>();
await GetUnmanagedRepositoriesAsync(rootDir, found, new EnumerationOptions()
{
AttributesToSkip = FileAttributes.Hidden | FileAttributes.System,

View File

@@ -61,10 +61,7 @@ namespace SourceGit.ViewModels
var log = _repo.CreateLog("Set Upstream");
Use(log);
var succ = await Commands.Branch
.SetUpstreamAsync(_repo.FullPath, Local.Name, upstream.Replace("refs/remotes/", ""), log)
.ConfigureAwait(false);
var succ = await Commands.Branch.SetUpstreamAsync(_repo.FullPath, Local.Name, upstream.Replace("refs/remotes/", ""), log);
log.Complete();
if (succ)

View File

@@ -40,8 +40,7 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync("SQUASH_AUTO_STASH")
.ConfigureAwait(false);
.PushAsync("SQUASH_AUTO_STASH");
if (!succ)
{
@@ -55,20 +54,17 @@ namespace SourceGit.ViewModels
succ = await new Commands.Reset(_repo.FullPath, Target.SHA, "--soft")
.Use(log)
.ExecAsync()
.ConfigureAwait(false);
.ExecAsync();
if (succ)
succ = await new Commands.Commit(_repo.FullPath, _message, signOff, true, false)
.Use(log)
.RunAsync()
.ConfigureAwait(false);
.RunAsync();
if (succ && autoStashed)
await new Commands.Stash(_repo.FullPath)
.Use(log)
.PopAsync("stash@{0}")
.ConfigureAwait(false);
.PopAsync("stash@{0}");
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -70,8 +70,7 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushOnlyStagedAsync(Message, keepIndex)
.ConfigureAwait(false);
.PushOnlyStagedAsync(Message, keepIndex);
}
else
{
@@ -89,8 +88,7 @@ namespace SourceGit.ViewModels
{
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.PushAsync(Message, IncludeUntracked, keepIndex)
.ConfigureAwait(false);
.PushAsync(Message, IncludeUntracked, keepIndex);
}
}
else
@@ -101,8 +99,7 @@ namespace SourceGit.ViewModels
if (mode == DealWithChangesAfterStashing.KeepAll && succ)
succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.ApplyAsync("stash@{0}", true)
.ConfigureAwait(false);
.ApplyAsync("stash@{0}", true);
log.Complete();
_repo.MarkWorkingCopyDirtyManually();

View File

@@ -65,8 +65,7 @@ namespace SourceGit.ViewModels
await new Commands.Submodule(_repo.FullPath)
.Use(log)
.UpdateAsync(targets, EnableInit, EnableRecursive, EnableRemote)
.ConfigureAwait(false);
.UpdateAsync(targets, EnableInit, EnableRecursive, EnableRemote);
log.Complete();
_repo.SetWatcherEnabled(true);

View File

@@ -1924,7 +1924,7 @@ namespace SourceGit.ViewModels
log.Complete();
await Dispatcher.UIThread.InvokeAsync(async () =>
Dispatcher.UIThread.Post(async () =>
{
if (succ)
{
@@ -1935,7 +1935,7 @@ namespace SourceGit.ViewModels
{
if (_repo.CurrentBranch == null)
{
var currentBranchName = await new Commands.QueryCurrentBranch(_repo.FullPath).GetResultAsync().ConfigureAwait(false);
var currentBranchName = await new Commands.QueryCurrentBranch(_repo.FullPath).GetResultAsync();
var tmp = new Models.Branch() { Name = currentBranchName };
_repo.ShowAndStartPopup(new Push(_repo, tmp));
}

View File

@@ -125,7 +125,7 @@ namespace SourceGit.Views
if (tooltip is Models.Commit commit && commit.SHA.Equals(sha, StringComparison.Ordinal))
return;
var c = await detail.GetCommitAsync(sha).ConfigureAwait(false);
var c = await detail.GetCommitAsync(sha);
if (c is not null && ctl is { IsEffectivelyVisible: true, DataContext: string newSHA } && sha.Equals(newSHA, StringComparison.Ordinal))
ToolTip.SetTip(ctl, c);
}

View File

@@ -13,7 +13,7 @@ namespace SourceGit.Views
public async Task SetDataAsync(ViewModels.CommitDetail detail)
{
LoadingIcon.IsVisible = true;
var containsIn = await detail.GetRefsContainsThisCommitAsync().ConfigureAwait(false);
var containsIn = await detail.GetRefsContainsThisCommitAsync();
Container.ItemsSource = containsIn;
LoadingIcon.IsVisible = false;
}

View File

@@ -29,7 +29,7 @@ namespace SourceGit.Views
{
if (sender is Button { DataContext: ViewModels.FileHistoriesSingleRevision single })
{
await single.ResetToSelectedRevisionAsync().ConfigureAwait(false);
await single.ResetToSelectedRevisionAsync();
NotifyDonePanel.IsVisible = true;
}

View File

@@ -158,7 +158,7 @@ namespace SourceGit.Views
if (vm?.Commit == null)
return;
var objects = await vm.GetRevisionFilesUnderFolderAsync(file).ConfigureAwait(false);
var objects = await vm.GetRevisionFilesUnderFolderAsync(file);
if (objects is not { Count: 1 })
return;
@@ -258,7 +258,7 @@ namespace SourceGit.Views
return;
}
var objects = await vm.GetRevisionFilesUnderFolderAsync(null).ConfigureAwait(false);
var objects = await vm.GetRevisionFilesUnderFolderAsync(null);
if (objects == null || objects.Count == 0)
{
GC.Collect();
@@ -324,7 +324,7 @@ namespace SourceGit.Views
if (vm == null)
return null;
var objects = await vm.GetRevisionFilesUnderFolderAsync(node.Backend.Path + "/").ConfigureAwait(false);
var objects = await vm.GetRevisionFilesUnderFolderAsync(node.Backend.Path + "/");
if (objects == null || objects.Count == 0)
return null;

View File

@@ -1843,7 +1843,7 @@ namespace SourceGit.Views
if (!selection.HasLeftChanges)
{
await new Commands.Add(repo.FullPath, change).ExecAsync().ConfigureAwait(false);
await new Commands.Add(repo.FullPath, change).ExecAsync();
}
else
{
@@ -1854,16 +1854,16 @@ namespace SourceGit.Views
}
else if (chunk.Combined)
{
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync().ConfigureAwait(false);
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync();
diff.GeneratePatchFromSelection(change, treeGuid, selection, false, tmpFile);
}
else
{
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync().ConfigureAwait(false);
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync();
diff.GeneratePatchFromSelectionSingleSide(change, treeGuid, selection, false, chunk.IsOldSide, tmpFile);
}
await new Commands.Apply(diff.Repo, tmpFile, true, "nowarn", "--cache --index").ExecAsync().ConfigureAwait(false);
await new Commands.Apply(diff.Repo, tmpFile, true, "nowarn", "--cache --index").ExecAsync();
File.Delete(tmpFile);
}
@@ -1898,13 +1898,13 @@ namespace SourceGit.Views
if (!selection.HasLeftChanges)
{
if (change.DataForAmend != null)
await new Commands.UnstageChangesForAmend(repo.FullPath, [change]).ExecAsync().ConfigureAwait(false);
await new Commands.UnstageChangesForAmend(repo.FullPath, [change]).ExecAsync();
else
await new Commands.Restore(repo.FullPath, change).ExecAsync().ConfigureAwait(false);
await new Commands.Restore(repo.FullPath, change).ExecAsync();
}
else
{
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync().ConfigureAwait(false);
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync();
var tmpFile = Path.GetTempFileName();
if (change.Index == Models.ChangeState.Added)
diff.GenerateNewPatchFromSelection(change, treeGuid, selection, true, tmpFile);
@@ -1913,7 +1913,7 @@ namespace SourceGit.Views
else
diff.GeneratePatchFromSelectionSingleSide(change, treeGuid, selection, true, chunk.IsOldSide, tmpFile);
await new Commands.Apply(diff.Repo, tmpFile, true, "nowarn", "--cache --index --reverse").ExecAsync().ConfigureAwait(false);
await new Commands.Apply(diff.Repo, tmpFile, true, "nowarn", "--cache --index --reverse").ExecAsync();
File.Delete(tmpFile);
}
@@ -1947,7 +1947,7 @@ namespace SourceGit.Views
if (!selection.HasLeftChanges)
{
await Commands.Discard.ChangesAsync(repo.FullPath, [change], null).ConfigureAwait(false);
await Commands.Discard.ChangesAsync(repo.FullPath, [change], null);
}
else
{
@@ -1958,16 +1958,16 @@ namespace SourceGit.Views
}
else if (chunk.Combined)
{
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync().ConfigureAwait(false);
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync();
diff.GeneratePatchFromSelection(change, treeGuid, selection, true, tmpFile);
}
else
{
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync().ConfigureAwait(false);
var treeGuid = await new Commands.QueryStagedFileBlobGuid(diff.Repo, change.Path).GetResultAsync();
diff.GeneratePatchFromSelectionSingleSide(change, treeGuid, selection, true, chunk.IsOldSide, tmpFile);
}
await new Commands.Apply(diff.Repo, tmpFile, true, "nowarn", "--reverse").ExecAsync().ConfigureAwait(false);
await new Commands.Apply(diff.Repo, tmpFile, true, "nowarn", "--reverse").ExecAsync();
File.Delete(tmpFile);
}