Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoComplete: Ignore Git exceptions for git-status by file #11031

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions GitUI/AutoCompletion/CommitAutoCompleteProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public async Task<IEnumerable<AutoCompleteWord>> GetAutoCompleteWordsAsync(Cance

IGitModule module = GetModule();
ArgumentString cmd = GitCommandHelpers.GetAllChangedFilesCmd(true, UntrackedFilesMode.Default, noLocks: true);
ExecutionResult result = await module.GitExecutable.ExecuteAsync(cmd, throwOnErrorExit: false);
ExecutionResult result = await module.GitExecutable.ExecuteAsync(cmd, throwOnErrorExit: false, cancellationToken: cancellationToken);
if (!result.ExitedSuccessfully)
{
// Try again
result = await module.GitExecutable.ExecuteAsync(cmd, throwOnErrorExit: false);
result = await module.GitExecutable.ExecuteAsync(cmd, throwOnErrorExit: false, cancellationToken: cancellationToken);
}

if (!result.ExitedSuccessfully)
Expand Down Expand Up @@ -158,8 +158,16 @@ private static IEnumerable<string> ReadOrInitializeAutoCompleteRegexes()
{
if (file.IsTracked)
{
GitCommands.Patches.Patch changes = await module.GetCurrentChangesAsync(file.Name, file.OldName, file.Staged == StagedStatus.Index, "-U1000000", noLocks: true)
.ConfigureAwait(false);
GitCommands.Patches.Patch? changes = null;
try
{
changes = await module.GetCurrentChangesAsync(file.Name, file.OldName, file.Staged == StagedStatus.Index, "-U1000000", noLocks: true)
.ConfigureAwait(false);
}
catch
{
// Ignore errors, this can be very repetitive
}

if (changes is not null)
{
Expand Down